blob: c13a1ac38e3b21a4396aa65837f428c89c3a1909 [file] [log] [blame]
Mohammed Nasera4e52902022-08-30 00:20:05 -04001name: test
2on:
3 pull_request: {}
Mohammed Nasera4e52902022-08-30 00:20:05 -04004
5jobs:
Mohammed Naserbd5667e2022-09-01 17:38:14 -04006 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]15743e02022-09-05 13:28:24 +000012 - uses: tj-actions/changed-files@v29.0.3
Mohammed Naserbd5667e2022-09-01 17:38:14 -040013 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 Naser50dc73d2022-09-01 17:42:48 -040020 - run: echo PROJECT_REF=$(cat images/prometheus-ethtool-exporter/ref) >> $GITHUB_ENV
21 if: steps.changed-files.outputs.any_changed == 'true'
Mohammed Naserbd5667e2022-09-01 17:38:14 -040022 - 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 Naser50dc73d2022-09-01 17:42:48 -040037 PROJECT_REF=${{ env.PROJECT_REF }}
Mohammed Naserbd5667e2022-09-01 17:38:14 -040038 tags: |
Mohammed Naser50dc73d2022-09-01 17:42:48 -040039 quay.io/vexxhost/ethtool-exporter:${{ env.PROJECT_REF }}
Mohammed Naserbd5667e2022-09-01 17:38:14 -040040
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040041 build-image-strategy:
Mohammed Nasera4e52902022-08-30 00:20:05 -040042 runs-on: ubuntu-latest
43 steps:
44 - uses: actions/checkout@v3.0.2
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040045 - id: set-strategy
Mohammed Naser81d183d2022-08-30 03:14:11 -040046 run: echo "::set-output name=strategy::$(./ci/build-image-strategy build)"
Mohammed Nasera4e52902022-08-30 00:20:05 -040047 outputs:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040048 strategy: ${{ steps.set-strategy.outputs.strategy }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040049
50 build-openstack-images:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040051 if: needs.build-image-strategy.outputs.strategy != '{}'
Mohammed Nasera4e52902022-08-30 00:20:05 -040052 runs-on: ubuntu-latest
Mohammed Naser4762fb92022-08-30 00:42:11 -040053 needs:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040054 - build-image-strategy
55 strategy: ${{ fromJSON(needs.build-image-strategy.outputs.strategy) }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040056 steps:
Mohammed Naser82e50812022-08-30 00:58:10 -040057 - 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 Nasera4e52902022-08-30 00:20:05 -040060 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
Mohammed Naser82e50812022-08-30 00:58:10 -040061 - uses: docker/login-action@v2.0.0
Mohammed Nasera4e52902022-08-30 00:20:05 -040062 with:
63 registry: quay.io
64 username: ${{ secrets.QUAY_USERNAME }}
65 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
Mohammed Naser82e50812022-08-30 00:58:10 -040066 - uses: docker/build-push-action@v3.1.1
Mohammed Nasera4e52902022-08-30 00:20:05 -040067 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