blob: bef4775c934a5a1a96b39293280b073e585019da [file] [log] [blame]
Mohammed Nasera4e52902022-08-30 00:20:05 -04001name: test
2on:
3 pull_request: {}
4 push:
5 branches:
6 - main
7
8jobs:
9 build-matrix:
10 runs-on: ubuntu-latest
11 steps:
12 - uses: actions/checkout@v3.0.2
13 - id: set-matrix
14 run: |
15 echo '::set-output name=release::$(./ci/build-release-matrix)'
16 echo '::set-output name=project::$(./ci/build-project-matrix)'
17 outputs:
18 release_matrix: ${{ steps.set-matrix.outputs.release }}
19 project_matrix: ${{ steps.set-matrix.outputs.project }}
20
21 build-openstack-images:
22 runs-on: ubuntu-latest
23 strategy:
24 fail-fast: false
25 matrix:
26 project: ${{ fromJson(needs.build-matrix.outputs.project_matrix) }}
27 release: ${{ fromJson(needs.build-matrix.outputs.release_matrix) }}
28 steps:
29 - uses: actions/checkout@v3
30 - uses: docker/setup-qemu-action@v2
31 - uses: docker/setup-buildx-action@v2
32 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
33 - uses: docker/login-action@v2
34 with:
35 registry: quay.io
36 username: ${{ secrets.QUAY_USERNAME }}
37 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
38 - uses: docker/build-push-action@v3
39 with:
40 context: images/openstack
41 cache-from: type=gha,scope=${{ matrix.project }}-${{ matrix.release }}
42 cache-to: type=gha,mode=max,scope=${{ matrix.project }}-${{ matrix.release }}
43 platforms: ${{ env.PLATFORMS }}
44 push: true
45 build-args: |
46 RELEASE=${{ matrix.release }}
47 PROJECT=${{ matrix.project }}
48 PROJECT_REF=${{ env.PROJECT_REF }}
49 PROFILES=${{ env.PROFILES }}
50 DIST_PACKAGES=${{ env.DIST_PACKAGES }}
51 PIP_PACKAGES=${{ env.PIP_PACKAGES }}
52 tags: |
53 quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }}
54
55 # TODO(mnaser): Molecule
56
57 promote-openstack-images:
58 if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
59 needs:
60 - build-openstack-images
61 runs-on: ubuntu-latest
62 strategy:
63 fail-fast: false
64 matrix:
65 project: ${{ fromJson(needs.build-matrix.outputs.project_matrix) }}
66 release: ${{ fromJson(needs.build-matrix.outputs.release_matrix) }}
67 steps:
68 - run: ./ci/openstack-image-build-env ${{ matrix.project }} ${{ matrix.release }} >> $GITHUB_ENV
69 - uses: docker/login-action@v2
70 with:
71 registry: quay.io
72 username: ${{ secrets.QUAY_USERNAME }}
73 password: ${{ secrets.QUAY_ROBOT_TOKEN }}
74 - uses: akhilerm/tag-push-action@v2.0.0
75 with:
76 src: quay.io/vexxhost/${{ matrix.project }}:${{ env.PROJECT_REF }}
77 dst: quay.io/vexxhost/${{ matrix.project }}:${{ matrix.release }}