Skip to content

Commit 2e4eafb

Browse files
authored
Build operand image in Minikube as part of CI (kroxylicious#1983)
* Build operand image in Minikube as part of CI Signed-off-by: Keith Wall <[email protected]> * Avoid concurrent maven workflow runs for the same pr (or branch). from: https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre Signed-off-by: Keith Wall <[email protected]> --------- Signed-off-by: Keith Wall <[email protected]>
1 parent 2cb78a0 commit 2e4eafb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/maven.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ on:
2222
pull_request:
2323
types: [ opened, synchronize, reopened ]
2424

25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
27+
cancel-in-progress: true
28+
2529
jobs:
2630
build:
2731
runs-on: ubuntu-latest
@@ -66,6 +70,15 @@ jobs:
6670
path: ~/.m2
6771
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
6872
restore-keys: ${{ runner.os }}-m2
73+
- name: 'Build Kroxylicious Image on Minikube'
74+
run: |
75+
GIT_HASH="$(git rev-parse HEAD)"
76+
IMAGE_TAG="dev-git-${GIT_HASH}"
77+
KROXYLICIOUS_VERSION="$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)"
78+
KROXYLICIOUS_IMAGE="quay.io/kroxylicious/kroxylicious:${IMAGE_TAG}"
79+
minikube image build . -f Dockerfile -t ${KROXYLICIOUS_IMAGE} --build-opt=build-arg=KROXYLICIOUS_VERSION="${KROXYLICIOUS_VERSION}"
80+
# KROXYLICIOUS_IMAGE env var is used by the Operator ITs
81+
echo "KROXYLICIOUS_IMAGE=${KROXYLICIOUS_IMAGE}" >> $GITHUB_ENV
6982
- name: 'Build Kroxylicious maven project'
7083
if: github.ref_name != 'main' || env.SONAR_TOKEN_SET != 'true'
7184
env:
@@ -75,7 +88,7 @@ jobs:
7588
KROXYLICIOUS_KMS_FORTANIX_API_ENDPOINT: ${{ vars.KROXYLICIOUS_KMS_FORTANIX_API_ENDPOINT }}
7689
KROXYLICIOUS_KMS_FORTANIX_ADMIN_API_KEY: ${{ secrets.KROXYLICIOUS_KMS_FORTANIX_ADMIN_API_KEY }}
7790
KROXYLICIOUS_KMS_FORTANIX_API_KEY: ${{ secrets.KROXYLICIOUS_KMS_FORTANIX_API_KEY }}
78-
run: mvn -B clean verify -Pci -Djapicmp.skip=${REFERENCE_RELEASE_UNPUBLISHED}
91+
run: mvn -B verify -Pci -Djapicmp.skip=${REFERENCE_RELEASE_UNPUBLISHED}
7992
- name: 'Build Kroxylicious maven project on main with Sonar'
8093
if: github.event_name == 'push' && github.ref_name == 'main' && env.SONAR_TOKEN_SET == 'true'
8194
env:
@@ -84,7 +97,7 @@ jobs:
8497
KROXYLICIOUS_KMS_FORTANIX_API_ENDPOINT: ${{ vars.KROXYLICIOUS_KMS_FORTANIX_API_ENDPOINT }}
8598
KROXYLICIOUS_KMS_FORTANIX_ADMIN_API_KEY: ${{ secrets.KROXYLICIOUS_KMS_FORTANIX_ADMIN_API_KEY }}
8699
KROXYLICIOUS_KMS_FORTANIX_API_KEY: ${{ secrets.KROXYLICIOUS_KMS_FORTANIX_API_KEY }}
87-
run: mvn -B clean verify -Pci -Djapicmp.skip=${REFERENCE_RELEASE_UNPUBLISHED} org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar -Dsonar.projectKey=kroxylicious_kroxylicious
100+
run: mvn -B verify -Pci -Djapicmp.skip=${REFERENCE_RELEASE_UNPUBLISHED} org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar -Dsonar.projectKey=kroxylicious_kroxylicious
88101
- name: Save PR number to file
89102
if: github.event_name == 'pull_request' && ${{ matrix.os }} == 'ubuntu-latest'
90103
run: echo ${{ github.event.number }} > PR_NUMBER.txt

0 commit comments

Comments
 (0)