diff --git a/.github/workflows/publish-snapshot-docs-to-website.yaml b/.github/workflows/publish-snapshot-docs-to-website.yaml index 60e9e19d12..d4095b60ed 100644 --- a/.github/workflows/publish-snapshot-docs-to-website.yaml +++ b/.github/workflows/publish-snapshot-docs-to-website.yaml @@ -58,8 +58,10 @@ jobs: path: kroxylicious ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.ref_name }} + # - name: Setup Java + # uses: kroxylicious/kroxylicious/.github/actions/common/setup-java@main - name: Setup Java - uses: ./.github/actions/common/setup-java + uses: ./kroxylicious/.github/actions/common/setup-java - name: Build and install BOM run: mvn clean install -pl :kroxylicious-bom diff --git a/.github/workflows/run-system-tests.yml b/.github/workflows/run-system-tests.yml new file mode 100644 index 0000000000..f7e3c10bc3 --- /dev/null +++ b/.github/workflows/run-system-tests.yml @@ -0,0 +1,155 @@ +# +# 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: System Tests + +on: + workflow_dispatch: + inputs: + kafkaClient: + description: "Kafka client to be used" + default: "strimzi_test_client" + required: false + type: string + groups: + description: "Groups to be included in test run" + required: false + type: string + excludedGroups: + description: "Groups to be excluded from test run" + required: false + type: string + workflow_call: + inputs: + kafkaClient: + description: "Kafka client to be used" + default: "strimzi_test_client" + required: false + type: string + groups: + description: "Groups to be included in test run" + required: false + type: string + excludedGroups: + description: "Groups to be excluded from test run" + required: false + type: string + +jobs: + discover_system_test_chunks: + runs-on: ubuntu-latest + outputs: + test_chunks: ${{ steps.discover.outputs.test_chunks }} + steps: + - name: 'Check out repository' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: 'Discover STs' + working-directory: kroxylicious-systemtests + id: discover + run: | + TEST_CHUNKS="[$(find . -type f -name "*ST.java" -exec basename {} .java \; | tr ' ' , | sed 's/.*/"&"/' | sed -z 's/\n/,/g;s/,$/\n/')]" + echo "test_chunks=$TEST_CHUNKS" >> $GITHUB_OUTPUT + + run_system_tests: + needs: discover_system_test_chunks + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + tests: ${{ fromJson(needs.discover_system_test_chunks.outputs.test_chunks) }} + + steps: + - name: Log tests to run + run: echo "Running tests on classes '${{ matrix.tests }}'" + - name: 'Check out repository' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Set up QEMU + uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 + - name: Setup Java + uses: ./.github/actions/common/setup-java + - name: Setup Minikube + uses: ./.github/actions/common/setup-minikube + - name: 'Set up Docker Buildx' + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f + - name: 'Cache Maven packages' + uses: ./.github/actions/common/cache-maven-packages + - name: 'Build Kroxylicious Operator/Operand Container Images & Operator Zip' + run: | + mvn --quiet --batch-mode --activate-profiles dist --also-make --projects :kroxylicious-app,:kroxylicious-operator,:kroxylicious-operator-dist -Dquick package + - name: 'Load Kroxylicious Operand Docker Image in Minikube' + run: | + minikube image load kroxylicious-app/target/kroxylicious-proxy.img.tar.gz + minikube image load kroxylicious-operator/target/kroxylicious-operator.img.tar.gz + + # https://github.com/kubernetes/minikube/issues/21393 - minikube image load doesn't fail if the load fails. + KROXYLICIOUS_PROXY_IMAGE="$(mvn --quiet --projects kroxylicious-app --activate-profiles dist org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=io.kroxylicious.proxy.image.name -DforceStdout)" + KROXYLICIOUS_OPERATOR_IMAGE="$(mvn --quiet --projects kroxylicious-operator --activate-profiles dist org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=io.kroxylicious.operator.image.name -DforceStdout)" + KROXYLICIOUS_VERSION="$(mvn --quiet org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=project.version -DforceStdout)" + minikube image tag ${KROXYLICIOUS_PROXY_IMAGE} quay.io/kroxylicious/kroxylicious:${KROXYLICIOUS_VERSION} + minikube image ls | grep --fixed-strings quay.io/kroxylicious/kroxylicious:${KROXYLICIOUS_VERSION} + minikube image ls | grep --fixed-strings ${KROXYLICIOUS_OPERATOR_IMAGE} + + - name: 'Run system tests' + timeout-minutes: 90 + env: + KAFKA_CLIENT: ${{ inputs.kafkaClient }} + GROUPS_OPT: ${{ inputs.groups != '' && format('-Dgroups={0}', inputs.groups) || '' }} + TESTS_OPT: ${{ matrix.tests != '' && format('-Dtest={0}', matrix.tests) || '' }} + EXCLUDED_GROUPS_OPT: ${{ inputs.excludedGroups != '' && format('-DexcludedGroups={0}', inputs.excludedGroups) || '' }} + run: | + mvn --quiet --batch-mode verify --activate-profiles systemtest -Pdist -DskipDocs=true $EXCLUDED_GROUPS_OPT $GROUPS_OPT $TESTS_OPT + + - name: Archive JUnit test results + if: ${{ always() }} + uses: actions/upload-artifact@v5 + with: + name: junit-results-${{ matrix.tests }}-${{ inputs.kafkaClient }} + path: kroxylicious-systemtests/target/surefire-reports/**/TEST-*.xml + + - name: Archive systemtest logs + if: ${{ failure() }} + uses: actions/upload-artifact@v5 + with: + name: systemtest-logs-${{ matrix.tests }}-${{ inputs.kafkaClient }} + path: kroxylicious-systemtests/target/logs + + system_tests_proxy: + runs-on: ubuntu-latest + needs: run_system_tests + if: always() + permissions: + actions: read + steps: + - name: 'Check all matrix builds' + env: + GH_TOKEN: ${{ github.token }} + run: | + FAILED_JSON=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs \ + --jq '.jobs[] | select(.conclusion=="failure") | {name: .name, url: .html_url}') + if [ -z "$FAILED_JSON" ]; then + echo "All jobs passed!" >> $GITHUB_STEP_SUMMARY + echo "No failures detected." + exit 0 + fi + echo "Failed Matrix Jobs" >> $GITHUB_STEP_SUMMARY + echo "The following instances failed:" + echo "$FAILED_JSON" | jq -r '"* [\(.name)](\(.url))"' >> $GITHUB_STEP_SUMMARY + echo "$FAILED_JSON" | jq -r '"\(.name): \(.url)"' + exit 1 diff --git a/.github/workflows/system-tests-merge.yaml b/.github/workflows/system-tests-merge.yaml new file mode 100644 index 0000000000..2cfcb84d3f --- /dev/null +++ b/.github/workflows/system-tests-merge.yaml @@ -0,0 +1,134 @@ +# +# 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: System Tests for Main branch + +on: + push: + paths-ignore: + - '**/**.md' + - '**/**.txt' + - '.github/**' + - '!.github/workflows/system-tests-merge.yaml' + - '!.github/workflows/run-system-tests.yaml' + - '!.github/actions/**' + - 'kroxylicious-docs**/**' + - 'kroxylicious-integration-test**/**' + - 'kroxylicious-*benchmarks/**' + branches: + - "main" + workflow_dispatch: + +jobs: + run_external_kafka_client_system_tests: + uses: ./.github/workflows/run-system-tests.yml + with: + groups: 'externalKafkaClient,operator' + discover_system_test_clients: + runs-on: ubuntu-latest + outputs: + test_clients: ${{ steps.discover.outputs.test_clients }} + steps: + - name: 'Check out repository' + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: 'Discover STs' + working-directory: kroxylicious-systemtests + id: discover + run: | + TEST_CLIENTS="['strimzi_test_client', 'python_test_client', 'kaf', 'kcat']" + echo "test_clients=$TEST_CLIENTS" >> $GITHUB_OUTPUT + + run_system_tests: + needs: discover_system_test_clients + uses: ./.github/workflows/run-system-tests.yml + with: + kafkaClient: ${{ matrix.tests }} + excludedGroups: 'externalKafkaClient,operator' + strategy: + fail-fast: false + matrix: + tests: ${{ fromJson(needs.discover_system_test_clients.outputs.test_clients) }} + +# - name: Set up QEMU +# uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 +# - name: Setup Java +# uses: ./.github/actions/common/setup-java +# - name: Setup Minikube +# uses: ./.github/actions/common/setup-minikube +# - name: 'Set up Docker Buildx' +# uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f +# - name: 'Cache Maven packages' +# uses: ./.github/actions/common/cache-maven-packages +# - name: 'Build Kroxylicious Operator/Operand Container Images & Operator Zip' +# run: | +# mvn --quiet --batch-mode --activate-profiles dist --also-make --projects :kroxylicious-app,:kroxylicious-operator,:kroxylicious-operator-dist -Dquick package +# - name: 'Load Kroxylicious Operand Docker Image in Minikube' +# run: | +# minikube image load kroxylicious-app/target/kroxylicious-proxy.img.tar.gz +# minikube image load kroxylicious-operator/target/kroxylicious-operator.img.tar.gz +# +# # https://github.com/kubernetes/minikube/issues/21393 - minikube image load doesn't fail if the load fails. +# KROXYLICIOUS_PROXY_IMAGE="$(mvn --quiet --projects kroxylicious-app --activate-profiles dist org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=io.kroxylicious.proxy.image.name -DforceStdout)" +# KROXYLICIOUS_OPERATOR_IMAGE="$(mvn --quiet --projects kroxylicious-operator --activate-profiles dist org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=io.kroxylicious.operator.image.name -DforceStdout)" +# KROXYLICIOUS_VERSION="$(mvn --quiet org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=project.version -DforceStdout)" +# minikube image tag ${KROXYLICIOUS_PROXY_IMAGE} quay.io/kroxylicious/kroxylicious:${KROXYLICIOUS_VERSION} +# minikube image ls | grep --fixed-strings quay.io/kroxylicious/kroxylicious:${KROXYLICIOUS_VERSION} +# minikube image ls | grep --fixed-strings ${KROXYLICIOUS_OPERATOR_IMAGE} +# +# - name: 'Run system tests' +# timeout-minutes: 90 +# run: | +# mvn --quiet --batch-mode verify --activate-profiles systemtest -Pdist -DskipDocs=true -Dtest="${{ matrix.tests }}" +# +# - name: Archive JUnit test results +# if: ${{ always() }} +# uses: actions/upload-artifact@v5 +# with: +# name: junit-results-${{ matrix.tests }} +# path: kroxylicious-systemtests/target/surefire-reports/**/TEST-*.xml +# +# - name: Archive systemtest logs +# if: ${{ failure() }} +# uses: actions/upload-artifact@v5 +# with: +# name: systemtest-logs-${{ matrix.tests }} +# path: kroxylicious-systemtests/target/logs + + system_tests_proxy: + runs-on: ubuntu-latest + needs: run_system_tests + if: always() + permissions: + actions: read + steps: + - name: 'Check all matrix builds' + env: + GH_TOKEN: ${{ github.token }} + run: | + FAILED_JSON=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs \ + --jq '.jobs[] | select(.conclusion=="failure") | {name: .name, url: .html_url}') + if [ -z "$FAILED_JSON" ]; then + echo "All jobs passed!" >> $GITHUB_STEP_SUMMARY + echo "No failures detected." + exit 0 + fi + echo "Failed Matrix Jobs" >> $GITHUB_STEP_SUMMARY + echo "The following instances failed:" + echo "$FAILED_JSON" | jq -r '"* [\(.name)](\(.url))"' >> $GITHUB_STEP_SUMMARY + echo "$FAILED_JSON" | jq -r '"\(.name): \(.url)"' + exit 1 diff --git a/.github/workflows/system-tests-pr.yaml b/.github/workflows/system-tests-pr.yaml index 8cfc95bc48..14ab28664e 100644 --- a/.github/workflows/system-tests-pr.yaml +++ b/.github/workflows/system-tests-pr.yaml @@ -38,102 +38,7 @@ concurrency: cancel-in-progress: true jobs: - discover_system_test_chunks: - runs-on: ubuntu-latest - outputs: - test_chunks: ${{ steps.discover.outputs.test_chunks }} - steps: - - name: 'Check out repository' - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: 'Discover STs' - working-directory: kroxylicious-systemtests - id: discover - run: | - TEST_CHUNKS="[$(find . -type f -name "*ST.java" -exec basename {} .java \; | tr ' ' , | sed 's/.*/"&"/' | sed -z 's/\n/,/g;s/,$/\n/')]" - echo "test_chunks=$TEST_CHUNKS" >> $GITHUB_OUTPUT - run_system_tests: - needs: discover_system_test_chunks - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - tests: ${{ fromJson(needs.discover_system_test_chunks.outputs.test_chunks) }} - - steps: - - name: Log tests to run - run: echo "Running tests on classes '${{ matrix.tests }}'" - - name: 'Check out repository' - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - name: Set up QEMU - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 - - name: Setup Java - uses: ./.github/actions/common/setup-java - - name: Setup Minikube - uses: ./.github/actions/common/setup-minikube - - name: 'Set up Docker Buildx' - uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f - - name: 'Cache Maven packages' - uses: ./.github/actions/common/cache-maven-packages - - name: 'Build Kroxylicious Operator/Operand Container Images & Operator Zip' - run: | - mvn --quiet --batch-mode --activate-profiles dist --also-make --projects :kroxylicious-app,:kroxylicious-operator,:kroxylicious-operator-dist -Dquick package - - name: 'Load Kroxylicious Operand Docker Image in Minikube' - run: | - minikube image load kroxylicious-app/target/kroxylicious-proxy.img.tar.gz - minikube image load kroxylicious-operator/target/kroxylicious-operator.img.tar.gz - - # https://github.com/kubernetes/minikube/issues/21393 - minikube image load doesn't fail if the load fails. - KROXYLICIOUS_PROXY_IMAGE="$(mvn --quiet --projects kroxylicious-app --activate-profiles dist org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=io.kroxylicious.proxy.image.name -DforceStdout)" - KROXYLICIOUS_OPERATOR_IMAGE="$(mvn --quiet --projects kroxylicious-operator --activate-profiles dist org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=io.kroxylicious.operator.image.name -DforceStdout)" - KROXYLICIOUS_VERSION="$(mvn --quiet org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate -Dexpression=project.version -DforceStdout)" - minikube image tag ${KROXYLICIOUS_PROXY_IMAGE} quay.io/kroxylicious/kroxylicious:${KROXYLICIOUS_VERSION} - minikube image ls | grep --fixed-strings quay.io/kroxylicious/kroxylicious:${KROXYLICIOUS_VERSION} - minikube image ls | grep --fixed-strings ${KROXYLICIOUS_OPERATOR_IMAGE} - - - name: 'Run system tests' - timeout-minutes: 90 - run: | - mvn --quiet --batch-mode verify --activate-profiles systemtest -Pdist -DskipDocs=true -Dtest="${{ matrix.tests }}" - - - name: Archive JUnit test results - if: ${{ always() }} - uses: actions/upload-artifact@v5 - with: - name: junit-results-${{ matrix.tests }} - path: kroxylicious-systemtests/target/surefire-reports/**/TEST-*.xml - - - name: Archive systemtest logs - if: ${{ failure() }} - uses: actions/upload-artifact@v5 - with: - name: systemtest-logs-${{ matrix.tests }} - path: kroxylicious-systemtests/target/logs - - system_tests_proxy: - runs-on: ubuntu-latest - needs: run_system_tests - if: always() - permissions: - actions: read - steps: - - name: 'Check all matrix builds' - env: - GH_TOKEN: ${{ github.token }} - run: | - FAILED_JSON=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs \ - --jq '.jobs[] | select(.conclusion=="failure") | {name: .name, url: .html_url}') - if [ -z "$FAILED_JSON" ]; then - echo "All jobs passed!" >> $GITHUB_STEP_SUMMARY - echo "No failures detected." - exit 0 - fi - echo "Failed Matrix Jobs" >> $GITHUB_STEP_SUMMARY - echo "The following instances failed:" - echo "$FAILED_JSON" | jq -r '"* [\(.name)](\(.url))"' >> $GITHUB_STEP_SUMMARY - echo "$FAILED_JSON" | jq -r '"\(.name): \(.url)"' - exit 1 + uses: ./.github/workflows/run-system-tests.yml + with: + kafkaClient: 'strimzi_test_client' diff --git a/kroxylicious-openmessaging-benchmarks/Containerfile b/kroxylicious-openmessaging-benchmarks/Containerfile index 8c26295de5..28a8c15e3b 100644 --- a/kroxylicious-openmessaging-benchmarks/Containerfile +++ b/kroxylicious-openmessaging-benchmarks/Containerfile @@ -29,7 +29,7 @@ RUN mvn clean package -DskipTests && \ tar -xzf /build/package/target/openmessaging-benchmark-*-bin.tar.gz --strip-components=1 -C /opt/benchmark # ---------- Stage 2: runtime ---------- -FROM registry.access.redhat.com/ubi9/openjdk-17-runtime:1.24-2.1770236042 +FROM registry.access.redhat.com/ubi9/openjdk-17-runtime:1.24-2.1771324987 USER root COPY --from=builder --chown=185:0 /opt/benchmark /opt/benchmark