From 941f43cf65aa8b5a5994a1b485cafe1cacb34754 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Wed, 31 Jul 2024 11:32:07 +0200 Subject: [PATCH] feat(ci): minikube usage --- .../actions/{e2e-build => build}/action.yml | 16 +- .github/actions/e2e-common/action.yml | 80 ------ .github/actions/e2e-common/exec-tests.sh | 166 ----------- .github/actions/e2e-install/action.yml | 96 ------- .github/actions/e2e-install/exec-tests.sh | 130 --------- .github/actions/e2e-knative/action.yml | 73 ----- .github/actions/e2e-knative/exec-tests.sh | 142 ---------- .github/actions/e2e-native/action.yml | 69 ----- .github/actions/e2e-native/exec-tests.sh | 135 --------- .github/actions/e2e-telemetry/action.yml | 76 ----- .github/actions/e2e-telemetry/exec-tests.sh | 145 ---------- .../action.yml | 40 ++- .../action.yml | 0 .github/actions/kamel-build-binary/action.yml | 56 ---- .../kamel-build-binary/build-binary.sh | 124 --------- .../actions/kamel-build-bundle/action.yaml | 101 ------- .../kamel-build-bundle/build-bundle-image.sh | 137 --------- .../kamel-build-bundle/build-image-catalog.sh | 94 ------- .../kamel-build-bundle/build-index-image.sh | 262 ------------------ .github/actions/kamel-build/action.yml | 82 ------ .../kamel-config-cluster-custom/action.yml | 131 --------- .../connect-cluster.sh | 144 ---------- .../kamel-config-cluster-kind/action.yml | 75 ----- .../extract-config.sh | 53 ---- .../actions/kamel-config-cluster/action.yaml | 198 ------------- .../kamel-config-cluster/change-context.sh | 53 ---- .../kamel-config-cluster/output-config.sh | 93 ------- .github/actions/kamel-prepare-env/action.yml | 120 -------- .github/workflows/build.yml | 2 +- .github/workflows/common.yml | 43 +-- .github/workflows/install.yml | 22 +- .github/workflows/knative.yml | 24 +- .github/workflows/native.yml | 24 +- .github/workflows/nightly-latest-runtime.yml | 20 +- .github/workflows/nightly-native-test.yml | 56 ---- .github/workflows/telemetry.yml | 23 +- e2e/install/helm/setup_test.go | 1 - 37 files changed, 163 insertions(+), 2943 deletions(-) rename .github/actions/{e2e-build => build}/action.yml (88%) delete mode 100644 .github/actions/e2e-common/action.yml delete mode 100755 .github/actions/e2e-common/exec-tests.sh delete mode 100644 .github/actions/e2e-install/action.yml delete mode 100755 .github/actions/e2e-install/exec-tests.sh delete mode 100644 .github/actions/e2e-knative/action.yml delete mode 100755 .github/actions/e2e-knative/exec-tests.sh delete mode 100644 .github/actions/e2e-native/action.yml delete mode 100755 .github/actions/e2e-native/exec-tests.sh delete mode 100644 .github/actions/e2e-telemetry/action.yml delete mode 100755 .github/actions/e2e-telemetry/exec-tests.sh rename .github/actions/{kamel-install-knative => infra-setting}/action.yml (50%) rename .github/actions/{kamel-install-otlp-collector => install-otlp-collector}/action.yml (100%) delete mode 100644 .github/actions/kamel-build-binary/action.yml delete mode 100755 .github/actions/kamel-build-binary/build-binary.sh delete mode 100644 .github/actions/kamel-build-bundle/action.yaml delete mode 100755 .github/actions/kamel-build-bundle/build-bundle-image.sh delete mode 100755 .github/actions/kamel-build-bundle/build-image-catalog.sh delete mode 100755 .github/actions/kamel-build-bundle/build-index-image.sh delete mode 100644 .github/actions/kamel-build/action.yml delete mode 100644 .github/actions/kamel-config-cluster-custom/action.yml delete mode 100755 .github/actions/kamel-config-cluster-custom/connect-cluster.sh delete mode 100644 .github/actions/kamel-config-cluster-kind/action.yml delete mode 100755 .github/actions/kamel-config-cluster-kind/extract-config.sh delete mode 100644 .github/actions/kamel-config-cluster/action.yaml delete mode 100755 .github/actions/kamel-config-cluster/change-context.sh delete mode 100755 .github/actions/kamel-config-cluster/output-config.sh delete mode 100644 .github/actions/kamel-prepare-env/action.yml delete mode 100644 .github/workflows/nightly-native-test.yml diff --git a/.github/actions/e2e-build/action.yml b/.github/actions/build/action.yml similarity index 88% rename from .github/actions/e2e-build/action.yml rename to .github/actions/build/action.yml index 5dda564d52..7b0918b95d 100644 --- a/.github/actions/e2e-build/action.yml +++ b/.github/actions/build/action.yml @@ -28,9 +28,19 @@ runs: steps: - - id: prepare-env - name: Prepare Test Environment - uses: ./.github/actions/kamel-prepare-env + - name: Set up JDK 17 + uses: actions/setup-java@v4 + if: ${{ env.ENV_PREPARED != 'true' }} + with: + java-version: '17' + distribution: 'temurin' + + - name: Set up Go + uses: actions/setup-go@v5 + if: ${{ env.KAMEL_PREPARE_ENV != 'true' }} + with: + go-version-file: 'go.mod' + check-latest: true - name: Test new branch shell: bash diff --git a/.github/actions/e2e-common/action.yml b/.github/actions/e2e-common/action.yml deleted file mode 100644 index 0a94678f16..0000000000 --- a/.github/actions/e2e-common/action.yml +++ /dev/null @@ -1,80 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: e2e-common -description: 'End-to-End tests for common use-cases' - -inputs: - cluster-config-data: - description: 'The configuration of the underlying cluster (if cluster-type is custom)' - required: false - cluster-kube-config-data: - description: 'Base16 encoded kube config - required for custom cluster type only' - required: false - with-custom-install: - description: 'Indicates whether the advanced common integration tests should be launched (default false)' - default: 'false' - required: false - smoke-test-only: - description: 'Only run a subset of tests' - default: 'false' - required: false - -runs: - using: "composite" - - steps: - - id: prepare-env - name: Prepare Test Environment - uses: ./.github/actions/kamel-prepare-env - - - id: config-cluster - name: Configure Platform - uses: ./.github/actions/kamel-config-cluster - with: - cluster-config-data: ${{ inputs.cluster-config-data }} - cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }} - - - id: build-kamel - name: Build Kamel - uses: ./.github/actions/kamel-build - with: - image-registry-push-host: ${{ steps.config-cluster.outputs.cluster-image-registry-push-host }} - image-registry-pull-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }} - image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }} - build-bundle: false - # Both can be empty and so catalog source will not be created - catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }} - catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }} - - - id: run-it - name: Run IT - shell: bash - run: | - ./.github/actions/e2e-common/exec-tests.sh \ - -b "${{ steps.config-cluster.outputs.cluster-catalog-source-name }}" \ - -c "${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}" \ - -g "${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}" \ - -i "${{ steps.config-cluster.outputs.cluster-image-namespace }}" \ - -l "${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}" \ - -n "${{ steps.build-kamel.outputs.build-binary-local-image-name }}" \ - -q "${{ env.CAMEL_K_LOG_LEVEL }}" \ - -s "${{steps.config-cluster.outputs.cluster-image-registry-insecure }}" \ - -v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \ - -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}" \ - -y "${{ inputs.smoke-test-only }}" \ - -z "${{ inputs.with-custom-install }}" diff --git a/.github/actions/e2e-common/exec-tests.sh b/.github/actions/e2e-common/exec-tests.sh deleted file mode 100755 index 8e6d45246b..0000000000 --- a/.github/actions/e2e-common/exec-tests.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Execute the common tests -# -#### - -set -e - -while getopts ":b:c:g:i:l:n:q:s:v:x:y:z:" opt; do - case "${opt}" in - b) - BUILD_CATALOG_SOURCE_NAME=${OPTARG} - ;; - c) - BUILD_CATALOG_SOURCE_NAMESPACE=${OPTARG} - ;; - g) - GLOBAL_OPERATOR_NAMESPACE=${OPTARG} - ;; - i) - IMAGE_NAMESPACE=${OPTARG} - ;; - l) - REGISTRY_PULL_HOST=${OPTARG} - ;; - n) - IMAGE_NAME=${OPTARG} - ;; - q) - LOG_LEVEL=${OPTARG} - ;; - s) - REGISTRY_INSECURE=${OPTARG} - ;; - v) - IMAGE_VERSION=${OPTARG} - ;; - x) - SAVE_FAILED_TEST_NS=${OPTARG} - ;; - y) - SMOKE_TEST_ONLY=${OPTARG} - ;; - z) - CUSTOM_INSTALL_TEST=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -z "${IMAGE_NAME}" ]; then - echo "Error: local-image-name not defined" - exit 1 -fi - -if [ -z "${IMAGE_VERSION}" ]; then - echo "Error: local-image-version not defined" - exit 1 -fi - -if [ -z "${IMAGE_NAMESPACE}" ]; then - echo "Error: image-namespace not defined" - exit 1 -fi - -if [ -z "${REGISTRY_PULL_HOST}" ]; then - echo "Error: image-registry-pull-host not defined" - exit 1 -fi - -if [ -z "${REGISTRY_INSECURE}" ]; then - echo "Error: image-registry-insecure not defined" - exit 1 -fi - -# Cluster environment -export CUSTOM_IMAGE=${IMAGE_NAME} -export CUSTOM_VERSION=${IMAGE_VERSION} - -# -# If bundle has been built and installed then use it -# -if [ -n "${BUILD_CATALOG_SOURCE_NAMESPACE}" ]; then - export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE_NAME} - export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${BUILD_CATALOG_SOURCE_NAMESPACE} - export KAMEL_INSTALL_OLM_CHANNEL="${NEW_XY_CHANNEL}" -fi - -export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST} -export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE} -export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION} - -# Will only have an effect if olm=false -# since, for OLM, the csv determines the policy -# (see kamel-build-bundle/build-bundle-image.sh) -export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always" - -export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}" -if [ "${LOG_LEVEL}" == "debug" ]; then - export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}" -fi -export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE} -export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION} -export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS} - -if [ -n "${GLOBAL_OPERATOR_NAMESPACE}" ]; then - export CAMEL_K_GLOBAL_OPERATOR_NS="${GLOBAL_OPERATOR_NAMESPACE}" -else - export CAMEL_K_GLOBAL_OPERATOR_NS="default" -fi - -export CAMEL_K_E2E_FAST_SETUP="true" - -# Then run all integration tests rather than ending on first failure -set -e -exit_code=0 -if [ "${SMOKE_TEST_ONLY}" == "true" ]; then - kubectl create ns camel-k - REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global - # Let's wait for the IntegrationPlatform to be ready before starting any operation - kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=45s - - DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-smoke || exit_code=1 -elif [ "${CUSTOM_INSTALL_TEST}" == "true" ]; then - make install-crds - - DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-advanced || exit_code=1 -else - kubectl create ns camel-k - REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global - # Let's wait for the IntegrationPlatform to be ready before starting any operation - kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=45s - - DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-common || exit_code=1 -fi -set +e - -echo "Tests completed with exit code: ${exit_code}" -exit ${exit_code} diff --git a/.github/actions/e2e-install/action.yml b/.github/actions/e2e-install/action.yml deleted file mode 100644 index f739ea69ac..0000000000 --- a/.github/actions/e2e-install/action.yml +++ /dev/null @@ -1,96 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: e2e-install-olm -description: 'End-to-End tests for OLM installation and upgrade procedure' - -inputs: - cluster-config-data: - description: 'The configuration of the underlying cluster (if cluster-type is custom)' - required: false - cluster-kube-config-data: - description: 'Base16 encoded kube config - required for custom cluster type only' - required: false - -runs: - using: "composite" - - steps: - - id: prepare-env - name: Prepare Test Environment - uses: ./.github/actions/kamel-prepare-env - - - id: config-cluster - name: Configure Cluster - uses: ./.github/actions/kamel-config-cluster - with: - cluster-config-data: ${{ inputs.cluster-config-data }} - cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }} - require-olm: true - - - id: released-kamel-cli - name: Get Released Kamel CLI - shell: bash - run: | - export KAMEL_VERSION=$(make get-last-released-version) - curl -L https://github.com/apache/camel-k/releases/download/v${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-amd64.tar.gz -o /tmp/kamel.tar.gz - pushd /tmp && tar -zxf kamel.tar.gz && popd > /dev/null - if [ ! -x /tmp/kamel ]; then - echo "Error: No ${KAMEL_VERSION} downloaded correctly" - exit 1 - fi - - # - # Note: cannot use GITHUB_ENV vars in same script as it was defined - # - export RELEASED_KAMEL_BINARY=/tmp/kamel-${KAMEL_VERSION} - mv /tmp/kamel ${RELEASED_KAMEL_BINARY} - if [ $? == 0 ]; then - echo "Info: Kamel version installed: $(${RELEASED_KAMEL_BINARY} version)" - echo "released-kamel-binary=${RELEASED_KAMEL_BINARY}" >> $GITHUB_OUTPUT - else - echo "Error: Failed to install kamel binary ${KAMEL_VERSION}" - exit 1 - fi - - - id: build-kamel - name: Build Kamel - uses: ./.github/actions/kamel-build - with: - image-registry-push-host: ${{ steps.config-cluster.outputs.cluster-image-registry-push-host }} - image-registry-pull-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }} - image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }} - # Builds the bundle if an OLM is available. - # Since configure-cluster requires OLM then this should be true - build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }} - # Both can be empty and so catalog source will not be created - catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }} - catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }} - - - name: Run IT - shell: bash - run: | - # Note different parameters due to alternative installation - ./.github/actions/e2e-install/exec-tests.sh \ - -b "${{ steps.released-kamel-cli.outputs.released-kamel-binary }}" \ - -d "${{ steps.build-kamel.outputs.build-bundle-image-bundle-index }}" \ - -l "${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}" \ - -n "${{ steps.build-kamel.outputs.build-binary-local-image-name }}" \ - -q "${{ env.CAMEL_K_LOG_LEVEL }}" \ - -s "${{ steps.config-cluster.outputs.cluster-image-registry-insecure }}" \ - -v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \ - -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}" diff --git a/.github/actions/e2e-install/exec-tests.sh b/.github/actions/e2e-install/exec-tests.sh deleted file mode 100755 index 6e640ed75c..0000000000 --- a/.github/actions/e2e-install/exec-tests.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Execute the upgrade tests -# -#### - -set -e - -while getopts ":b:d:l:n:q:s:v:x:" opt; do - case "${opt}" in - b) - KAMEL_BINARY=${OPTARG} - ;; - d) - BUNDLE_INDEX_IMAGE=${OPTARG} - ;; - l) - REGISTRY_PULL_HOST=${OPTARG} - ;; - n) - IMAGE_NAME=${OPTARG} - ;; - q) - LOG_LEVEL=${OPTARG} - ;; - s) - REGISTRY_INSECURE=${OPTARG} - ;; - v) - IMAGE_VERSION=${OPTARG} - ;; - x) - SAVE_FAILED_TEST_NS=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -z "${IMAGE_NAME}" ]; then - echo "Error: local-image-name not defined" - exit 1 -fi - -if [ -z "${IMAGE_VERSION}" ]; then - echo "Error: local-image-version not defined" - exit 1 -fi - -if [ -z "${KAMEL_BINARY}" ]; then - echo "Error: kamel-binary not defined" - exit 1 -fi - -if [ -z "${BUNDLE_INDEX_IMAGE}" ]; then - echo "Error: bundle-index-image not defined" - exit 1 -fi - -if [ -z "${REGISTRY_PULL_HOST}" ]; then - echo "Error: image-registry-pull-host not defined" - exit 1 -fi - -if [ -z "${REGISTRY_INSECURE}" ]; then - echo "Error: image-registry-insecure not defined" - exit 1 -fi - -# Use the last released Kamel CLI -export RELEASED_KAMEL_BIN=${KAMEL_BINARY} - -echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)" - -# Cluster environment -export CUSTOM_IMAGE=${IMAGE_NAME} -export CUSTOM_VERSION=${IMAGE_VERSION} - -# Configure install options -export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST} -export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE} - -# Will only have an effect if olm=false -# since, for OLM, the csv determines the policy -# (see kamel-build-bundle/build-bundle-image.sh) -export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always" - -# Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var - -# Configure test options -export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}" -if [ "${LOG_LEVEL}" == "debug" ]; then - export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}" -fi -export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest -export CAMEL_K_NEW_IIB=${BUNDLE_INDEX_IMAGE} -export CAMEL_K_PREV_UPGRADE_CHANNEL=${PREV_XY_CHANNEL} -export CAMEL_K_NEW_UPGRADE_CHANNEL=${NEW_XY_CHANNEL} -export KAMEL_K_TEST_RELEASE_VERSION=$(make get-last-released-version) -export KAMEL_K_TEST_OPERATOR_CURRENT_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION} -export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS} - -# Then run integration tests -DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-install diff --git a/.github/actions/e2e-knative/action.yml b/.github/actions/e2e-knative/action.yml deleted file mode 100644 index 84d9fb40c8..0000000000 --- a/.github/actions/e2e-knative/action.yml +++ /dev/null @@ -1,73 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: e2e-knative -description: 'End-to-End tests for knative use-cases' - -inputs: - cluster-config-data: - description: 'The configuration of the underlying cluster (if cluster-type is custom)' - required: false - cluster-kube-config-data: - description: 'Base16 encoded kube config - required for custom cluster type only' - required: false - -runs: - using: "composite" - - steps: - - id: prepare-env - name: Prepare Test Environment - uses: ./.github/actions/kamel-prepare-env - - - id: config-cluster - name: Configure Platform - uses: ./.github/actions/kamel-config-cluster - with: - cluster-config-data: ${{ inputs.cluster-config-data }} - cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }} - - - id: build-kamel - name: Build Kamel - uses: ./.github/actions/kamel-build - with: - image-registry-push-host: ${{ steps.config-cluster.outputs.cluster-image-registry-push-host }} - image-registry-pull-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }} - image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }} - build-bundle: false - # Both can be empty and so catalog source will not be created - catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }} - catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }} - - - name: Install Knative - uses: ./.github/actions/kamel-install-knative - - - id: run-it - name: Run IT - shell: bash - run: | - ./.github/actions/e2e-knative/exec-tests.sh \ - -b "${{ steps.config-cluster.outputs.cluster-catalog-source-name }}" \ - -c "${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}" \ - -g "${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}" \ - -i "${{ steps.config-cluster.outputs.cluster-image-namespace }}" \ - -l "${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}" \ - -n "${{ steps.build-kamel.outputs.build-binary-local-image-name }}" \ - -q "${{ env.CAMEL_K_LOG_LEVEL }}" \ - -s "${{steps.config-cluster.outputs.cluster-image-registry-insecure }}" \ - -v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \ - -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}" diff --git a/.github/actions/e2e-knative/exec-tests.sh b/.github/actions/e2e-knative/exec-tests.sh deleted file mode 100755 index 81dd4e56fb..0000000000 --- a/.github/actions/e2e-knative/exec-tests.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Execute the knative tests -# -#### - -set -e - -while getopts ":b:c:g:i:l:n:q:s:v:x:" opt; do - case "${opt}" in - b) - BUILD_CATALOG_SOURCE_NAME=${OPTARG} - ;; - c) - BUILD_CATALOG_SOURCE_NAMESPACE=${OPTARG} - ;; - g) - GLOBAL_OPERATOR_NAMESPACE=${OPTARG} - ;; - i) - IMAGE_NAMESPACE=${OPTARG} - ;; - l) - REGISTRY_PULL_HOST=${OPTARG} - ;; - n) - IMAGE_NAME=${OPTARG} - ;; - q) - LOG_LEVEL=${OPTARG} - ;; - s) - REGISTRY_INSECURE=${OPTARG} - ;; - v) - IMAGE_VERSION=${OPTARG} - ;; - x) - SAVE_FAILED_TEST_NS=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -z "${IMAGE_NAME}" ]; then - echo "Error: local-image-name not defined" - exit 1 -fi - -if [ -z "${IMAGE_VERSION}" ]; then - echo "Error: local-image-version not defined" - exit 1 -fi - -if [ -z "${IMAGE_NAMESPACE}" ]; then - echo "Error: image-namespace not defined" - exit 1 -fi - -if [ -z "${REGISTRY_PULL_HOST}" ]; then - echo "Error: image-registry-pull-host not defined" - exit 1 -fi - -if [ -z "${REGISTRY_INSECURE}" ]; then - echo "Error: image-registry-insecure not defined" - exit 1 -fi - -# Cluster environment -export CUSTOM_IMAGE=${IMAGE_NAME} -export CUSTOM_VERSION=${IMAGE_VERSION} - -# -# If bundle has been built and installed then use it -# -if [ -n "${BUILD_CATALOG_SOURCE_NAMESPACE}" ]; then - export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE_NAME} - export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${BUILD_CATALOG_SOURCE_NAMESPACE} - export KAMEL_INSTALL_OLM_CHANNEL="${NEW_XY_CHANNEL}" -fi - - -export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST} -export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE} -export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION} - -# Will only have an effect if olm=false -# since, for OLM, the csv determines the policy -# (see kamel-build-bundle/build-bundle-image.sh) -export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always" - -export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}" -if [ "${LOG_LEVEL}" == "debug" ]; then - export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}" -fi -export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE} -export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION} -export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS} - -export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false - -if [ -n "${GLOBAL_OPERATOR_NAMESPACE}" ]; then - export CAMEL_K_GLOBAL_OPERATOR_NS="${GLOBAL_OPERATOR_NAMESPACE}" -else - export CAMEL_K_GLOBAL_OPERATOR_NS="default" -fi - -kubectl create ns camel-k -REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global -# Let's wait for the IntegrationPlatform to be ready before starting any operation -kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=45s - -# Then run integration tests -DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-knative diff --git a/.github/actions/e2e-native/action.yml b/.github/actions/e2e-native/action.yml deleted file mode 100644 index 2a47aabb0c..0000000000 --- a/.github/actions/e2e-native/action.yml +++ /dev/null @@ -1,69 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: e2e-native -description: 'End-to-End tests for Quarkus native builds' - -inputs: - cluster-config-data: - description: 'The configuration of the underlying cluster (if cluster-type is custom)' - required: false - cluster-kube-config-data: - description: 'Base16 encoded kube config - required for custom cluster type only' - required: false - -runs: - using: "composite" - - steps: - - id: prepare-env - name: Prepare Test Environment - uses: ./.github/actions/kamel-prepare-env - - - id: config-cluster - name: Configure Platform - uses: ./.github/actions/kamel-config-cluster - with: - cluster-config-data: ${{ inputs.cluster-config-data }} - cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }} - - - id: build-kamel - name: Build Kamel - uses: ./.github/actions/kamel-build - with: - image-registry-push-host: ${{ steps.config-cluster.outputs.cluster-image-registry-push-host }} - image-registry-pull-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }} - image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }} - build-bundle: false - # Both can be empty and so catalog source will not be created - catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }} - catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }} - - - id: run-it - name: Run IT - shell: bash - run: | - ./.github/actions/e2e-native/exec-tests.sh \ - -b "${{ steps.config-cluster.outputs.cluster-catalog-source-name }}" \ - -c "${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}" \ - -i "${{ steps.config-cluster.outputs.cluster-image-namespace }}" \ - -l "${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}" \ - -n "${{ steps.build-kamel.outputs.build-binary-local-image-name }}" \ - -s "${{steps.config-cluster.outputs.cluster-image-registry-insecure }}" \ - -v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \ - -q "${{ env.CAMEL_K_LOG_LEVEL }}" \ - -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}" diff --git a/.github/actions/e2e-native/exec-tests.sh b/.github/actions/e2e-native/exec-tests.sh deleted file mode 100755 index 430f8564ad..0000000000 --- a/.github/actions/e2e-native/exec-tests.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Execute the install native tests -# -#### - -set -e - -while getopts ":b:c:i:l:n:q:s:t:v:x:" opt; do - case "${opt}" in - b) - BUILD_CATALOG_SOURCE_NAME=${OPTARG} - ;; - c) - BUILD_CATALOG_SOURCE_NAMESPACE=${OPTARG} - ;; - i) - IMAGE_NAMESPACE=${OPTARG} - ;; - l) - REGISTRY_PULL_HOST=${OPTARG} - ;; - n) - IMAGE_NAME=${OPTARG} - ;; - q) - LOG_LEVEL=${OPTARG} - ;; - s) - REGISTRY_INSECURE=${OPTARG} - ;; - t) - HIGH_MEMORY=${OPTARG} - ;; - v) - IMAGE_VERSION=${OPTARG} - ;; - x) - SAVE_FAILED_TEST_NS=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -z "${IMAGE_NAME}" ]; then - echo "Error: local-image-name not defined" - exit 1 -fi - -if [ -z "${IMAGE_VERSION}" ]; then - echo "Error: local-image-version not defined" - exit 1 -fi - -if [ -z "${IMAGE_NAMESPACE}" ]; then - echo "Error: image-namespace not defined" - exit 1 -fi - -if [ -z "${REGISTRY_PULL_HOST}" ]; then - echo "Error: image-registry-pull-host not defined" - exit 1 -fi - -if [ -z "${REGISTRY_INSECURE}" ]; then - echo "Error: image-registry-insecure not defined" - exit 1 -fi - -# Cluster environment -export CUSTOM_IMAGE=${IMAGE_NAME} -export CUSTOM_VERSION=${IMAGE_VERSION} - -# -# If bundle has been built and installed then use it -# -if [ -n "${BUILD_CATALOG_SOURCE_NAMESPACE}" ]; then - export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE_NAME} - export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${BUILD_CATALOG_SOURCE_NAMESPACE} - export KAMEL_INSTALL_OLM_CHANNEL="${NEW_XY_CHANNEL}" -fi - - -export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST} -export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE} -export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION} - -# Will only have an effect if olm=false -# since, for OLM, the csv determines the policy -# (see kamel-build-bundle/build-bundle-image.sh) -export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always" - -export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE} -export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION} -export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS} - -export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}" -if [ "${LOG_LEVEL}" == "debug" ]; then - export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}" -fi - -kubectl create ns camel-k -REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global -# Let's wait for the IntegrationPlatform to be ready before starting any operation -kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=45s - -# Then run integration tests -DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-quarkus-native diff --git a/.github/actions/e2e-telemetry/action.yml b/.github/actions/e2e-telemetry/action.yml deleted file mode 100644 index ca52be52c8..0000000000 --- a/.github/actions/e2e-telemetry/action.yml +++ /dev/null @@ -1,76 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: e2e-telemetry -description: 'End-to-End tests for telemetry use-cases' - -inputs: - cluster-config-data: - description: 'The configuration of the underlying cluster (if cluster-type is custom)' - required: false - cluster-kube-config-data: - description: 'Base16 encoded kube config - required for custom cluster type only' - required: false - -runs: - using: "composite" - - steps: - - id: prepare-env - name: Prepare Test Environment - uses: ./.github/actions/kamel-prepare-env - - - id: config-cluster - name: Configure Platform - uses: ./.github/actions/kamel-config-cluster - with: - cluster-config-data: ${{ inputs.cluster-config-data }} - cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }} - - - id: build-kamel - name: Build Kamel - uses: ./.github/actions/kamel-build - with: - image-registry-push-host: ${{ steps.config-cluster.outputs.cluster-image-registry-push-host }} - image-registry-pull-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }} - image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }} - build-bundle: false - # Both can be empty and so catalog source will not be created - catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }} - catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }} - - - name: Install OTLP Collector - uses: ./.github/actions/kamel-install-otlp-collector - with: - otlp-collector-image-name: otel/opentelemetry-collector - otlp-collector-image-version: 0.102.0 - - - id: run-it - name: Run IT - shell: bash - run: | - ./.github/actions/e2e-telemetry/exec-tests.sh \ - -b "${{ steps.config-cluster.outputs.cluster-catalog-source-name }}" \ - -c "${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}" \ - -g "${{ steps.config-cluster.outputs.cluster-global-operator-namespace }}" \ - -i "${{ steps.config-cluster.outputs.cluster-image-namespace }}" \ - -l "${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}" \ - -n "${{ steps.build-kamel.outputs.build-binary-local-image-name }}" \ - -q "${{ env.CAMEL_K_LOG_LEVEL }}" \ - -s "${{steps.config-cluster.outputs.cluster-image-registry-insecure }}" \ - -v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \ - -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}" diff --git a/.github/actions/e2e-telemetry/exec-tests.sh b/.github/actions/e2e-telemetry/exec-tests.sh deleted file mode 100755 index 871e2108fe..0000000000 --- a/.github/actions/e2e-telemetry/exec-tests.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Execute the telemetry tests -# -#### - -set -e - -while getopts ":b:c:g:i:l:n:q:s:v:x:" opt; do - case "${opt}" in - b) - BUILD_CATALOG_SOURCE_NAME=${OPTARG} - ;; - c) - BUILD_CATALOG_SOURCE_NAMESPACE=${OPTARG} - ;; - g) - GLOBAL_OPERATOR_NAMESPACE=${OPTARG} - ;; - i) - IMAGE_NAMESPACE=${OPTARG} - ;; - l) - REGISTRY_PULL_HOST=${OPTARG} - ;; - n) - IMAGE_NAME=${OPTARG} - ;; - q) - LOG_LEVEL=${OPTARG} - ;; - s) - REGISTRY_INSECURE=${OPTARG} - ;; - v) - IMAGE_VERSION=${OPTARG} - ;; - x) - SAVE_FAILED_TEST_NS=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -z "${IMAGE_NAME}" ]; then - echo "Error: local-image-name not defined" - exit 1 -fi - -if [ -z "${IMAGE_VERSION}" ]; then - echo "Error: local-image-version not defined" - exit 1 -fi - -if [ -z "${IMAGE_NAMESPACE}" ]; then - echo "Error: image-namespace not defined" - exit 1 -fi - -if [ -z "${REGISTRY_PULL_HOST}" ]; then - echo "Error: image-registry-pull-host not defined" - exit 1 -fi - -if [ -z "${REGISTRY_INSECURE}" ]; then - echo "Error: image-registry-insecure not defined" - exit 1 -fi - -# Cluster environment -export CUSTOM_IMAGE=${IMAGE_NAME} -export CUSTOM_VERSION=${IMAGE_VERSION} - -# -# If bundle has been built and installed then use it -# -if [ -n "${BUILD_CATALOG_SOURCE_NAMESPACE}" ]; then - export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE_NAME} - export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${BUILD_CATALOG_SOURCE_NAMESPACE} - export KAMEL_INSTALL_OLM_CHANNEL="${NEW_XY_CHANNEL}" -fi - -export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST} -export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE} -export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION} - -# Will only have an effect if olm=false -# since, for OLM, the csv determines the policy -# (see kamel-build-bundle/build-bundle-image.sh) -export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always" - -export CAMEL_K_TEST_LOG_LEVEL="${LOG_LEVEL}" -if [ "${LOG_LEVEL}" == "debug" ]; then - export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}" -fi -export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE} -export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION} -export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS} - -if [ -n "${GLOBAL_OPERATOR_NAMESPACE}" ]; then - export CAMEL_K_GLOBAL_OPERATOR_NS="${GLOBAL_OPERATOR_NAMESPACE}" -else - export CAMEL_K_GLOBAL_OPERATOR_NS="default" -fi - -kubectl create ns camel-k -REGISTRY="${KAMEL_INSTALL_REGISTRY}" make install-k8s-global -# Let's wait for the IntegrationPlatform to be ready before starting any operation -kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=45s - -# Then run all integration telemetry test rather than ending on first failure -set -e -exit_code=0 -DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-telemetry || exit_code=1 -set +e - -echo "Tests completed with exit code: ${exit_code}" -exit ${exit_code} diff --git a/.github/actions/kamel-install-knative/action.yml b/.github/actions/infra-setting/action.yml similarity index 50% rename from .github/actions/kamel-install-knative/action.yml rename to .github/actions/infra-setting/action.yml index 60882fdbf0..10f318581f 100644 --- a/.github/actions/kamel-install-knative/action.yml +++ b/.github/actions/infra-setting/action.yml @@ -15,12 +15,40 @@ # limitations under the License. # --------------------------------------------------------------------------- -name: kamel-install-knative -description: 'Install Knative artifacts' +name: infra-setting +description: 'Setting CI infrastructure' + runs: using: "composite" + steps: - - name: Install Knative - shell: bash - run: | - ./e2e/knative/files/setup.sh + - id: setup-jdk + name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - id: setup-go + name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + check-latest: true + - id: setup-kubectl + name: Set up Kubectl + uses: azure/setup-kubectl@v4 + - id: minikube-start + name: Start minikube + uses: medyagh/setup-minikube@latest + with: + addons: registry + cpus: max + memory: max + - id: minikube-settings + name: Set docker-env + shell: bash + run: | + eval $(minikube -p minikube docker-env) + echo "KAMEL_INSTALL_REGISTRY=$(kubectl -n kube-system get service registry -o jsonpath='{.spec.clusterIP}')" >> $GITHUB_ENV + echo "Setting registry as $KAMEL_INSTALL_REGISTRY which is required by certain tests" + NOTEST=true make images diff --git a/.github/actions/kamel-install-otlp-collector/action.yml b/.github/actions/install-otlp-collector/action.yml similarity index 100% rename from .github/actions/kamel-install-otlp-collector/action.yml rename to .github/actions/install-otlp-collector/action.yml diff --git a/.github/actions/kamel-build-binary/action.yml b/.github/actions/kamel-build-binary/action.yml deleted file mode 100644 index 86451fe109..0000000000 --- a/.github/actions/kamel-build-binary/action.yml +++ /dev/null @@ -1,56 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: kamel-build-binary -description: 'Builds kamel operator binary' - -inputs: - image-registry-push-host: - description: 'Location of image registry push host' - required: false - image-registry-pull-host: - description: 'Location of image registry pull host' - required: false - image-namespace: - description: 'Namespace in which to store the image' - required: false - default: 'apache' - make-rules: - description: 'Override the default make rules' - required: false - -runs: - using: "composite" - steps: - - id: build-operator - name: Build Kamel Operator - shell: bash - run: | - ./.github/actions/kamel-build-binary/build-binary.sh \ - -i "${{ inputs.image-namespace }}" \ - -l "${{ inputs.image-registry-pull-host }}" \ - -m "${{ inputs.make-rules }}" \ - -s "${{ inputs.image-registry-push-host }}" \ - -x "${{ env.DEBUG_USE_EXISTING_IMAGE }}" - -outputs: - build-binary-local-image-name: - description: "Full name of the binary operator image" - value: ${{ steps.build-operator.outputs.build-binary-local-image-name }} - build-binary-local-image-version: - description: "Version & tag of the binary operator image" - value: ${{ steps.build-operator.outputs.build-binary-local-image-version }} diff --git a/.github/actions/kamel-build-binary/build-binary.sh b/.github/actions/kamel-build-binary/build-binary.sh deleted file mode 100755 index fc90e183bc..0000000000 --- a/.github/actions/kamel-build-binary/build-binary.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Builds the kamel binary -# -#### - -set -e - -while getopts ":i:l:m:s:x:" opt; do - case "${opt}" in - i) - IMAGE_NAMESPACE=${OPTARG} - ;; - l) - REGISTRY_PULL_HOST=${OPTARG} - ;; - m) - MAKE_RULES="${OPTARG}" - ;; - s) - REGISTRY_PUSH_HOST=${OPTARG} - ;; - x) - DEBUG_USE_EXISTING_IMAGE=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -n "${REGISTRY_PUSH_HOST}" ]; then - # - # Need an image namespace if using a registry - # - if [ -z "${IMAGE_NAMESPACE}" ]; then - echo "Error: image-namespace not defined" - exit 1 - fi - - # - # Build with the PUSH host to ensure the correct image:tag - # for docker to push the image. - # - export CUSTOM_IMAGE=${REGISTRY_PUSH_HOST}/${IMAGE_NAMESPACE}/camel-k - - # TODO remove as soon as the issue is fixed - # https://github.com/actions/runner-images/issues/8649 - if [ "$RUNNER_OS" == "macOS" ]; then - export CUSTOM_IMAGE="127.0.0.1:5000/${IMAGE_NAMESPACE}/camel-k" - fi -fi - -if [ -n "${DEBUG_USE_EXISTING_IMAGE}" ] && [ -n "${CUSTOM_IMAGE}" ]; then - echo "Fetching Kamel from existing build" - - docker pull ${DEBUG_USE_EXISTING_IMAGE} - id=$(docker create ${DEBUG_USE_EXISTING_IMAGE}) - docker cp $id:/usr/local/bin/kamel . - - docker tag ${DEBUG_USE_EXISTING_IMAGE} ${CUSTOM_IMAGE}:$(make get-version) - docker push ${CUSTOM_IMAGE}:$(make get-version) -else - - echo "Build Kamel from source" - - RULES="PACKAGE_ARTIFACTS_STRATEGY=download build images" - if [ -n "${MAKE_RULES}" ]; then - RULES=" ${MAKE_RULES} " - fi - - if [ -n "${REGISTRY_PUSH_HOST}" ]; then - RULES="${RULES} image-push" - fi - - make ${RULES} -fi - -echo "Moving kamel binary to be visible on PATH" - -if [ "$RUNNER_OS" == "macOS" ]; then - # We need to build the binary for the proper platform if we're not on Linux - make build - ${SUDO} mv $(readlink kamel) /usr/local/bin/kamel -else - ${SUDO} mv $(readlink kamel) /usr/bin/kamel -fi -echo "Kamel version installed: $(kamel version)" - -# -# Use the PULL host to ensure the correct image:tag -# is passed into the tests for the deployment to pull from -# -BUILD_BINARY_LOCAL_IMAGE_NAME="${REGISTRY_PULL_HOST}/${IMAGE_NAMESPACE}/camel-k" -BUILD_BINARY_LOCAL_IMAGE_VERSION="$(make get-version)" -echo "Setting build-binary-local-image-name to ${BUILD_BINARY_LOCAL_IMAGE_NAME}" -echo "build-binary-local-image-name=${BUILD_BINARY_LOCAL_IMAGE_NAME}" >> $GITHUB_OUTPUT -echo "Setting build-binary-local-image-name-version to ${BUILD_BINARY_LOCAL_IMAGE_VERSION}" -echo "build-binary-local-image-version=${BUILD_BINARY_LOCAL_IMAGE_VERSION}" >> $GITHUB_OUTPUT diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml deleted file mode 100644 index d4aabcf1be..0000000000 --- a/.github/actions/kamel-build-bundle/action.yaml +++ /dev/null @@ -1,101 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: kamel-build-bundle -description: 'Builds kamel operator metadata bundle' - -inputs: - image-registry-push-host: - description: 'Location of image registry push host' - required: false - image-registry-pull-host: - description: 'Location of image registry pull host' - required: false - image-namespace: - description: 'Namespace in which to store the image' - required: false - default: 'apache' - local-image-name: - description: 'Reference of the camel-k image' - required: true - local-image-version: - description: "Reference of the camel-k image version" - required: true - catalog-source-name: - description: 'Name of the catalog source for the bundle (if required)' - required: false - catalog-source-namespace: - description: 'Namespace in which to install the catalog source for the bundle (if required)' - required: false - -runs: - using: "composite" - steps: - - - id: build-bundle-image - name: Build Operator bundle - shell: bash - run: | - ./.github/actions/kamel-build-bundle/build-bundle-image.sh \ - -i "${{ inputs.image-namespace }}" \ - -l "${{ inputs.image-registry-pull-host }}" \ - -n "${{ inputs.local-image-name }}" \ - -s "${{ inputs.image-registry-push-host }}" \ - -v "${{ inputs.local-image-version }}" - - - id: install-opm - name: Install opm if required - shell: bash - run: | - make opm - - # Append to PATH if not already - echo "${{ env.GOPATH }}/bin" >> $GITHUB_PATH - which opm || { echo 'opm not found' ; exit 1; } - - - id: build-index-image - name: Create New Index Image - shell: bash - run: | - ./.github/actions/kamel-build-bundle/build-index-image.sh \ - -b "${{ steps.build-bundle-image.outputs.build-bundle-local-image }}" \ - -i "${{ inputs.image-namespace }}" \ - -l "${{ inputs.image-registry-pull-host }}" \ - -n "${{ inputs.local-image-name }}" \ - -s "${{ inputs.image-registry-push-host }}" \ - -v "${{ inputs.local-image-version }}" \ - -x "$(make get-csv-name)" \ - -y "$(make get-last-released-img-name)" \ - -z "$(make get-last-released-version)" - - - id: build-image-catalog - name: Create a new catalog to host the index image - shell: bash - run: | - ./.github/actions/kamel-build-bundle/build-image-catalog.sh \ - -b "${{ inputs.catalog-source-name }}" \ - -c "${{ inputs.catalog-source-namespace }}" \ - -i "${{ inputs.image-namespace }}" \ - -x "${{ steps.build-index-image.outputs.build-bundle-image-bundle-index }}" - -outputs: - build-bundle-local-image: - description: "Full name of the bundle image" - value: ${{ steps.build-bundle-image.outputs.build-bundle-local-image }} - build-bundle-image-bundle-index: - description: "Full name of the bundle index image" - value: ${{ steps.build-index-image.outputs.build-bundle-image-bundle-index }} diff --git a/.github/actions/kamel-build-bundle/build-bundle-image.sh b/.github/actions/kamel-build-bundle/build-bundle-image.sh deleted file mode 100755 index b448930b42..0000000000 --- a/.github/actions/kamel-build-bundle/build-bundle-image.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Builds the kamel bundle image -# -#### - -set +e - -while getopts ":i:l:n:s:v:" opt; do - case "${opt}" in - i) - IMAGE_NAMESPACE=${OPTARG} - ;; - l) - REGISTRY_PULL_HOST=${OPTARG} - ;; - n) - IMAGE_NAME=${OPTARG} - ;; - s) - REGISTRY_PUSH_HOST=${OPTARG} - ;; - v) - IMAGE_VERSION=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -echo "Build Operator bundle" -if ! command -v kustomize &> /dev/null -then - echo "kustomize could not be found. Has it not been installed?" - exit 1 -fi - -if [ -z "${IMAGE_NAME}" ]; then - echo "Error: local-image-name not defined" - exit 1 -fi - -if [ -z "${IMAGE_VERSION}" ]; then - echo "Error: local-image-version not defined" - exit 1 -fi - -if [ -z "${IMAGE_NAMESPACE}" ]; then - echo "Error: image-namespace not defined" - exit 1 -fi - -if [ -z "${REGISTRY_PUSH_HOST}" ]; then - echo "Error: image-registry-push-host not defined" - exit 1 -fi - -if [ -z "${REGISTRY_PULL_HOST}" ]; then - echo "Error: image-registry-pull-host not defined" - exit 1 -fi - -# -# Using a custom single cluster can allow for use-case that old camel-k images are cached -# (see https://cloud.redhat.com/blog/image-garbage-collection-in-openshift). This is not an -# issue on ephemeral clusters like kind. -# Therefore, need to edit the bundle CSV to ensure the ImagePullPolicy of the camel-k image is -# set to "Always" to mandate that the new image is always pulled. -# -# Use kustomize to patch the deployment resource -# -pushd pkg/resources/config/manager > /dev/null -kustomize edit add patch --path patch-image-pull-policy-always.yaml --kind Deployment --name camel-k-operator -popd - -# -# Build with the PUSH host to ensure the correct image:tag -# for docker to push the image. -# Note: the CUSTOM_IMAGE must still reference the pull host -# to allow the operator image to be found -# -BUNDLE_IMAGE_BASE_NAME=$(basename $(make get-bundle-image)) -export PUSH_BUNDLE_LOCAL_IMAGE=${REGISTRY_PUSH_HOST}/${IMAGE_NAMESPACE}/${BUNDLE_IMAGE_BASE_NAME} -export CUSTOM_IMAGE=${IMAGE_NAME} -export CUSTOM_VERSION=${IMAGE_VERSION} - -export PREV_XY_CHANNEL=stable-v$(make get-last-released-version | grep -Po "\d+" | head -n 1) -echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV -export NEW_XY_CHANNEL=stable-dev-$(make get-version | grep -Po "\d+\.\d+") -echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV - -echo "BUNDLE_IMAGE_NAME=${PUSH_BUNDLE_LOCAL_IMAGE}" -echo "DEFAULT_CHANNEL=${NEW_XY_CHANNEL}" -echo "CHANNELS=${NEW_XY_CHANNEL}" - -make bundle-push \ - BUNDLE_IMAGE_NAME="${PUSH_BUNDLE_LOCAL_IMAGE}" \ - DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" \ - CHANNELS="${NEW_XY_CHANNEL}" 2>&1 -if [ $? != 0 ]; then - echo "Error: Making bundle failed." - exit 1 -fi - -# -# Use the PULL host to ensure the correct image:tag -# is passed into the tests for the deployment to pull from -# -PULL_BUNDLE_LOCAL_IMAGE="${REGISTRY_PULL_HOST}/${IMAGE_NAMESPACE}/${BUNDLE_IMAGE_BASE_NAME}:${IMAGE_VERSION}" -echo "Setting build-bundle-local-image to ${PULL_BUNDLE_LOCAL_IMAGE}" -echo "build-bundle-local-image=${PULL_BUNDLE_LOCAL_IMAGE}" >> $GITHUB_OUTPUT diff --git a/.github/actions/kamel-build-bundle/build-image-catalog.sh b/.github/actions/kamel-build-bundle/build-image-catalog.sh deleted file mode 100755 index 76ec3854f9..0000000000 --- a/.github/actions/kamel-build-bundle/build-image-catalog.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Builds the kamel bundle index image -# -#### - -set -e - -while getopts ":b:c:i:x:" opt; do - case "${opt}" in - b) - CATALOG_SOURCE_NAME=${OPTARG} - ;; - c) - CATALOG_SOURCE_NAMESPACE=${OPTARG} - ;; - i) - IMAGE_NAMESPACE=${OPTARG} - ;; - x) - BUNDLE_IMAGE_INDEX=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -z "${CATALOG_SOURCE_NAMESPACE}" ]; then - echo "No catalog source namespace defined ... skipping catalog source creation" - exit 0 -fi - -if [ -z "${CATALOG_SOURCE_NAME}" ]; then - echo "No catalog source name defined ... skipping catalog source creation" - exit 0 -fi - -if [ -z "${IMAGE_NAMESPACE}" ]; then - echo "Error: image-namespace not defined" - exit 1 -fi - -if [ -z "${BUNDLE_IMAGE_INDEX}" ]; then - echo "Error: build-bundle-image-bundle-index not defined" - exit 1 -fi - -kubectl get ns ${CATALOG_SOURCE_NAMESPACE} &> /dev/null -if [ $? != 0 ]; then - echo "Error: Catalog source cannot be created as namespace ${CATALOG_SOURCE_NAMESPACE} does not exist." - exit 1 -fi - -cat < /dev/null -then - echo "opm could not be found. Has it not been installed?" - exit 1 -fi - -# Shorten the vars -PUSH_REGISTRY=${REGISTRY_PUSH_HOST} -PULL_REGISTRY=${REGISTRY_PULL_HOST} - -# -# opm requires an active pull registry from which to verify (if not download) the bundle image -# Since the image-registry-pull-host may not be visible (eg. in the case of openshift), we need -# to fake the registry to allow opm to complete its task of creating an index image. -# -# 1. Add and alias to the hosts file for the name of the image-registry -# 2. Run a container of registry:2 docker image on the same port as the image-registry (port 80 if not present) -# 3. Tag and them push the image to the registry using docker -# 4. Run opm -# - -if [ "${PULL_REGISTRY}" != "${PUSH_REGISTRY}" ]; then - # - # With the registry interfaces different then good chance that - # pull registry is not externally accessible, eg. openshift - # - - PULL_HOST=$(echo ${PULL_REGISTRY} | sed -e 's/\(.*\):.*/\1/') - PULL_PORT=$(echo ${PULL_REGISTRY} | sed -ne 's/.*:\([0-9]\+\).*/\1/p') - if [ -z "${PULL_PORT}" ]; then - # Use standard http port - PULL_PORT=80 - fi - - echo "Impersonating registry at ${PULL_HOST}:${PULL_PORT}" - - # - # Update both ipv4 and ipv6 addresses if they exist - # 127.0.0.1 localhost - # ::1 localhost ip6-localhost ip6-loopback - # - # Only add PULL_HOST if not already added (avoids repeated appended) - # - ${SUDO} sed -i "/${PULL_HOST}/!s/localhost/& ${PULL_HOST} /" /etc/hosts - - # - # Bring up the registry:2 instance if not already started - # - reg=$(docker ps -a -q -f name=triage-registry) - if [ -n "${reg}" ]; then - docker stop triage-registry - docker rm triage-registry - fi - - docker run -d -p ${PULL_PORT}:5000 --name triage-registry registry:2 - - # - # Tag the bundle image - # - echo "Tagging bundle image ..." - IMAGE_BASE_NAME=$(basename ${IMAGE_NAME}) - export CUSTOM_IMAGE=${PUSH_REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_BASE_NAME} - export CUSTOM_VERSION=${IMAGE_VERSION} - docker tag \ - $(make get-bundle-image):${CUSTOM_VERSION} \ - ${BUNDLE_IMAGE} - - # Push the bundle image to the registry - # - echo "Pushing bundle image ..." - docker push ${BUNDLE_IMAGE} 2>&1 -fi - -# -# Construct an index image containing the newly built bundle image -# -echo "Constructing index image ..." - -# -# Removes catalog directory if already exists. -# Stops opm from aborting due to existing directory. -# -CATALOG_DIR=catalog -if [ -d ${CATALOG_DIR} ]; then - rm -rf ${CATALOG_DIR} -fi - -if [ -f ${CATALOG_DIR}.Dockerfile ]; then - rm -f ${CATALOG_DIR}.Dockerfile -fi - -mkdir ${CATALOG_DIR} -opm render quay.io/operatorhubio/catalog:latest -o yaml > ${CATALOG_DIR}/bundles.yaml -opm render --use-http -o yaml ${BUNDLE_IMAGE} > ${CATALOG_DIR}/camel-k.yaml - -# -# Add the dedicated stable-dev branch (needed for upgrade tests) -# -cat << EOF >> ${CATALOG_DIR}/camel-k.yaml ---- -schema: olm.channel -package: camel-k -name: stable-dev-$(make get-version | grep -Po "\d+\.\d+") -entries: - - name: $(make get-csv-name) - replaces: $(make get-last-released-img-name).v$(make get-last-released-version | grep -Po "\d+\.\d+\.\d+") -EOF - -# -# Update the existing stable channel (needed for preflight and tests on OCP) -# -sedtemp=$(mktemp sed-template-XXX.sed) -cat << EOF > ${sedtemp} -/- name: ${IMAGE_LAST_NAME}.v${IMAGE_LAST_VERSION}/ { - p; - n; - / replaces:/ { - p; - n; - /name: stable$/ { - i- name: ${CSV_NAME} - i\ \ replaces: ${IMAGE_LAST_NAME}.v${IMAGE_LAST_VERSION} - p; - d; - } - } -} -p; -EOF - -sed -i -n -f ${sedtemp} ${CATALOG_DIR}/bundles.yaml - -rm -f ${sedtemp} - -# -# Validate the modified catalog -# -opm validate ${CATALOG_DIR} -opm generate dockerfile ${CATALOG_DIR} -if [ ! -f catalog.Dockerfile ]; then - echo "Error: Failed to create catalog dockerfile" - exit 1 -fi -docker build . -f catalog.Dockerfile -t ${LOCAL_IIB} -docker push ${LOCAL_IIB} -BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX="${REGISTRY_PULL_HOST}/${IMAGE_NAMESPACE}/camel-k-iib:${IMAGE_VERSION}" -echo "Setting build-bundle-image-bundle-index to ${BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX}" -echo "build-bundle-image-bundle-index=${BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX}" >> $GITHUB_OUTPUT diff --git a/.github/actions/kamel-build/action.yml b/.github/actions/kamel-build/action.yml deleted file mode 100644 index a3f3ff9686..0000000000 --- a/.github/actions/kamel-build/action.yml +++ /dev/null @@ -1,82 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: kamel-build -description: 'Builds kamel operator image and the bundle' - -inputs: - image-registry-push-host: - description: 'Location of image registry push host' - required: false - image-registry-pull-host: - description: 'Location of image registry pull host' - required: false - image-namespace: - description: 'Namespace in which to store the image' - required: false - default: 'apache' - make-rules: - description: 'Override the default make rules' - required: false - build-bundle: - description: 'Build a bundle for install into OLM catalog' - required: true - default: false - catalog-source-name: - description: 'Name of the catalog source for the bundle (if required)' - required: false - catalog-source-namespace: - description: 'Namespace in which to install the catalog source for the bundle (if required)' - required: false - -runs: - using: "composite" - steps: - - id: build-kamel-binary - name: Build Kamel Binary - uses: ./.github/actions/kamel-build-binary - with: - image-registry-push-host: ${{ inputs.image-registry-push-host }} - image-registry-pull-host: ${{ inputs.image-registry-pull-host }} - image-namespace: ${{ inputs.image-namespace }} - make-rules: ${{ inputs.make-rules }} - - - id: build-kamel-bundle - name: Build Kamel Metadata Bundle - uses: ./.github/actions/kamel-build-bundle - with: - image-registry-push-host: ${{ inputs.image-registry-push-host }} - image-registry-pull-host: ${{ inputs.image-registry-pull-host }} - image-namespace: ${{ inputs.image-namespace }} - local-image-name: ${{ steps.build-kamel-binary.outputs.build-binary-local-image-name }} - local-image-version: ${{ steps.build-kamel-binary.outputs.build-binary-local-image-version }} - catalog-source-name: ${{ inputs.catalog-source-name }} - catalog-source-namespace: ${{ inputs.catalog-source-namespace }} - -outputs: - build-binary-local-image-name: - description: "Full name of the binary operator image" - value: ${{ steps.build-kamel-binary.outputs.build-binary-local-image-name }} - build-binary-local-image-version: - description: "Version & tag of the binary operator image" - value: ${{ steps.build-kamel-binary.outputs.build-binary-local-image-version }} - build-bundle-local-image: - description: "Full name of the bundle image" - value: ${{ steps.build-kamel-bundle.outputs.build-bundle-local-image }} - build-bundle-image-bundle-index: - description: "Full name of the bundle index image" - value: ${{ steps.build-kamel-bundle.outputs.build-bundle-image-bundle-index }} diff --git a/.github/actions/kamel-config-cluster-custom/action.yml b/.github/actions/kamel-config-cluster-custom/action.yml deleted file mode 100644 index 43ced78e63..0000000000 --- a/.github/actions/kamel-config-cluster-custom/action.yml +++ /dev/null @@ -1,131 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: kamel-config-cluster-custom -description: 'Provides configuration for accessing a custom kubernetes cluster' - -inputs: - cluster-config-data: - description: 'Non-Secure Variables for the cluster configuration' - required: true - cluster-kube-config-data: - description: 'Base16 encoded kube config' - required: true - -runs: - using: "composite" - steps: - - id: connect-cluster - name: Connect to cluster - shell: bash - run: | - ./.github/actions/kamel-config-cluster-custom/connect-cluster.sh \ - -c "${{ inputs.cluster-config-data }}" \ - -k "${{ inputs.cluster-kube-config-data }}" - - - id: configure-developer-user - name: Configure Developer User - shell: bash - run: | - # Aggregate pod eviction permission to the default admin role - cat < /dev/null; then - echo 0 - else - echo 1 - fi -} - -get_property() { - VAR=$(echo "${CLUSTER_CONFIG_DATA}" | grep "${1}=") - echo ${VAR#*=} -} - -if [ -z "${KUBE_CONFIG_DATA}" ]; then - echo "Error: kube config data property cannot be found" - exit 1 -fi - -if [ ! $(has_property kube-admin-user-ctx) ]; then - echo "Error: kube admin context property cannot be found" - exit 1 -fi - -if [ ! $(has_property kube-user-ctx) ]; then - echo "Error: kube user context property cannot be found" - exit 1 -fi - -if [ ! $(has_property image-registry-pull-host) ]; then - echo "Error: image registry pull host property cannot be found" - exit 1 -fi - -if [ ! $(has_property image-registry-push-host) ]; then - echo "Error: image registry build host property cannot be found" - exit 1 -fi - -echo "cluster-image-registry-push-host=$(get_property image-registry-push-host)" >> $GITHUB_OUTPUT -echo "cluster-image-registry-pull-host=$(get_property image-registry-pull-host)" >> $GITHUB_OUTPUT -echo "cluster-image-registry-insecure=$(get_property image-registry-insecure)" >> $GITHUB_OUTPUT -echo "cluster-catalog-source-name=$(get_property catalog-source-name)" >> $GITHUB_OUTPUT -echo "cluster-catalog-source-namespace=$(get_property catalog-source-namespace)" >> $GITHUB_OUTPUT -echo "cluster-global-operator-namespace=$(get_property global-operator-namespace)" >> $GITHUB_OUTPUT - -# -# Export the image namespace if defined in the cluster config -# -if [ $(has_property image-namespace) ]; then - echo "cluster-image-namespace=$(get_property image-namespace)" >> $GITHUB_OUTPUT -fi - -# -# Export the context used for admin and user -# -echo "cluster-kube-admin-user-ctx=$(get_property kube-admin-user-ctx)" >> $GITHUB_OUTPUT -echo "cluster-kube-user-ctx=$(get_property kube-user-ctx)" >> $GITHUB_OUTPUT - -# -# Keep values private in the log -# -echo "::add-mask::$(get_property image-registry-push-host)" -echo "::add-mask::$(get_property image-registry-pull-host)" -echo "::add-mask::$(get_property kube-admin-user-ctx)" -echo "::add-mask::$(get_property kube-user-ctx)" - -# -# Export the flag for olm capability -# -echo "cluster-has-olm=$(get_property has-olm)" >> $GITHUB_OUTPUT - -# -# Login to docker if registry is externally secured -# -if [ $(has_property image-registry-user) ] && [ $(has_property image-registry-token) ]; then - echo "Secured registry in use so login with docker" - docker login \ - -u $(get_property image-registry-user) \ - -p $(get_property image-registry-token) \ - $(get_property image-registry-push-host) -fi - -# Copy the kube config to the correct location for kubectl -mkdir -p $HOME/.kube -echo -n "${KUBE_CONFIG_DATA}" | base64 -d > ${HOME}/.kube/config -if [ ! -f ${HOME}/.kube/config ]; then - echo "Error: kube config file not created correctly" - exit 1 -fi - -set -e -kubectl config use-context $(get_property kube-admin-user-ctx) -if [ $? != 0 ]; then - echo "Error: Failed to select kube admin context. Is the config and context correct?" - exit 1 -fi -set +e diff --git a/.github/actions/kamel-config-cluster-kind/action.yml b/.github/actions/kamel-config-cluster-kind/action.yml deleted file mode 100644 index e7122bf0fb..0000000000 --- a/.github/actions/kamel-config-cluster-kind/action.yml +++ /dev/null @@ -1,75 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: kamel-config-cluster-kind -description: 'Provides configuration for making available kubernetes cluster on kind' - -runs: - using: "composite" - steps: - - id: install-cluster - name: Install Cluster - uses: container-tools/kind-action@v2.0.4 - if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }} - with: - version: v0.22.0 - node_image: kindest/node:v1.30.0@sha256:047357ac0cfea04663786a612ba1eaba9702bef25227a794b52890dd8bcd692e - cpu: 3 - - - id: info - name: Info - shell: bash - if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }} - run: | - kubectl cluster-info - kubectl describe nodes - - # - # Avoid bringing up the cluster repeatedly - # - echo "CLUSTER_KIND_CONFIGURED=true" >> $GITHUB_ENV - - - id: extract-config - name: Output the config - shell: bash - run: ./.github/actions/kamel-config-cluster-kind/extract-config.sh - -outputs: - cluster-image-registry-push-host: - description: "The image registry to which to push images" - value: ${{ steps.extract-config.outputs.cluster-image-registry-push-host }} - cluster-image-registry-pull-host: - description: "The image registry from which to pull images" - value: ${{ steps.extract-config.outputs.cluster-image-registry-pull-host }} - cluster-image-registry-insecure: - description: "Whether the pull registry is insecure" - value: ${{ steps.extract-config.outputs.cluster-image-registry-insecure }} - cluster-image-namespace: - description: "The namespace to install the camel-k images" - value: ${{ steps.extract-config.outputs.cluster-image-namespace }} - cluster-kube-admin-user-ctx: - description: "The context of the kube admin user" - value: ${{ steps.extract-config.outputs.cluster-kube-admin-user-ctx }} - cluster-kube-user-ctx: - description: "The context of the kube user" - value: ${{ steps.extract-config.outputs.cluster-kube-user-ctx }} - cluster-has-olm: - description: "Does the cluster have OLM" - value: ${{ steps.extract-config.outputs.cluster-has-olm }} - cluster-global-operator-namespace: - description: "Namespace to install a global operator" - value: ${{ steps.extract-config.outputs.cluster-global-operator-namespace}} diff --git a/.github/actions/kamel-config-cluster-kind/extract-config.sh b/.github/actions/kamel-config-cluster-kind/extract-config.sh deleted file mode 100755 index 5b7e8dd782..0000000000 --- a/.github/actions/kamel-config-cluster-kind/extract-config.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Outputs the kind config to output variables -# -#### - -set -e - -# Kind has the same interface for both pushing and pulling images in its registry -echo "cluster-image-registry-push-host=${KIND_REGISTRY}" >> $GITHUB_OUTPUT -echo "cluster-image-registry-pull-host=${KIND_REGISTRY}" >> $GITHUB_OUTPUT -echo "cluster-image-registry-insecure=$(echo true)" >> $GITHUB_OUTPUT - -echo "cluster-global-operator-namespace=$(echo default)" >> $GITHUB_OUTPUT - -# -# Export the context used for admin and user -# Since kind has no rbac switched on then these can be the same -# -echo "cluster-kube-admin-user-ctx=$(kubectl config current-context)" >> $GITHUB_OUTPUT -echo "cluster-kube-user-ctx=$(kubectl config current-context)" >> $GITHUB_OUTPUT - -# Set the image namespace -echo "cluster-image-namespace=$(echo apache)" >> $GITHUB_OUTPUT - -# -# cluster-catalog-source-namespace intentionally blank as OLM not routinely installed -# upgrade tests will install their own catalog-source -# - -# -# Export the flag for olm capability -# -echo "cluster-has-olm=$(echo false)" >> $GITHUB_OUTPUT diff --git a/.github/actions/kamel-config-cluster/action.yaml b/.github/actions/kamel-config-cluster/action.yaml deleted file mode 100644 index 37d3dd0b16..0000000000 --- a/.github/actions/kamel-config-cluster/action.yaml +++ /dev/null @@ -1,198 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: kamel-config-cluster -description: 'Delegates to respective cluster action depending on type of requested cluster' - -inputs: - cluster-type: - description: 'The type of cluster required: [kind, custom] - optional (see Override Cluster Type step)' - required: false - cluster-config-data: - description: 'Variables for the cluster configuration - required for custom cluster type only optional (see Override Cluster Type step)' - required: false - cluster-kube-config-data: - description: 'Base16 encoded kube config - required for custom cluster type only' - required: false - require-olm: - description: 'If OLM is not available by default ensure that it is installed' - default: false - -runs: - using: "composite" - steps: - - name: Override cluster type if there is a custom cluster-config - shell: bash - run: | - if [ -n "${{ inputs.cluster-config-data }}" ]; then - # - # Have custom cluster-config-data so override cluster-type - # - echo "Have cluster-config-data so setting cluster-type to custom" - calculated_cluster_type=custom - elif [ -n "${{ inputs.cluster-type }}" ]; then - echo "Cluster-type specified so setting accordingly" - calculated_cluster_type=${{ inputs.cluster-type }} - else - echo "Info: No cluster configuration supplied. Default to kind." - calculated_cluster_type=kind - fi - - echo "CLUSTER_TYPE -> ${calculated_cluster_type}" - echo "CLUSTER_TYPE=${calculated_cluster_type}" >> $GITHUB_ENV - - - id: execute-kind - name: Maybe Execute Kind Cluster - uses: ./.github/actions/kamel-config-cluster-kind - if: ${{ env.CLUSTER_TYPE == 'kind' }} - - - id: execute-custom - name: Maybe Execute Custom Cluster - uses: ./.github/actions/kamel-config-cluster-custom - if: ${{ env.CLUSTER_TYPE == 'custom' }} - with: - cluster-config-data: ${{ inputs.cluster-config-data }} - cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }} - - - id: execute-invalid - name: Execute Invalid Cluster - if: ${{ env.CLUSTER_TYPE != 'kind' && env.CLUSTER_TYPE != 'custom' }} - shell: bash - run: | - echo "Error: Unrecognised cluster request for type of cluster. Should be kind or custom." - exit 1 - - - id: cluster-config - name: Extract the config from the cluster - shell: bash - run: | - case ${{ env.CLUSTER_TYPE }} in - kind) - # Does not require cluster-catalog-source-namespace - # Does not require global operator name or namespace ... yet - ./.github/actions/kamel-config-cluster/output-config.sh \ - -a "${{ steps.execute-kind.outputs.cluster-kube-admin-user-ctx }}" \ - -g "${{ steps.execute-kind.outputs.cluster-global-operator-namespace }}" \ - -n "${{ steps.execute-kind.outputs.cluster-image-namespace }}" \ - -o "${{ steps.execute-kind.outputs.cluster-has-olm }}" \ - -p "${{ steps.execute-kind.outputs.cluster-image-registry-push-host }}" \ - -q "${{ steps.execute-kind.outputs.cluster-image-registry-pull-host }}" \ - -s "${{ steps.execute-kind.outputs.cluster-image-registry-insecure }}" \ - -u "${{ steps.execute-kind.outputs.cluster-kube-user-ctx }}" - ;; - custom) - ./.github/actions/kamel-config-cluster/output-config.sh \ - -a "${{ steps.execute-custom.outputs.cluster-kube-admin-user-ctx }}" \ - -b "${{ steps.execute-custom.outputs.cluster-catalog-source-name }}" \ - -c "${{ steps.execute-custom.outputs.cluster-catalog-source-namespace }}" \ - -g "${{ steps.execute-custom.outputs.cluster-global-operator-namespace }}" \ - -n "${{ steps.execute-custom.outputs.cluster-image-namespace }}" \ - -o "${{ steps.execute-custom.outputs.cluster-has-olm }}" \ - -p "${{ steps.execute-custom.outputs.cluster-image-registry-push-host }}" \ - -q "${{ steps.execute-custom.outputs.cluster-image-registry-pull-host }}" \ - -s "${{ steps.execute-custom.outputs.cluster-image-registry-insecure }}" \ - -u "${{ steps.execute-custom.outputs.cluster-kube-user-ctx }}" - ;; - esac - - # - # Install OLM if required - # - - id: install-olm - name: Install OLM - shell: bash - run: | - if [ "${{ steps.cluster-config.outputs.cluster-has-olm }}" == "true" ]; then - # OLM already installed by default - echo "OLM already available in cluster" - echo "cluster-has-olm=${{ steps.cluster-config.outputs.cluster-has-olm }}" >> $GITHUB_OUTPUT - exit 0 - fi - - if [ "${{ inputs.require-olm }}" != "true" ]; then - # OLM not explicitly requested - echo "OLM not explicity required for testing" - echo "cluster-has-olm=$(echo false)" >> $GITHUB_OUTPUT - exit 0 - fi - - # - # Get current context - # - echo "Cache current kube context" - ctx=$(kubectl config current-context) - - # - # Need to be admin so switch to the admin context - # - echo "Change to kube admin context" - kubectl config use-context "${{ steps.cluster-config.outputs.cluster-kube-admin-user-ctx }}" - - set +e - echo "Check if OLM is already installed" - kubectl get deployments --all-namespaces | grep olm-operator - if [ $? != 0 ]; then - set -e - echo "OLM not detected on cluster so downloading and installing" - kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.24.0/crds.yaml - # wait for a while to be sure CRDs are installed - sleep 1 - kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.24.0/olm.yaml - fi - set -e - - # - # Change back to original context - # - echo "Return to original kube context" - kubectl config use-context "${ctx}" - - echo "cluster-has-olm=$(echo true)" >> $GITHUB_OUTPUT - - echo "Complete" - -outputs: - cluster-image-registry-push-host: - description: "The image registry to which to push images" - value: ${{ steps.cluster-config.outputs.cluster-image-registry-push-host }} - cluster-image-registry-pull-host: - description: "The image registry from which to pull images" - value: ${{ steps.cluster-config.outputs.cluster-image-registry-pull-host }} - cluster-image-registry-insecure: - description: "Whether the pull registry is insecure" - value: ${{ steps.cluster-config.outputs.cluster-image-registry-insecure }} - cluster-catalog-source-name: - description: "The name of the OLM catalog source to install" - value: ${{ steps.cluster-config.outputs.cluster-catalog-source-name }} - cluster-catalog-source-namespace: - description: "The namespace in which to install the OLM catalog source" - value: ${{ steps.cluster-config.outputs.cluster-catalog-source-namespace }} - cluster-image-namespace: - description: "The namespace to install the camel-k images" - value: ${{ steps.cluster-config.outputs.cluster-image-namespace }} - cluster-kube-admin-user-ctx: - description: "The context of the kube admin user" - value: ${{ steps.cluster-config.outputs.cluster-kube-admin-user-ctx }} - cluster-kube-user-ctx: - description: "The context of the kube user" - value: ${{ steps.cluster-config.outputs.cluster-kube-user-ctx }} - cluster-global-operator-namespace: - description: "Namespace to install a global operator" - value: ${{ steps.cluster-config.outputs.cluster-global-operator-namespace }} - cluster-has-olm: - description: "Does the cluster have OLM" - value: ${{ steps.install-olm.outputs.cluster-has-olm }} diff --git a/.github/actions/kamel-config-cluster/change-context.sh b/.github/actions/kamel-config-cluster/change-context.sh deleted file mode 100755 index 2be37527ba..0000000000 --- a/.github/actions/kamel-config-cluster/change-context.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Change to the provided context -# -#### - -set -e - -while getopts ":a:" opt; do - case "${opt}" in - a) - KUBE_CTX=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -if [ -z "${KUBE_CTX}" ]; then - echo "Error: kube-user-ctx not defined" - exit 1 -fi - -# -# Switch to the new context -# -kubectl config use-context "${KUBE_CTX}" diff --git a/.github/actions/kamel-config-cluster/output-config.sh b/.github/actions/kamel-config-cluster/output-config.sh deleted file mode 100755 index 95e02b20d2..0000000000 --- a/.github/actions/kamel-config-cluster/output-config.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/bash - -# --------------------------------------------------------------------------- -# 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. -# --------------------------------------------------------------------------- - -#### -# -# Outputs the config to cluster output variables -# -#### - -set -e - -while getopts ":a:b:c:g:n:o:p:q:s:u:" opt; do - case "${opt}" in - a) - ADMIN_USER_CTX=${OPTARG} - ;; - b) - CATALOG_SOURCE_NAME=${OPTARG} - ;; - c) - CATALOG_SOURCE_NAMESPACE=${OPTARG} - ;; - g) - GLOBAL_OPERATOR_NAMESPACE=${OPTARG} - ;; - n) - IMAGE_NAMESPACE=${OPTARG} - ;; - o) - HAS_OLM=${OPTARG} - ;; - p) - PUSH_HOST=${OPTARG} - ;; - q) - PULL_HOST=${OPTARG} - ;; - s) - INSECURE=${OPTARG} - ;; - u) - USER_CTX=${OPTARG} - ;; - :) - echo "ERROR: Option -$OPTARG requires an argument" - exit 1 - ;; - \?) - echo "ERROR: Invalid option -$OPTARG" - exit 1 - ;; - esac -done -shift $((OPTIND-1)) - -echo "cluster-image-registry-push-host=${PUSH_HOST}" >> $GITHUB_OUTPUT -echo "cluster-image-registry-pull-host=${PULL_HOST}" >> $GITHUB_OUTPUT -echo "cluster-image-registry-insecure=${INSECURE}" >> $GITHUB_OUTPUT -echo "cluster-kube-admin-user-ctx=${ADMIN_USER_CTX}" >> $GITHUB_OUTPUT -echo "cluster-kube-user-ctx=${USER_CTX}" >> $GITHUB_OUTPUT - -# Set the image namespace -echo "cluster-image-namespace=${IMAGE_NAMESPACE}" >> $GITHUB_OUTPUT - -# Set the catalog source -echo "cluster-catalog-source-name=${CATALOG_SOURCE_NAME}" >> $GITHUB_OUTPUT -echo "cluster-catalog-source-namespace=${CATALOG_SOURCE_NAMESPACE}" >> $GITHUB_OUTPUT - -# -# Export the flag for olm capability -# -echo "cluster-has-olm=${HAS_OLM}" >> $GITHUB_OUTPUT - -# -# Export the flag for testing using global operator -# -echo "cluster-global-operator-namespace=${GLOBAL_OPERATOR_NAMESPACE}" >> $GITHUB_OUTPUT diff --git a/.github/actions/kamel-prepare-env/action.yml b/.github/actions/kamel-prepare-env/action.yml deleted file mode 100644 index b6e736a0ad..0000000000 --- a/.github/actions/kamel-prepare-env/action.yml +++ /dev/null @@ -1,120 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: kamel-prepare-env -description: 'Initialise the test environment with tools. (Will only run once per workflow)' - -runs: - using: "composite" - steps: - - name: Set Env Vars - shell: bash - run: | - if [ "$RUNNER_OS" == "Linux" ] || [ "$RUNNER_OS" == "macOS" ]; then - SUDO=sudo - fi - - echo "SUDO=${SUDO}" >> $GITHUB_ENV - # - # This is a docker action so its pre-builds the image prior to - # running it. The building occurs prior to all steps regardless - # of where its located to run. Therefore, it must be run prior to - # clean-up since that step removes all docker image in order to - # claim back as much space as possible. - # - - name: Cleanup - shell: bash - if: ${{ env.KAMEL_PREPARE_ENV != 'true' }} - run: | - echo "Initial status:" - df -h - - if [ "$RUNNER_OS" == "Linux" ]; then - echo "Cleaning up resources:" - ${{ env.SUDO }} swapoff -a - ${{ env.SUDO }} rm -f /swapfile - ${{ env.SUDO }} apt clean - ${{ env.SUDO }} rm -rf /usr/share/dotnet - ${{ env.SUDO }} rm -rf /opt/ghc - ${{ env.SUDO }} rm -rf "/usr/local/share/boost" - ${{ env.SUDO }} rm -rf "$AGENT_TOOLSDIRECTORY" - fi - if [ -x "$(command -v docker)" ]; then - df -kh - docker rmi $(docker image ls -aq) || true # Don't fail if image is not present - df -kh - fi - - echo "Final status:" - df -h - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - if: ${{ env.ENV_PREPARED != 'true' }} - with: - java-version: '17' - distribution: 'temurin' - - - name: Set up Go - uses: actions/setup-go@v5 - if: ${{ env.KAMEL_PREPARE_ENV != 'true' }} - with: - go-version-file: 'go.mod' - check-latest: true - - - name: (Re-)install kustomize - shell: bash - if: ${{ env.KAMEL_PREPARE_ENV != 'true' }} - run: | - # reinstall kustomize to be always on the same version - set +e - $(which kustomize &> /dev/null) - if [ "$?" == "0" ]; then - ${{ env.SUDO }} rm $(which kustomize) - fi - set -e - make kustomize - - # Add kustomize to PATH - echo "${{ env.GOPATH }}/bin" >> $GITHUB_PATH - which kustomize || { echo 'kustomize not found' ; exit 1; } - - # - # Install a version of kubectl for generic access to cluster - # - - id: install-kubectl - uses: azure/setup-kubectl@v4 - if: ${{ env.KAMEL_PREPARE_ENV != 'true' }} - - - id: install-realpath - shell: bash - if: ${{ env.KAMEL_PREPARE_ENV != 'true' }} - run : | - if [ "$RUNNER_OS" == "macOS" ] && ! [ -x "$(command -v realpath)" ]; then - echo 'Installing realpath...' - brew install coreutils - fi - - - id: complete-action - name: Environment Prepared - shell: bash - if: ${{ env.KAMEL_PREPARE_ENV != 'true' }} - run : | - # - # Avoid preparing the environment repeatedly - # - echo "KAMEL_PREPARE_ENV=true" >> $GITHUB_ENV diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4671baa0c7..a3c18997bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,6 +70,6 @@ jobs: persist-credentials: false submodules: recursive - name: Execute Build (make) - uses: ./.github/actions/e2e-build + uses: ./.github/actions/build with: artifact-name: pr diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 85707b34af..2b576b15ed 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -60,35 +60,46 @@ concurrency: jobs: common-it: runs-on: ubuntu-latest - steps: - - name: Checkout code uses: actions/checkout@v4 with: persist-credentials: false submodules: recursive - - name: Common tests - uses: ./.github/actions/e2e-common - with: - cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }} - cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }} + - name: Infra setting + uses: ./.github/actions/infra-setting - common-it-advanced: - runs-on: ubuntu-latest + - name: Install operator + shell: bash + run: | + kubectl create ns camel-k + make install-k8s-global + kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=60s - steps: + - name: Run test + shell: bash + run: | + DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-common + advanced-it: + runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v4 with: persist-credentials: false submodules: recursive - - name: Common advanced tests - uses: ./.github/actions/e2e-common - with: - cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }} - cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }} - with-custom-install: 'true' + - name: Infra setting + uses: ./.github/actions/infra-setting + + - name: Install CRDs + shell: bash + run: | + make install-crds + + - name: Run test + shell: bash + run: | + DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-advanced diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 46f891af41..c605de9160 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -66,6 +66,9 @@ jobs: persist-credentials: false submodules: recursive + - name: Infra setting + uses: ./.github/actions/infra-setting + - name: Install Helm shell: bash run: | @@ -75,8 +78,17 @@ jobs: sudo apt-get update sudo apt-get install helm - - name: Install and upgrade - uses: ./.github/actions/e2e-install - with: - cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }} - cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }} + - name: Build Helm chart + shell: bash + run: | + make release-helm + + - name: Build OLM bundle + shell: bash + run: | + make bundle-build + + - name: Run test + shell: bash + run: | + DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-install diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml index e313b263b1..7df43db32c 100644 --- a/.github/workflows/knative.yml +++ b/.github/workflows/knative.yml @@ -64,8 +64,22 @@ jobs: persist-credentials: false submodules: recursive - - name: Knative Tests - uses: ./.github/actions/e2e-knative - with: - cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }} - cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }} + - name: Infra setting + uses: ./.github/actions/infra-setting + + - name: Install Knative + shell: bash + run: | + ./e2e/knative/files/setup.sh + + - name: Install operator + shell: bash + run: | + kubectl create ns camel-k + make install-k8s-global + kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=60s + + - name: Run test + shell: bash + run: | + DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-knative diff --git a/.github/workflows/native.yml b/.github/workflows/native.yml index a1d68f8f7d..85202aa574 100644 --- a/.github/workflows/native.yml +++ b/.github/workflows/native.yml @@ -70,9 +70,23 @@ jobs: persist-credentials: false submodules: recursive - - name: Quarkus Native test - uses: ./.github/actions/e2e-native - with: - cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }} - cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }} + - name: Infra setting + uses: ./.github/actions/infra-setting + + - name: Install Knative + shell: bash + run: | + ./e2e/knative/files/setup.sh + + - name: Install operator + shell: bash + run: | + kubectl create ns camel-k + make install-k8s-global + kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=60s + + - name: Run test + shell: bash + run: | + DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-quarkus-native diff --git a/.github/workflows/nightly-latest-runtime.yml b/.github/workflows/nightly-latest-runtime.yml index c69bdb8ddb..ca926d68c6 100644 --- a/.github/workflows/nightly-latest-runtime.yml +++ b/.github/workflows/nightly-latest-runtime.yml @@ -57,9 +57,17 @@ jobs: run: | make update-default-camel - - name: Run smoke tests - uses: ./.github/actions/e2e-common - with: - cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }} - cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }} - smoke-test-only: 'true' + - name: Infra setting + uses: ./.github/actions/infra-setting + + - name: Install operator + shell: bash + run: | + kubectl create ns camel-k + make install-k8s-global + kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=60s + + - name: Run test + shell: bash + run: | + DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-smoke diff --git a/.github/workflows/nightly-native-test.yml b/.github/workflows/nightly-native-test.yml deleted file mode 100644 index 498ed97852..0000000000 --- a/.github/workflows/nightly-native-test.yml +++ /dev/null @@ -1,56 +0,0 @@ -# --------------------------------------------------------------------------- -# 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: Nightly Quarkus native checks - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CAMEL_K_TEST_TIMEOUT_SHORT: 5m - CAMEL_K_TEST_TIMEOUT_MEDIUM: 10m - CAMEL_K_TEST_TIMEOUT_LONG: 15m - CAMEL_K_TEST_TIMEOUT_VERY_LONG: 60m - -# We can disable as at the moment we're running this check on each PR and push -# We keep the source in case it is required to be enabled again in the future. -on: - schedule: - - cron: '45 3 * * *' - workflow_dispatch: - -jobs: - native: - strategy: - fail-fast: false - matrix: - ref-branch: [main, release-2.3.x] - - if: github.repository == 'apache/camel-k' - runs-on: ubuntu-latest - steps: - - - name: "Checkout code" - uses: actions/checkout@v4 - with: - ref: ${{ matrix.ref-branch }} - persist-credentials: false - submodules: recursive - - - name: Quarkus native test - uses: ./.github/actions/e2e-native - with: - cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }} - cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }} diff --git a/.github/workflows/telemetry.yml b/.github/workflows/telemetry.yml index 26eabe1988..97fc811d29 100644 --- a/.github/workflows/telemetry.yml +++ b/.github/workflows/telemetry.yml @@ -64,8 +64,23 @@ jobs: persist-credentials: false submodules: recursive - - name: Execute Tests - uses: ./.github/actions/e2e-telemetry + - name: Infra setting + uses: ./.github/actions/infra-setting + + - name: Install operator + shell: bash + run: | + kubectl create ns camel-k + make install-k8s-global + kubectl wait --for=jsonpath='{.status.phase}'=Ready itp camel-k -n camel-k --timeout=60s + + - name: Install OTLP Collector + uses: ./.github/actions/install-otlp-collector with: - cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }} - cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }} + otlp-collector-image-name: otel/opentelemetry-collector + otlp-collector-image-version: 0.102.0 + + - name: Run test + shell: bash + run: | + DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-telemetry diff --git a/e2e/install/helm/setup_test.go b/e2e/install/helm/setup_test.go index e69e4b4888..b6d5d2645c 100644 --- a/e2e/install/helm/setup_test.go +++ b/e2e/install/helm/setup_test.go @@ -47,7 +47,6 @@ func TestHelmInstallation(t *testing.T) { operatorID := "helm-ck" g.Expect(KAMEL_INSTALL_REGISTRY).NotTo(Equal("")) os.Setenv("CAMEL_K_TEST_MAKE_DIR", "../../../") - ExpectExecSucceed(t, g, Make(t, "release-helm")) ExpectExecSucceed(t, g, exec.Command( "helm",