|
7 | 7 |
|
8 | 8 | env: |
9 | 9 | DOCKER_FILE_PATH: Dockerfile |
| 10 | + UBI_DOCKER_FILE_PATH: Dockerfile.ubi |
10 | 11 | KUBERNETES_VERSION: "1.19.0" |
11 | 12 | KIND_VERSION: "0.17.0" |
12 | 13 | REGISTRY: ghcr.io |
@@ -82,12 +83,14 @@ jobs: |
82 | 83 | - name: Test |
83 | 84 | run: make test |
84 | 85 |
|
85 | | - - name: Generate Tag |
| 86 | + - name: Generate Tags |
86 | 87 | id: generate_tag |
87 | 88 | run: | |
88 | 89 | sha=${{ github.event.pull_request.head.sha }} |
89 | 90 | tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}" |
| 91 | + ubi_tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-UBI-${sha:0:8}" |
90 | 92 | echo "GIT_TAG=$(echo ${tag})" >> $GITHUB_OUTPUT |
| 93 | + echo "GIT_UBI_TAG=$(echo ${ubi_tag})" >> $GITHUB_OUTPUT |
91 | 94 |
|
92 | 95 | - name: Set up QEMU |
93 | 96 | uses: docker/setup-qemu-action@v2 |
@@ -122,6 +125,25 @@ jobs: |
122 | 125 | org.opencontainers.image.created=${{ steps.prep.outputs.created }} |
123 | 126 | org.opencontainers.image.revision=${{ github.sha }} |
124 | 127 |
|
| 128 | + - name: Build and Push Docker UBI Image to Docker registry |
| 129 | + uses: docker/build-push-action@v4 |
| 130 | + with: |
| 131 | + context: . |
| 132 | + file: ${{ env.DOCKER_UBI_FILE_PATH }} |
| 133 | + pull: true |
| 134 | + push: true |
| 135 | + build-args: | |
| 136 | + BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }} |
| 137 | + BUILDER_IMAGE=${{ env.DOCKER_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }} |
| 138 | + cache-to: type=inline |
| 139 | + platforms: linux/amd64,linux/arm64 |
| 140 | + tags: | |
| 141 | + ${{ env.DOCKER_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_UBI_TAG }} |
| 142 | + labels: | |
| 143 | + org.opencontainers.image.source=${{ github.event.repository.clone_url }} |
| 144 | + org.opencontainers.image.created=${{ steps.prep.outputs.created }} |
| 145 | + org.opencontainers.image.revision=${{ github.sha }} |
| 146 | +
|
125 | 147 | - name: Login to ghcr registry |
126 | 148 | uses: docker/login-action@v2 |
127 | 149 | with: |
@@ -150,13 +172,32 @@ jobs: |
150 | 172 | org.opencontainers.image.created=${{ steps.prep.outputs.created }} |
151 | 173 | org.opencontainers.image.revision=${{ github.sha }} |
152 | 174 |
|
| 175 | + - name: Build and Push Docker UBI Image to ghcr registry |
| 176 | + uses: docker/build-push-action@v4 |
| 177 | + with: |
| 178 | + context: . |
| 179 | + file: ${{ env.DOCKER_UBI_FILE_PATH }} |
| 180 | + pull: true |
| 181 | + push: true |
| 182 | + build-args: | |
| 183 | + BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }} |
| 184 | + BUILDER_IMAGE=ghcr.io/${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }} |
| 185 | + cache-to: type=inline |
| 186 | + platforms: linux/amd64,linux/arm64 |
| 187 | + tags: | |
| 188 | + ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_UBI_TAG }} |
| 189 | + labels: | |
| 190 | + org.opencontainers.image.source=${{ github.event.repository.clone_url }} |
| 191 | + org.opencontainers.image.created=${{ steps.prep.outputs.created }} |
| 192 | + org.opencontainers.image.revision=${{ github.sha }} |
| 193 | +
|
153 | 194 | - name: Comment on PR |
154 | 195 | uses: mshick/add-pr-comment@v2 |
155 | 196 | if: always() |
156 | 197 | env: |
157 | 198 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
158 | 199 | with: |
159 | | - message-success: '@${{ github.actor }} Image is available for testing. `docker pull ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`' |
| 200 | + message-success: '@${{ github.actor }} Images are available for testing. `docker pull ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }}`\n`docker pull ${{ env.GHCR_IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_UBI_TAG }}`' |
160 | 201 | message-failure: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!' |
161 | 202 | allow-repeats: true |
162 | 203 |
|
|
0 commit comments