blob: 7034c292c1fbde5086ecaa936f6fe288adae6e9f [file] [log] [blame]
Mohammed Nasera4e52902022-08-30 00:20:05 -04001name: test
2on:
3 pull_request: {}
4 push:
5 branches:
6 - main
7
8jobs:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -04009 build-image-strategy:
Mohammed Nasera4e52902022-08-30 00:20:05 -040010 runs-on: ubuntu-latest
11 steps:
12 - uses: actions/checkout@v3.0.2
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040013 - id: set-strategy
14 run: echo "::set-output name=strategy::$(./ci/build-image-strategy)"
Mohammed Nasera4e52902022-08-30 00:20:05 -040015 outputs:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040016 strategy: ${{ steps.set-strategy.outputs.strategy }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040017
18 build-openstack-images:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040019 if: needs.build-image-strategy.outputs.strategy != '{}'
Mohammed Nasera4e52902022-08-30 00:20:05 -040020 runs-on: ubuntu-latest
Mohammed Naser4762fb92022-08-30 00:42:11 -040021 needs:
Mohammed Naserbd5eaa12022-08-30 03:03:49 -040022 - build-image-strategy
23 strategy: ${{ fromJSON(needs.build-image-strategy.outputs.strategy) }}
Mohammed Nasera4e52902022-08-30 00:20:05 -040024 steps:
Mohammed Naser82e50812022-08-30 00:58:10 -040025 - uses: actions/checkout@v3.0.2
26 - uses: docker/setup-qemu-action@v2.0.0
27 - uses: docker/setup-buildx-action@v2.0.0
Mohammed Nasera4e52902022-08-30 00:20:05 -040028 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
Mohammed Naser82e50812022-08-30 00:58:10 -040029 - uses: docker/login-action@v2.0.0
Mohammed Nasera4e52902022-08-30 00:20:05 -040030 with:
31 registry: quay.io
32 username: ${{ secrets.QUAY_USERNAME }}
33 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
Mohammed Naser82e50812022-08-30 00:58:10 -040034 - uses: docker/build-push-action@v3.1.1
Mohammed Nasera4e52902022-08-30 00:20:05 -040035 with:
36 context: images/openstack
37 cache-from: type=gha,scope=${{ matrix.project }}-${{ matrix.release }}
38 cache-to: type=gha,mode=max,scope=${{ matrix.project }}-${{ matrix.release }}
39 platforms: ${{ env.PLATFORMS }}
40 push: true
41 build-args: |
42 RELEASE=${{ matrix.release }}
43 PROJECT=${{ matrix.project }}
44 PROJECT_REF=${{ env.PROJECT_REF }}
45 PROFILES=${{ env.PROFILES }}
46 DIST_PACKAGES=${{ env.DIST_PACKAGES }}
47 PIP_PACKAGES=${{ env.PIP_PACKAGES }}
48 tags: |
49 quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }}
50
51 # TODO(mnaser): Molecule