Skip to content

chore(deprecation): Replace use of deprecated org.testcontainers.cont… #237

chore(deprecation): Replace use of deprecated org.testcontainers.cont…

chore(deprecation): Replace use of deprecated org.testcontainers.cont… #237

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Build Kroxylicious Operator
on:
push:
branches: [ main, 'release/**' ]
pull_request:
types: [ opened, synchronize, reopened ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_operator:
runs-on: ubuntu-latest
steps:
- name: 'Test for Sonar secret'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
echo "SONAR_TOKEN_SET=$(test ${SONAR_TOKEN} && echo true)" >> $GITHUB_ENV
- name: 'Test for Slack secret'
env:
KROXYLICIOUS_SLACK_WEBHOOK: ${{ secrets.KROXYLICIOUS_SLACK_WEBHOOK }}
run: |
echo "SLACK_WEBHOOK_SET=$(test ${KROXYLICIOUS_SLACK_WEBHOOK} && echo true)" >> $GITHUB_ENV
- name: 'Check out repository'
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130
- name: 'Set up Java'
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
- name: Setup Minikube
uses: manusa/actions-setup-minikube@b589f2d61bf96695c546929c72b38563e856059d
with:
"minikube version": 'v1.35.0'
"kubernetes version": 'v1.32.0'
"github token": ${{ secrets.GITHUB_TOKEN }}
driver: docker
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
- name: 'Cache Maven packages'
uses: actions/cache@v5
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: 'Build Kroxylicious Operand Container Image'
run: |
GIT_HASH="$(git rev-parse HEAD)"
KROXYLICIOUS_VERSION="$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)"
KROXYLICIOUS_IMAGE=quay.io/kroxylicious/proxy:${KROXYLICIOUS_VERSION}-${GIT_HASH}
mvn --batch-mode --activate-profiles dist --also-make --projects :kroxylicious-app -DskipTests clean package -Dio.kroxylicious.proxy.image.name=${KROXYLICIOUS_IMAGE}
echo "KROXYLICIOUS_IMAGE=${KROXYLICIOUS_IMAGE}" >> "${GITHUB_ENV}"
- name: 'Load Kroxylicious Operand Docker Image in Minikube'
run: |
# https://github.com/kubernetes/minikube/issues/21393 - minikube image load doesn't fail if the load fails.
minikube image load kroxylicious-app/target/kroxylicious-proxy.img.tar.gz
minikube image ls | grep --fixed-strings ${KROXYLICIOUS_IMAGE}
- name: Cache SonarCloud packages
uses: actions/cache@v5
if: github.ref_name == 'main' && env.SONAR_TOKEN_SET == 'true'
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: 'Build & test Kroxylicious operator'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn -B install -Pci -Djapicmp.skip=true -pl ':kroxylicious-operator' -am
- name: 'SonarCloud scan on main for the Operator'
if: github.event_name == 'push' && github.ref_name == 'main' && env.SONAR_TOKEN_SET == 'true'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B verify -Pci -Djapicmp.skip=true org.sonarsource.scanner.maven:sonar-maven-plugin:5.5.0.6356:sonar -Dsonar.projectName='Kroxylicious Operator' -Dsonar.projectKey='kroxylicious_operator' -pl ':kroxylicious-operator,:kroxylicious-parent'
- name: Save PR number to file
if: github.event_name == 'pull_request'
run: echo ${{ github.event.number }} > PR_NUMBER.txt
- name: Archive PR number
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v6
with:
name: PR_NUMBER
path: PR_NUMBER.txt
- name: Slack Notification on Failure
if: failure() && env.SLACK_WEBHOOK_SET == 'true'
uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # v2
env:
SLACK_WEBHOOK: ${{ secrets.KROXYLICIOUS_SLACK_WEBHOOK }}
SLACK_COLOR: 'danger'
SLACK_TITLE: 'Failure Alert: ${{ github.repository }}'
SLACK_MESSAGE: 'The operator maven workflow failed on branch ${{ github.ref_name }}.'