@cryptotaxi247 / netdata-1 / commits / 70f19efb7

Add additional Docker image build with debug info included. (#13359)

* Add additional Docker image build with debug info included. * Assorted fixes. * Update packaging/docker/gen-cflags.sh Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud> Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>

Austin S. Hemmelgarn committed Jul 13, 2022 at 14:17 UTC 70f19efb7d4b5b7543f2d718493fffaaf518f15b
4 files changed +96 -4
.github/scripts/gen-docker-tags.py
+3 -2
@@ -2,9 +2,10 @@
2
3 import sys
4
5 -REPO = 'netdata/netdata'
6 -
5 version = sys.argv[1].split('.')
6 +suffix = sys.argv[2]
7 +
8 +REPO = f'netdata/netdata{suffix}'
9
10 MAJOR = ':'.join([REPO, version[0]])
11 MINOR = ':'.join([REPO, '.'.join(version[0:2])])
.github/workflows/docker.yml
+79 -1
@@ -151,7 +151,7 @@ jobs:
151 id: release-tags
152 if: github.event.inputs.version != 'nightly'
153 run: |
154 - echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }})" \
154 + echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '')" \
155 >> "${GITHUB_ENV}"
156 - name: Determine which tags to use
157 id: nightly-tags
@@ -218,3 +218,81 @@ jobs:
218 workflow: Agent Version PR
219 ref: refs/heads/master
220 inputs: '{"agent_version": "${{ needs.normalize-tag.outputs.tag }}"}'
221 +
222 + docker-dbg-publish:
223 + if: github.event_name == 'workflow_dispatch'
224 + name: Docker Build and Publish (Debuging Image)
225 + needs:
226 + - docker-test
227 + - normalize-tag
228 + runs-on: ubuntu-latest
229 + steps:
230 + - name: Checkout
231 + id: checkout
232 + uses: actions/checkout@v3
233 + with:
234 + submodules: recursive
235 + - name: Determine which tags to use
236 + id: release-tags
237 + if: github.event.inputs.version != 'nightly'
238 + run: |
239 + echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '-debug')" \
240 + >> "${GITHUB_ENV}"
241 + - name: Determine which tags to use
242 + id: nightly-tags
243 + if: github.event.inputs.version == 'nightly'
244 + run: |
245 + echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:edge" >> "${GITHUB_ENV}"
246 + - name: Mark image as official
247 + id: env
248 + if: github.repository == 'netdata/netdata'
249 + run: echo "OFFICIAL_IMAGE=true" >> "${GITHUB_ENV}"
250 + - name: Setup QEMU
251 + id: qemu
252 + uses: docker/setup-qemu-action@v2
253 + - name: Setup Buildx
254 + id: buildx
255 + uses: docker/setup-buildx-action@v2
256 + - name: Docker Hub Login
257 + id: login
258 + if: github.repository == 'netdata/netdata'
259 + uses: docker/login-action@v2
260 + with:
261 + username: ${{ secrets.DOCKER_HUB_USERNAME }}
262 + password: ${{ secrets.DOCKER_HUB_PASSWORD }}
263 + - name: Docker Build
264 + id: build
265 + uses: docker/build-push-action@v3
266 + with:
267 + platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64,linux/ppc64le
268 + push: ${{ github.repository == 'netdata/netdata' }}
269 + tags: ${{ env.tags }}
270 + build-args: |
271 + OFFICIAL_IMAGE=${{ env.OFFICIAL_IMAGE }}
272 + DEBUG_BUILD=1
273 + - name: Failure Notification
274 + uses: rtCamp/action-slack-notify@v2
275 + env:
276 + SLACK_COLOR: 'danger'
277 + SLACK_FOOTER: ''
278 + SLACK_ICON_EMOJI: ':github-actions:'
279 + SLACK_TITLE: 'Docker Debug Build failed:'
280 + SLACK_USERNAME: 'GitHub Actions'
281 + SLACK_MESSAGE: |-
282 + ${{ github.repository }}: Failed to build or publish Docker debug images.
283 + CHeckout: ${{ steps.checkout.outcome }}
284 + Generate release tags: ${{ steps.release-tags.outcome }}
285 + Generate nightly tags: ${{ steps.nightly-tags.outcome }}
286 + Setup environment: ${{ steps.env.outcome }}
287 + Setup QEMU: ${{ steps.qemu.outcome }}
288 + Setup buildx: ${{ steps.buildx.outcome }}
289 + Authenticate against DockerHub: ${{ steps.login.outcome }}
290 + Build and publish images: ${{ steps.build.outcome }}
291 + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
292 + if: >-
293 + ${{
294 + failure()
295 + && github.event_name != 'pull_request'
296 + && startsWith(github.ref, 'refs/heads/master')
297 + && github.repository == 'netdata/netdata'
298 + }}
packaging/docker/Dockerfile
+5 -1
@@ -18,6 +18,10 @@ ARG EXTRA_INSTALL_OPTS
18
19 ENV EXTRA_INSTALL_OPTS=$EXTRA_INSTALL_OPTS
20
21 +ARG DEBUG_BUILD
22 +
23 +ENV DEBUG_BUILD=$DEBUG_BUILD
24 +
25 # Copy source
26 COPY . /opt/netdata.git
27 WORKDIR /opt/netdata.git
@@ -26,7 +30,7 @@ WORKDIR /opt/netdata.git
30 RUN chmod +x netdata-installer.sh && \
31 cp -rp /deps/* /usr/local/ && \
32 /bin/echo -e "INSTALL_TYPE='oci'\nPREBUILT_ARCH='$(uname -m)'" > ./system/.install-type && \
29 - CFLAGS=${CFLAGS:-"-O2 -pipe"} ./netdata-installer.sh --dont-wait --dont-start-it --use-system-protobuf \
33 + CFLAGS="$(packaging/docker/gen-cflags.sh)" ./netdata-installer.sh --dont-wait --dont-start-it --use-system-protobuf \
34 ${EXTRA_INSTALL_OPTS} --one-time-build "$([ "$RELEASE_CHANNEL" = stable ] && echo --stable-channel)"
35
36 # files to one directory
packaging/docker/gen-cflags.sh new
+9
@@ -0,0 +1,9 @@
1 +#!/bin/sh
2 +
3 +if [ -n "${CFLAGS}" ]; then
4 + echo "${CFLAGS}"
5 +elif [ -n "${DEBUG_BUILD}" ]; then
6 + echo "-Og -ggdb -pipe"
7 +else
8 + echo "-O2 -pipe"
9 +fi