@cryptotaxi247 / netdata-1 / commits / 887c0bc96

Reorganize Docker CI to run faster. (#11513)

This restructures our Docker CI so that we do the builds for PR CI checks in parallel where possible, and each platform shows up as it’s own build. This makes the PR CI checks run _much_ faster and also ensures that when a given image build fails, it0s obvious which one failed.

Austin S. Hemmelgarn committed Sep 22, 2021 at 09:43 UTC 887c0bc968c41b94172fea45bbc60c62c9a31a81
1 file changed +57 -23
.github/workflows/docker.yml
+57 -23
@@ -14,52 +14,86 @@ on:
14 env:
15 DO_NOT_TRACK: 1
16 jobs:
17 - docker-build:
18 - name: Docker Build
17 + docker-test:
18 + name: Docker Runtime Test
19 runs-on: ubuntu-latest
20 steps:
21 - name: Checkout
22 uses: actions/checkout@v2
23 with:
24 submodules: recursive
25 - - name: Determine if we should push changes and which tags to use
26 - if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != 'nightly'
25 + - name: Setup Buildx
26 + uses: docker/setup-buildx-action@v1
27 + - name: Test Build
28 + uses: docker/build-push-action@v2
29 + with:
30 + load: true
31 + push: false
32 + tags: netdata/netdata:test
33 + - name: Test Image
34 + run: .github/scripts/docker-test.sh
35 +
36 + docker-ci:
37 + if: github.event_name != 'workflow_dispatch'
38 + name: Docker Alt Arch Builds
39 + needs: docker-test
40 + runs-on: ubuntu-latest
41 + strategy:
42 + matrix:
43 + platforms:
44 + - linux/i386
45 + - linux/arm/v7
46 + - linux/arm64
47 + steps:
48 + - name: Checkout
49 + uses: actions/checkout@v2
50 + with:
51 + submodules: recursive
52 + - name: Setup QEMU
53 + if: matrix.platforms != 'linux/i386'
54 + uses: docker/setup-qemu-action@v1
55 + - name: Setup Buildx
56 + uses: docker/setup-buildx-action@v1
57 + - name: Build
58 + uses: docker/build-push-action@v2
59 + with:
60 + platforms: ${{ matrix.platforms }}
61 + load: false
62 + push: false
63 + tags: netdata/netdata:test
64 +
65 + docker-publish:
66 + if: github.event_name == 'workflow_dispatch'
67 + name: Docker Build and Publish
68 + needs: docker-test
69 + runs-on: ubuntu-latest
70 + steps:
71 + - name: Checkout
72 + uses: actions/checkout@v2
73 + with:
74 + submodules: recursive
75 + - name: Determine which tags to use
76 + if: github.event.inputs.version != 'nightly'
77 run: |
28 - echo "publish=true" >> $GITHUB_ENV
78 echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ github.event.inputs.version }})" >> $GITHUB_ENV
30 - - name: Determine if we should push changes and which tags to use
31 - if: github.event_name == 'workflow_dispatch' && github.event.inputs.version == 'nightly'
79 + - name: Determine which tags to use
80 + if: github.event.inputs.version == 'nightly'
81 run: |
33 - echo "publish=true" >> $GITHUB_ENV
82 echo "tags=netdata/netdata:latest,netdata/netdata:edge" >> $GITHUB_ENV
35 - - name: Determine if we should push changes and which tags to use
36 - if: github.event_name != 'workflow_dispatch'
37 - run: |
38 - echo "publish=false" >> $GITHUB_ENV
39 - echo "tags=netdata/netdata:test" >> $GITHUB_ENV
83 - name: Setup QEMU
84 uses: docker/setup-qemu-action@v1
85 - name: Setup Buildx
86 uses: docker/setup-buildx-action@v1
87 - name: Docker Hub Login
45 - if: github.event_name == 'workflow_dispatch'
88 uses: docker/login-action@v1
89 with:
90 username: ${{ secrets.DOCKER_HUB_USERNAME }}
91 password: ${{ secrets.DOCKER_HUB_PASSWORD }}
50 - - name: Test Build
51 - uses: docker/build-push-action@v2
52 - with:
53 - load: true
54 - push: false
55 - tags: netdata/netdata:test
56 - - name: Test Image
57 - run: .github/scripts/docker-test.sh
92 - name: Docker Build
93 uses: docker/build-push-action@v2
94 with:
95 platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64
62 - push: ${{ env.publish }}
96 + push: true
97 tags: ${{ env.tags }}
98 - name: Failure Notification
99 uses: rtCamp/action-slack-notify@v2