123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- ---
- name: Docker
- on:
- push:
- branches:
- - master
- pull_request: null
- workflow_dispatch:
- inputs:
- version:
- description: Version Tag
- default: nightly
- required: true
- env:
- DISABLE_TELEMETRY: 1
- concurrency:
- group: docker-${{ github.ref }}-${{ github.event_name }}
- cancel-in-progress: true
- jobs:
- file-check: # Check what files changed if we’re being run in a PR or on a push.
- name: Check Modified Files
- runs-on: ubuntu-latest
- outputs:
- run: ${{ steps.check-run.outputs.run }}
- steps:
- - name: Checkout
- id: checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- submodules: recursive
- - name: Check files
- id: file-check
- uses: tj-actions/changed-files@v40
- with:
- since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
- files: |
- **.c
- **.cc
- **.h
- **.hh
- **.in
- .dockerignore
- configure.ac
- netdata-installer.sh
- **/Makefile*
- Makefile*
- .github/workflows/docker.yml
- .github/scripts/docker-test.sh
- build/**
- packaging/docker/**
- packaging/installer/**
- aclk/aclk-schemas/
- ml/dlib/
- mqtt_websockets
- web/server/h2o/libh2o
- files_ignore: |
- netdata.spec.in
- **.md
- - name: Check Run
- id: check-run
- run: |
- if [ "${{ steps.file-check.outputs.any_modified }}" == "true" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
- echo 'run=true' >> "${GITHUB_OUTPUT}"
- else
- echo 'run=false' >> "${GITHUB_OUTPUT}"
- fi
- docker-test:
- name: Docker Runtime Test
- needs:
- - file-check
- runs-on: ubuntu-latest
- steps:
- - name: Skip Check
- id: skip
- if: needs.file-check.outputs.run != 'true'
- run: echo "SKIPPED"
- - name: Checkout
- id: checkout
- if: needs.file-check.outputs.run == 'true'
- uses: actions/checkout@v4
- with:
- submodules: recursive
- - name: Setup Buildx
- id: prepare
- if: needs.file-check.outputs.run == 'true'
- uses: docker/setup-buildx-action@v3
- - name: Test Build
- id: build
- if: needs.file-check.outputs.run == 'true'
- uses: docker/build-push-action@v5
- with:
- load: true
- push: false
- tags: netdata/netdata:test
- - name: Test Image
- id: test
- if: needs.file-check.outputs.run == 'true'
- run: .github/scripts/docker-test.sh
- - name: Failure Notification
- uses: rtCamp/action-slack-notify@v2
- env:
- SLACK_COLOR: 'danger'
- SLACK_FOOTER: ''
- SLACK_ICON_EMOJI: ':github-actions:'
- SLACK_TITLE: 'Docker runtime testing failed:'
- SLACK_USERNAME: 'GitHub Actions'
- SLACK_MESSAGE: |-
- ${{ github.repository }}: Building or testing Docker image for linux/amd64 failed.
- CHeckout: ${{ steps.checkout.outcome }}
- Setup buildx: ${{ steps.prepare.outcome }}
- Build image: ${{ steps.build.outcome }}
- Test image: ${{ steps.test.outcome }}
- SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
- if: >-
- ${{
- failure()
- && github.event_name != 'pull_request'
- && startsWith(github.ref, 'refs/heads/master')
- && github.repository == 'netdata/netdata'
- && needs.file-check.outputs.run == 'true'
- }}
- docker-ci:
- if: github.event_name != 'workflow_dispatch'
- name: Docker Alt Arch Builds
- needs:
- - docker-test
- - file-check
- runs-on: ubuntu-latest
- strategy:
- matrix:
- platforms:
- - linux/i386
- - linux/arm/v7
- - linux/arm64
- - linux/ppc64le
- steps:
- - name: Skip Check
- id: skip
- if: needs.file-check.outputs.run != 'true'
- run: echo "SKIPPED"
- - name: Checkout
- id: checkout
- if: needs.file-check.outputs.run == 'true'
- uses: actions/checkout@v4
- with:
- submodules: recursive
- - name: Setup QEMU
- id: qemu
- if: matrix.platforms != 'linux/i386' && needs.file-check.outputs.run == 'true'
- uses: docker/setup-qemu-action@v3
- - name: Setup Buildx
- id: buildx
- if: needs.file-check.outputs.run == 'true'
- uses: docker/setup-buildx-action@v3
- - name: Build
- id: build
- if: needs.file-check.outputs.run == 'true'
- uses: docker/build-push-action@v5
- with:
- platforms: ${{ matrix.platforms }}
- load: false
- push: false
- tags: netdata/netdata:test
- - name: Failure Notification
- uses: rtCamp/action-slack-notify@v2
- env:
- SLACK_COLOR: 'danger'
- SLACK_FOOTER: ''
- SLACK_ICON_EMOJI: ':github-actions:'
- SLACK_TITLE: 'Docker build testing failed:'
- SLACK_USERNAME: 'GitHub Actions'
- SLACK_MESSAGE: |-
- ${{ github.repository }}: Building Docker image for ${{ matrix.platforms }} failed.
- CHeckout: ${{ steps.checkout.outcome }}
- Setup QEMU: ${{ steps.qemu.outcome }}
- Setup buildx: ${{ steps.buildx.outcome }}
- Build image: ${{ 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'
- && needs.file-check.outputs.run == 'true'
- }}
- normalize-tag: # Fix the release tag if needed
- name: Normalize Release Tag
- runs-on: ubuntu-latest
- if: github.event_name == 'workflow_dispatch'
- outputs:
- tag: ${{ steps.tag.outputs.tag }}
- steps:
- - name: Normalize Tag
- id: tag
- run: |
- if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
- echo "tag=v${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
- else
- echo "tag=${{ github.event.inputs.version }}" >> "${GITHUB_OUTPUT}"
- fi
- docker-publish:
- if: github.event_name == 'workflow_dispatch'
- name: Docker Build and Publish
- needs:
- - docker-test
- - normalize-tag
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- id: checkout
- uses: actions/checkout@v4
- with:
- submodules: recursive
- - name: Determine which tags to use
- id: release-tags
- if: github.event.inputs.version != 'nightly'
- run: |
- echo "tags=netdata/netdata:latest,netdata/netdata:stable,ghcr.io/netdata/netdata:latest,ghcr.io/netdata/netdata:stable,quay.io/netdata/netdata:latest,quay.io/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
- if: github.event.inputs.version == 'nightly'
- run: |
- echo "tags=netdata/netdata:latest,netdata/netdata:edge,ghcr.io/netdata/netdata:latest,ghcr.io/netdata/netdata:edge,quay.io/netdata/netdata:latest,quay.io/netdata/netdata: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@v3
- - name: Setup Buildx
- id: buildx
- uses: docker/setup-buildx-action@v3
- - name: Docker Hub Login
- id: docker-hub-login
- if: github.repository == 'netdata/netdata'
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_HUB_USERNAME }}
- password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- - name: GitHub Container Registry Login
- id: ghcr-login
- if: github.repository == 'netdata/netdata'
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.repository_owner }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Quay.io Login
- id: quay-login
- if: github.repository == 'netdata/netdata'
- uses: docker/login-action@v3
- with:
- registry: quay.io
- username: ${{ secrets.NETDATABOT_QUAY_USERNAME }}
- password: ${{ secrets.NETDATABOT_QUAY_TOKEN }}
- - name: Docker Build
- id: build
- uses: docker/build-push-action@v5
- 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 }}
- - name: Failure Notification
- uses: rtCamp/action-slack-notify@v2
- env:
- SLACK_COLOR: 'danger'
- SLACK_FOOTER: ''
- SLACK_ICON_EMOJI: ':github-actions:'
- SLACK_TITLE: 'Docker Build failed:'
- SLACK_USERNAME: 'GitHub Actions'
- SLACK_MESSAGE: |-
- ${{ github.repository }}: Failed to build or publish Docker 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 }}
- Login to DockerHub: ${{ steps.docker-hub-login.outcome }}
- Login to GHCR: ${{ steps.ghcr-login.outcome }}
- Login to Quay: ${{ steps.quay-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'
- }}
- - name: Trigger Helmchart PR
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != 'nightly' && github.repository == 'netdata/netdata'
- uses: benc-uk/workflow-dispatch@v1
- with:
- token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
- repo: netdata/helmchart
- workflow: Agent Version PR
- ref: refs/heads/master
- inputs: '{"agent_version": "${{ needs.normalize-tag.outputs.tag }}"}'
- - name: Trigger MSI build
- if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != 'nightly' && github.repository == 'netdata/netdata'
- uses: benc-uk/workflow-dispatch@v1
- with:
- token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
- repo: netdata/msi-installer
- workflow: Build
- ref: refs/heads/master
- inputs: '{"tag": "${{ needs.normalize-tag.outputs.tag }}", "pwd": "${{ secrets.MSI_CODE_SIGNING_PASSWORD }}"}'
- docker-dbg-publish:
- if: github.event_name == 'workflow_dispatch'
- name: Docker Build and Publish (Debugging Image)
- needs:
- - docker-test
- - normalize-tag
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- id: checkout
- uses: actions/checkout@v4
- 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,ghcr.io/netdata/netdata-debug:latest,ghcr.io/netdata/netdata-debug:stable,quay.io/netdata/netdata-debug:latest,quay.io/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,ghcr.io/netdata/netdata-debug:latest,ghcr.io/netdata/netdata-debug:edge,quay.io/netdata/netdata-debug:latest,quay.io/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@v3
- - name: Setup Buildx
- id: buildx
- uses: docker/setup-buildx-action@v3
- - name: Docker Hub Login
- id: docker-hub-login
- if: github.repository == 'netdata/netdata'
- uses: docker/login-action@v3
- with:
- username: ${{ secrets.DOCKER_HUB_USERNAME }}
- password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- - name: GitHub Container Registry Login
- id: ghcr-login
- if: github.repository == 'netdata/netdata'
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.repository_owner }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Quay.io Login
- id: quay-login
- if: github.repository == 'netdata/netdata'
- uses: docker/login-action@v3
- with:
- registry: quay.io
- username: ${{ secrets.NETDATABOT_QUAY_USERNAME }}
- password: ${{ secrets.NETDATABOT_QUAY_TOKEN }}
- - name: Docker Build
- id: build
- uses: docker/build-push-action@v5
- 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 }}
- Login to DockerHub: ${{ steps.docker-hub-login.outcome }}
- Login to GHCR: ${{ steps.ghcr-login.outcome }}
- Login to Quay: ${{ steps.quay-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'
- }}
|