Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 1 | name: test |
| 2 | on: |
| 3 | pull_request: {} |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 4 | |
| 5 | jobs: |
Mohammed Naser | bd5667e | 2022-09-01 17:38:14 -0400 | [diff] [blame] | 6 | build-prometheus-ethtool-exporter: |
| 7 | runs-on: ubuntu-latest |
| 8 | steps: |
| 9 | - uses: actions/checkout@v3.0.2 |
| 10 | with: |
| 11 | fetch-depth: 0 |
dependabot[bot] | 15743e0 | 2022-09-05 13:28:24 +0000 | [diff] [blame] | 12 | - uses: tj-actions/changed-files@v29.0.3 |
Mohammed Naser | bd5667e | 2022-09-01 17:38:14 -0400 | [diff] [blame] | 13 | id: changed-files |
| 14 | with: |
| 15 | files: images/prometheus-ethtool-exporter/* |
| 16 | - uses: docker/setup-qemu-action@v2.0.0 |
| 17 | if: steps.changed-files.outputs.any_changed == 'true' |
| 18 | - uses: docker/setup-buildx-action@v2.0.0 |
| 19 | if: steps.changed-files.outputs.any_changed == 'true' |
Mohammed Naser | 50dc73d | 2022-09-01 17:42:48 -0400 | [diff] [blame] | 20 | - run: echo PROJECT_REF=$(cat images/prometheus-ethtool-exporter/ref) >> $GITHUB_ENV |
| 21 | if: steps.changed-files.outputs.any_changed == 'true' |
Mohammed Naser | bd5667e | 2022-09-01 17:38:14 -0400 | [diff] [blame] | 22 | - uses: docker/login-action@v2.0.0 |
| 23 | if: steps.changed-files.outputs.any_changed == 'true' |
| 24 | with: |
| 25 | registry: quay.io |
| 26 | username: ${{ secrets.QUAY_USERNAME }} |
| 27 | password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
| 28 | - uses: docker/build-push-action@v3.1.1 |
| 29 | if: steps.changed-files.outputs.any_changed == 'true' |
| 30 | with: |
| 31 | context: images/prometheus-ethtool-exporter |
| 32 | cache-from: type=gha,scope=prometheus-ethtool-exporter |
| 33 | cache-to: type=gha,mode=max,scope=prometheus-ethtool-exporter |
| 34 | platforms: linux/amd64,linux/arm64 |
| 35 | push: true |
| 36 | build-args: | |
Mohammed Naser | 50dc73d | 2022-09-01 17:42:48 -0400 | [diff] [blame] | 37 | PROJECT_REF=${{ env.PROJECT_REF }} |
Mohammed Naser | bd5667e | 2022-09-01 17:38:14 -0400 | [diff] [blame] | 38 | tags: | |
Mohammed Naser | 50dc73d | 2022-09-01 17:42:48 -0400 | [diff] [blame] | 39 | quay.io/vexxhost/ethtool-exporter:${{ env.PROJECT_REF }} |
Mohammed Naser | bd5667e | 2022-09-01 17:38:14 -0400 | [diff] [blame] | 40 | |
Mohammed Naser | bd5eaa1 | 2022-08-30 03:03:49 -0400 | [diff] [blame] | 41 | build-image-strategy: |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 42 | runs-on: ubuntu-latest |
| 43 | steps: |
| 44 | - uses: actions/checkout@v3.0.2 |
Mohammed Naser | bd5eaa1 | 2022-08-30 03:03:49 -0400 | [diff] [blame] | 45 | - id: set-strategy |
Mohammed Naser | 81d183d | 2022-08-30 03:14:11 -0400 | [diff] [blame] | 46 | run: echo "::set-output name=strategy::$(./ci/build-image-strategy build)" |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 47 | outputs: |
Mohammed Naser | bd5eaa1 | 2022-08-30 03:03:49 -0400 | [diff] [blame] | 48 | strategy: ${{ steps.set-strategy.outputs.strategy }} |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 49 | |
| 50 | build-openstack-images: |
Mohammed Naser | bd5eaa1 | 2022-08-30 03:03:49 -0400 | [diff] [blame] | 51 | if: needs.build-image-strategy.outputs.strategy != '{}' |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 52 | runs-on: ubuntu-latest |
Mohammed Naser | 4762fb9 | 2022-08-30 00:42:11 -0400 | [diff] [blame] | 53 | needs: |
Mohammed Naser | bd5eaa1 | 2022-08-30 03:03:49 -0400 | [diff] [blame] | 54 | - build-image-strategy |
| 55 | strategy: ${{ fromJSON(needs.build-image-strategy.outputs.strategy) }} |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 56 | steps: |
Mohammed Naser | 82e5081 | 2022-08-30 00:58:10 -0400 | [diff] [blame] | 57 | - uses: actions/checkout@v3.0.2 |
| 58 | - uses: docker/setup-qemu-action@v2.0.0 |
| 59 | - uses: docker/setup-buildx-action@v2.0.0 |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 60 | - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV |
Mohammed Naser | 82e5081 | 2022-08-30 00:58:10 -0400 | [diff] [blame] | 61 | - uses: docker/login-action@v2.0.0 |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 62 | with: |
| 63 | registry: quay.io |
| 64 | username: ${{ secrets.QUAY_USERNAME }} |
| 65 | password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
Mohammed Naser | 82e5081 | 2022-08-30 00:58:10 -0400 | [diff] [blame] | 66 | - uses: docker/build-push-action@v3.1.1 |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 67 | with: |
| 68 | context: images/openstack |
| 69 | cache-from: type=gha,scope=${{ matrix.project }}-${{ matrix.release }} |
| 70 | cache-to: type=gha,mode=max,scope=${{ matrix.project }}-${{ matrix.release }} |
| 71 | platforms: ${{ env.PLATFORMS }} |
| 72 | push: true |
| 73 | build-args: | |
| 74 | RELEASE=${{ matrix.release }} |
| 75 | PROJECT=${{ matrix.project }} |
| 76 | PROJECT_REF=${{ env.PROJECT_REF }} |
| 77 | PROFILES=${{ env.PROFILES }} |
| 78 | DIST_PACKAGES=${{ env.DIST_PACKAGES }} |
| 79 | PIP_PACKAGES=${{ env.PIP_PACKAGES }} |
| 80 | tags: | |
| 81 | quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }} |
| 82 | |
| 83 | # TODO(mnaser): Molecule |