blob: dd1d5b881cf5a1b09b82ff669ef5132b0f7637ff [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
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 Naserbd5eaa12022-08-30 03:03:49 -040039 build-image-strategy:
Mohammed Nasera4e52902022-08-30 00:20:05 -040040 runs-on: ubuntu-latest
41 steps:
42 - uses: actions/checkout@v3.0.2
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040043 - id: set-strategy
Mohammed Naser81d183d2022-08-30 03:14:11 -040044 run: echo "::set-output name=strategy::$(./ci/build-image-strategy build)"
Mohammed Nasera4e52902022-08-30 00:20:05 -040045 outputs:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040046 strategy: ${{ steps.set-strategy.outputs.strategy }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040047
48 build-openstack-images:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040049 if: needs.build-image-strategy.outputs.strategy != '{}'
Mohammed Nasera4e52902022-08-30 00:20:05 -040050 runs-on: ubuntu-latest
Mohammed Naser4762fb92022-08-30 00:42:11 -040051 needs:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040052 - build-image-strategy
53 strategy: ${{ fromJSON(needs.build-image-strategy.outputs.strategy) }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040054 steps:
Mohammed Naser82e50812022-08-30 00:58:10 -040055 - 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 Nasera4e52902022-08-30 00:20:05 -040058 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
Mohammed Naser82e50812022-08-30 00:58:10 -040059 - uses: docker/login-action@v2.0.0
Mohammed Nasera4e52902022-08-30 00:20:05 -040060 with:
61 registry: quay.io
62 username: ${{ secrets.QUAY_USERNAME }}
63 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
Mohammed Naser82e50812022-08-30 00:58:10 -040064 - uses: docker/build-push-action@v3.1.1
Mohammed Nasera4e52902022-08-30 00:20:05 -040065 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