diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2022-07-13 14:17:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-13 07:17:37 -0400 |
commit | 70f19efb7d4b5b7543f2d718493fffaaf518f15b (patch) | |
tree | 5cd3377b71c160d87f58e95661f829f017b3fe50 | |
parent | 8d9fb91b20b14c6dd5b2a81c0209e8e4bf1a88c8 (diff) |
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>
-rwxr-xr-x | .github/scripts/gen-docker-tags.py | 5 | ||||
-rw-r--r-- | .github/workflows/docker.yml | 80 | ||||
-rw-r--r-- | packaging/docker/Dockerfile | 6 | ||||
-rwxr-xr-x | packaging/docker/gen-cflags.sh | 9 |
4 files changed, 96 insertions, 4 deletions
diff --git a/.github/scripts/gen-docker-tags.py b/.github/scripts/gen-docker-tags.py index 6c62511557..df4dc02635 100755 --- a/.github/scripts/gen-docker-tags.py +++ b/.github/scripts/gen-docker-tags.py @@ -2,9 +2,10 @@ import sys -REPO = 'netdata/netdata' - version = sys.argv[1].split('.') +suffix = sys.argv[2] + +REPO = f'netdata/netdata{suffix}' MAJOR = ':'.join([REPO, version[0]]) MINOR = ':'.join([REPO, '.'.join(version[0:2])]) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c89a8924e4..b7eb53c8ec 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -151,7 +151,7 @@ jobs: id: release-tags if: github.event.inputs.version != 'nightly' run: | - echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }})" \ + echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '')" \ >> "${GITHUB_ENV}" - name: Determine which tags to use id: nightly-tags @@ -218,3 +218,81 @@ jobs: workflow: Agent Version PR ref: refs/heads/master inputs: '{"agent_version": "${{ needs.normalize-tag.outputs.tag }}"}' + + docker-dbg-publish: + if: github.event_name == 'workflow_dispatch' + name: Docker Build and Publish (Debuging Image) + needs: + - docker-test + - normalize-tag + runs-on: ubuntu-latest + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Determine which tags to use + id: release-tags + if: github.event.inputs.version != 'nightly' + run: | + echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '-debug')" \ + >> "${GITHUB_ENV}" + - name: Determine which tags to use + id: nightly-tags + if: github.event.inputs.version == 'nightly' + run: | + echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:edge" >> "${GITHUB_ENV}" + - name: Mark image as official + id: env + if: github.repository == 'netdata/netdata' + run: echo "OFFICIAL_IMAGE=true" >> "${GITHUB_ENV}" + - name: Setup QEMU + id: qemu + uses: docker/setup-qemu-action@v2 + - name: Setup Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + - name: Docker Hub Login + id: login + if: github.repository == 'netdata/netdata' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Docker Build + id: build + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64,linux/ppc64le + push: ${{ github.repository == 'netdata/netdata' }} + tags: ${{ env.tags }} + build-args: | + OFFICIAL_IMAGE=${{ env.OFFICIAL_IMAGE }} + DEBUG_BUILD=1 + - name: Failure Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: 'danger' + SLACK_FOOTER: '' + SLACK_ICON_EMOJI: ':github-actions:' + SLACK_TITLE: 'Docker Debug Build failed:' + SLACK_USERNAME: 'GitHub Actions' + SLACK_MESSAGE: |- + ${{ github.repository }}: Failed to build or publish Docker debug images. + CHeckout: ${{ steps.checkout.outcome }} + Generate release tags: ${{ steps.release-tags.outcome }} + Generate nightly tags: ${{ steps.nightly-tags.outcome }} + Setup environment: ${{ steps.env.outcome }} + Setup QEMU: ${{ steps.qemu.outcome }} + Setup buildx: ${{ steps.buildx.outcome }} + Authenticate against DockerHub: ${{ steps.login.outcome }} + Build and publish images: ${{ steps.build.outcome }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + if: >- + ${{ + failure() + && github.event_name != 'pull_request' + && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' + }} diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index f72d0a9c86..1dfabc7e2a 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -18,6 +18,10 @@ ARG EXTRA_INSTALL_OPTS ENV EXTRA_INSTALL_OPTS=$EXTRA_INSTALL_OPTS +ARG DEBUG_BUILD + +ENV DEBUG_BUILD=$DEBUG_BUILD + # Copy source COPY . /opt/netdata.git WORKDIR /opt/netdata.git @@ -26,7 +30,7 @@ WORKDIR /opt/netdata.git RUN chmod +x netdata-installer.sh && \ cp -rp /deps/* /usr/local/ && \ /bin/echo -e "INSTALL_TYPE='oci'\nPREBUILT_ARCH='$(uname -m)'" > ./system/.install-type && \ - CFLAGS=${CFLAGS:-"-O2 -pipe"} ./netdata-installer.sh --dont-wait --dont-start-it --use-system-protobuf \ + CFLAGS="$(packaging/docker/gen-cflags.sh)" ./netdata-installer.sh --dont-wait --dont-start-it --use-system-protobuf \ ${EXTRA_INSTALL_OPTS} --one-time-build "$([ "$RELEASE_CHANNEL" = stable ] && echo --stable-channel)" # files to one directory diff --git a/packaging/docker/gen-cflags.sh b/packaging/docker/gen-cflags.sh new file mode 100755 index 0000000000..3a80b73582 --- /dev/null +++ b/packaging/docker/gen-cflags.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -n "${CFLAGS}" ]; then + echo "${CFLAGS}" +elif [ -n "${DEBUG_BUILD}" ]; then + echo "-Og -ggdb -pipe" +else + echo "-O2 -pipe" +fi |