Skip to content

Commit 87eddb4

Browse files
committed
Build and push SNAPSHOT operator images
Tags it with the maven version and latest Signed-off-by: Robert Young <[email protected]>
1 parent 0644444 commit 87eddb4

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

.github/workflows/docker.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
jobs:
2323
build:
2424
runs-on: ubuntu-latest
25-
if: ${{ vars.REGISTRY_SERVER != '' && vars.REGISTRY_USERNAME != '' && vars.REGISTRY_DESTINATION != '' }}
25+
if: ${{ vars.REGISTRY_SERVER != '' && vars.REGISTRY_USERNAME != '' && vars.REGISTRY_ORGANISATION != '' && vars.PROXY_IMAGE_NAME != '' && vars.OPERATOR_IMAGE_NAME != '' }}
2626
steps:
2727
- name: Checkout
2828
uses: actions/checkout@v4
@@ -35,21 +35,35 @@ jobs:
3535
with:
3636
distribution: 'temurin'
3737
java-version: '17'
38-
- name: Set Release version env variable
38+
- name: Set env variables
3939
run: |
4040
echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
41+
echo "PROXY_IMAGE=${{ vars.REGISTRY_SERVER }}/${{ vars.REGISTRY_ORGANISATION }}/${{ vars.PROXY_IMAGE_NAME }}" >> $GITHUB_ENV
42+
echo "OPERATOR_IMAGE=${{ vars.REGISTRY_SERVER }}/${{ vars.REGISTRY_ORGANISATION }}/${{ vars.OPERATOR_IMAGE_NAME }}" >> $GITHUB_ENV
4143
- name: Login to container registry
4244
uses: docker/login-action@v3
4345
with:
4446
registry: ${{ vars.REGISTRY_SERVER }}
4547
username: ${{ vars.REGISTRY_USERNAME }}
4648
password: ${{ secrets.REGISTRY_TOKEN }}
47-
- name: Build
49+
- name: Build and push Proxy image
4850
uses: docker/build-push-action@v6
4951
with:
5052
context: .
5153
platforms: linux/amd64,linux/arm64
5254
push: true
5355
build-args: |
5456
KROXYLICIOUS_VERSION=${{ env.RELEASE_VERSION }}
55-
tags: ${{ vars.REGISTRY_DESTINATION }}:${{ env.RELEASE_VERSION }}
57+
tags: ${{ env.PROXY_IMAGE }}:${{ env.RELEASE_VERSION }}
58+
- name: Maven build operator code
59+
run: |
60+
mvn package --projects :kroxylicious-operator --also-make -DskipTests -B
61+
- name: Build and maybe push Operator image
62+
uses: docker/build-push-action@v6
63+
with:
64+
context: ./kroxylicious-operator/
65+
platforms: linux/amd64,linux/arm64
66+
push: ${{ endsWith(env.RELEASE_VERSION, 'SNAPSHOT') }}
67+
build-args: |
68+
KROXYLICIOUS_VERSION=${{ env.RELEASE_VERSION }}
69+
tags: ${{ env.OPERATOR_IMAGE }}:${{ env.RELEASE_VERSION }},${{ env.OPERATOR_IMAGE }}:latest

DEV_GUIDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,10 @@ To enable the docker workflow, you need to configure three repository [variables
437437
and one repository [secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).
438438
439439
* `REGISTRY_SERVER` variable - the server of the container registry service e.g. `quay.io` or `docker.io`
440+
* `REGISTRY_ORGANISATION` variable - the organization of the container registry service e.g. `kroxylicious` or `yourusername`
441+
* `PROXY_IMAGE_NAME` variable - the image name e.g. `kroxylicious`
442+
* `OPERATOR_IMAGE_NAME` variable - the image name e.g. `operator`
440443
* `REGISTRY_USERNAME` variable - your username on the service (or username of your robot account)
441-
* `REGISTRY_DESTINATION` variable - the push destination (without tag portion) e.g. `quay.io/<my org>/kroxylicious`
442-
443444
* `REGISTRY_TOKEN` secret - the access token that corresponds to `REGISTRY_USERNAME`
444445
445446
The workflow will push the container image to `${REGISTRY_DESTINATION}` so ensure that the `${REGISTRY_USERNAME}` user has sufficient write privileges.

0 commit comments

Comments
 (0)