Static Builder #1769
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # Builds the Docker images we use for producing our static builds. | |
| name: Static Builder | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| push: | |
| branches: | |
| - 'master' | |
| pull_request: | |
| concurrency: | |
| group: static-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| matrix: | |
| name: Prepare Build Matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| build-matrix: ${{ steps.build.outputs.matrix }} | |
| pr-matrix: ${{ steps.pr.outputs.matrix }} | |
| publish-matrix: ${{ steps.publish.outputs.matrix }} | |
| steps: | |
| - name: Checkout | |
| id: checkout | |
| uses: actions/checkout@v5 | |
| - name: Prepare tools | |
| id: prepare | |
| run: | | |
| sudo apt-get update || true | |
| sudo apt-get install -y python3-ruamel.yaml | |
| - name: Prepare Build Check Matrix | |
| id: build | |
| run: | | |
| matrix="$(.github/scripts/gen-matrix-static.py build)" | |
| echo "Generated matrix: ${matrix}" | |
| echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" | |
| - name: Prepare PR Check Matrix | |
| id: pr | |
| run: | | |
| matrix="$(.github/scripts/gen-matrix-static.py pr)" | |
| echo "Generated matrix: ${matrix}" | |
| echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" | |
| - name: Prepare Publish Matrix | |
| id: publish | |
| run: | | |
| matrix="$(.github/scripts/gen-matrix-static.py publish)" | |
| echo "Generated matrix: ${matrix}" | |
| echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}" | |
| build-check: | |
| name: Build Check | |
| if: github.event_name == 'pull_request' | |
| needs: | |
| - matrix | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: ${{ fromJson(needs.matrix.outputs.build-matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Test Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| load: false | |
| push: false | |
| tags: netdata/static-builder:test | |
| file: ./static-builder/Dockerfile.${{ matrix.revision }} | |
| pr-checks: | |
| name: PR Checks | |
| if: github.event_name == 'pull_request' | |
| needs: | |
| - build-check | |
| - matrix | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: ${{ fromJson(needs.matrix.outputs.pr-matrix) }} | |
| steps: | |
| - name: Skip Check | |
| id: skip | |
| run: echo "SKIPPED" | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: ${{ matrix.platforms }} | |
| load: false | |
| push: false | |
| tags: netdata/static-builder:test | |
| file: ./static-builder/Dockerfile.${{ matrix.revision }} | |
| publish: | |
| name: Publish Images | |
| if: github.event_name == 'push' || (github.event_name == 'schedule' && github.repository == 'netdata/helper-images') | |
| runs-on: ubuntu-latest | |
| needs: | |
| - matrix | |
| strategy: | |
| matrix: ${{ fromJson(needs.matrix.outputs.publish-matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker Hub Login | |
| uses: docker/login-action@v3 | |
| with: | |
| username: netdatabot | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: GitHub Container Registry Login | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Quay.io Login | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.NETDATABOT_QUAY_USERNAME }} | |
| password: ${{ secrets.NETDATABOT_QUAY_TOKEN }} | |
| - name: Docker Build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| platforms: ${{ matrix.platforms }} | |
| push: true | |
| file: ./static-builder/Dockerfile.${{ matrix.revision }} | |
| tags: ${{ matrix.tags }} |