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