From a5b5f9aa7487f24e6260e61f8bd0fabf3dcd87cd Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 14 Jan 2022 14:22:49 +0000
Subject: [PATCH 01/40] Refactors e2e testing to allow for platform delegation
* Allows a repo to select underlying platform, ie. kind, ocp3 or
custom, where latter is guided by secrets located in the private repo
* Refactors duplicate steps into actions so pairing down the content of the
workflow
* Utilises inputs and outputs to actions for action-action and action-workflow
comms
---
.github/.env | 1 +
.github/actions/action-dotenv-to-setenv | 1 +
.github/actions/conditional | 1 +
.../actions/kamel-build-bundle/action.yaml | 88 +++++++
.github/actions/kamel-build/action.yml | 77 ++++++
.../kamel-config-cluster-custom/action.yml | 131 +++++++++
.../kamel-config-cluster-kind/action.yml | 48 ++++
.../kamel-config-cluster-ocp3/action.yml | 192 ++++++++++++++
.../actions/kamel-config-cluster/action.yaml | 180 +++++++++++++
.../kamel-install-cluster-setup/action.yml | 54 ++++
.../actions/kamel-install-knative/action.yml | 63 +++++
.github/actions/kamel-prepare-env/action.yml | 105 ++++++++
.github/workflows/build.yml | 18 +-
.github/workflows/builder.yml | 87 +++---
.github/workflows/knative.yml | 249 +++++-------------
.github/workflows/kubernetes.yml | 85 ++----
.github/workflows/local.yml | 35 +--
.github/workflows/openshift.yml | 198 ++------------
.github/workflows/upgrade.yml | 125 +++------
.gitmodules | 8 +
script/Makefile | 3 +
21 files changed, 1159 insertions(+), 590 deletions(-)
create mode 100644 .github/.env
create mode 160000 .github/actions/action-dotenv-to-setenv
create mode 160000 .github/actions/conditional
create mode 100644 .github/actions/kamel-build-bundle/action.yaml
create mode 100644 .github/actions/kamel-build/action.yml
create mode 100644 .github/actions/kamel-config-cluster-custom/action.yml
create mode 100644 .github/actions/kamel-config-cluster-kind/action.yml
create mode 100644 .github/actions/kamel-config-cluster-ocp3/action.yml
create mode 100644 .github/actions/kamel-config-cluster/action.yaml
create mode 100644 .github/actions/kamel-install-cluster-setup/action.yml
create mode 100644 .github/actions/kamel-install-knative/action.yml
create mode 100644 .github/actions/kamel-prepare-env/action.yml
diff --git a/.github/.env b/.github/.env
new file mode 100644
index 0000000000..cd5940c1d9
--- /dev/null
+++ b/.github/.env
@@ -0,0 +1 @@
+TEST_PLATFORM_CLUSTER=kind
diff --git a/.github/actions/action-dotenv-to-setenv b/.github/actions/action-dotenv-to-setenv
new file mode 160000
index 0000000000..a6380f4d90
--- /dev/null
+++ b/.github/actions/action-dotenv-to-setenv
@@ -0,0 +1 @@
+Subproject commit a6380f4d905f42adb7c065db63e6d66d75b971ad
diff --git a/.github/actions/conditional b/.github/actions/conditional
new file mode 160000
index 0000000000..3fce4b7a31
--- /dev/null
+++ b/.github/actions/conditional
@@ -0,0 +1 @@
+Subproject commit 3fce4b7a3171a839b482306f9fd3aba0c2112a24
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
new file mode 100644
index 0000000000..19a3c95869
--- /dev/null
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -0,0 +1,88 @@
+# ---------------------------------------------------------------------------
+# 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:
+ description: 'Location of image registry to push bundle'
+ required: true
+ 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
+
+runs:
+ using: "composite"
+ steps:
+
+ - id: build-bundle-image
+ name: Build Operator bundle
+ shell: bash
+ run: |
+ 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
+
+ # replace image
+ $(cd config/manifests && kustomize edit set image "docker.io/apache/camel-k=${{ inputs.local-image-name }}:${{ inputs.local-image-version }}")
+
+ # Patch CSV with the 'replaces' field to define the upgrade graph
+ # Use sed as the manifest/bases file is not included in the kustomize config
+ BASE_VERSION=$(echo ${{ inputs.local-image-version }} | grep -Po "\d.\d.\d")
+ sed -i "/ version: ${BASE_VERSION}/a \ \ replaces: camel-k-operator.v$(make get-last-released-version)" config/manifests/bases/camel-k.clusterserviceversion.yaml
+
+ export CUSTOM_IMAGE=${{ inputs.local-image-name }}
+ export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry }}/apache/camel-k-bundle:${{ inputs.local-image-version }}
+ export PREV_XY_CHANNEL=stable-$(make get-last-released-version | grep -Po "\d.\d")
+ echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
+ export NEW_XY_CHANNEL=stable-$(make get-version | grep -Po "\d.\d")
+ echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV
+ make bundle-build BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" CHANNELS="${NEW_XY_CHANNEL}"
+ docker push ${LOCAL_IMAGE_BUNDLE}
+
+ echo "::set-output name=local-image-bundle::$(echo ${LOCAL_IMAGE_BUNDLE})"
+
+ - id: build-index-image
+ name: Create New Index Image
+ shell: bash
+ run: |
+ export LOCAL_IIB=${{ inputs.image-registry }}/apache/camel-k-iib:${{ inputs.local-image-version }}
+ if ! command -v opm &> /dev/null
+ then
+ echo "opm could not be found. Has it not been installed?"
+ exit 1
+ fi
+
+ opm index add --bundles ${{ steps.build-bundle-image.outputs.local-image-bundle }} -c docker --from-index quay.io/operatorhubio/catalog:latest --tag ${LOCAL_IIB} --skip-tls
+ docker push ${LOCAL_IIB}
+
+ echo "::set-output name=local-image-bundle-index::$(echo ${LOCAL_IIB})"
+
+outputs:
+ local-image-bundle:
+ description: "Reference of the camel-k metadata bundle image"
+ value: ${{ steps.build-bundle-image.outputs.local-image-bundle }}
+ local-image-bundle-index:
+ description: "Reference of the camel-k metadata bundle index image"
+ value: ${{ steps.build-index-image.outputs.local-image-bundle-index }}
diff --git a/.github/actions/kamel-build/action.yml b/.github/actions/kamel-build/action.yml
new file mode 100644
index 0000000000..7414da1413
--- /dev/null
+++ b/.github/actions/kamel-build/action.yml
@@ -0,0 +1,77 @@
+# ---------------------------------------------------------------------------
+# 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 binary'
+
+inputs:
+ image-registry:
+ description: 'Location of image registry if required'
+ required: false
+ make-rules:
+ description: 'Override the default make rules'
+ required: false
+ install-kamel-binary:
+ description: 'Install the kamel binary onto the path'
+ required: false
+ default: true
+
+runs:
+ using: "composite"
+ steps:
+ - id: build-operator
+ name: Build Kamel Operator
+ shell: bash
+ run: |
+ echo "Build Kamel from source"
+
+ if [ -n "${{ inputs.image-registry }}" ]; then
+ export CUSTOM_IMAGE=${{ inputs.image-registry }}/apache/camel-k
+ echo "::set-output name=custom-img::$(echo ${CUSTOM_IMAGE})"
+ fi
+
+ RULES="PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images"
+ if [ -n "${{ inputs.make-rules }}" ]; then
+ RULES="${{ inputs.make-rules }}"
+ fi
+
+ if [ -n "${{ inputs.image-registry }}" ]; then
+ RULES="${RULES} images-push"
+ fi
+
+ make ${RULES}
+
+ if [ "${{ inputs.install-kamel-binary }}" == "true" ]; then
+ echo "Moving kamel binary to /usr/local/bin"
+ sudo mv ./kamel /usr/local/bin
+ echo "Kamel version installed: $(kamel version)"
+ fi
+
+ echo "::set-output name=local-img-name::$(make get-image)"
+ echo "::set-output name=local-img-version::$(make get-version)"
+
+
+outputs:
+ custom-image:
+ description: "Reference of the camel-k image"
+ value: ${{ steps.build-operator.outputs.custom-img }}
+ local-image-name:
+ description: "Reference of the camel-k image"
+ value: ${{ steps.build-operator.outputs.local-img-name }}
+ local-image-version:
+ description: "Reference of the camel-k image version"
+ value: ${{ steps.build-operator.outputs.local-img-version }}
diff --git a/.github/actions/kamel-config-cluster-custom/action.yml b/.github/actions/kamel-config-cluster-custom/action.yml
new file mode 100644
index 0000000000..46bbe5e388
--- /dev/null
+++ b/.github/actions/kamel-config-cluster-custom/action.yml
@@ -0,0 +1,131 @@
+# ---------------------------------------------------------------------------
+# 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 acessing a custom kubernetes cluster'
+
+runs:
+ using: "composite"
+ steps:
+ - id: connect-cluster
+ name: Connect to cluster
+ shell: bash
+ run: |
+ if [ -z "${KUBE_CONFIG_DATA}" ]; then
+ echo "Error: KUBE_CONFIG_DATA secret cannot be found"
+ exit 1
+ fi
+
+ if [ -z "${KUBE_ADMIN_USER_CTX}" ]; then
+ echo "Error: KUBE_ADMIN_USER_CTX secret cannot be found"
+ exit 1
+ fi
+
+ if [ -z "${KUBE_USER_CTX}" ]; then
+ echo "Error: KUBE_USER_CTX secret cannot be found"
+ exit 1
+ fi
+
+ # IMAGE_REGISTRY & IMAGE_REGISTRY_INSECURE are optional
+
+ # 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 "${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
+
+ # Export the context variables
+ echo "KUBE_ADMIN_USER_CTX=${KUBE_ADMIN_USER_CTX}" >> $GITHUB_ENV
+ echo "KUBE_USER_CTX=${KUBE_USER_CTX}" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY=${IMAGE_REGISTRY}" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_INSECURE=${IMAGE_REGISTRY_INSECURE}" >> $GITHUB_ENV
+
+ - id: info
+ name: Info
+ shell: bash
+ run: |
+ kubectl describe nodes
+
+ - id: configure-developer-user
+ name: Configure Developer User
+ shell: bash
+ run: |
+ # Aggregate pod eviction permission to the default admin role
+ cat <> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_INSECURE=true" >> $GITHUB_ENV
+
+ #
+ # Export the context used for admin and user
+ # Since kind has no rbac switched on then these can be the same
+ #
+ echo "KUBE_ADMIN_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
+ echo "KUBE_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster-ocp3/action.yml b/.github/actions/kamel-config-cluster-ocp3/action.yml
new file mode 100644
index 0000000000..8d6bfb9c66
--- /dev/null
+++ b/.github/actions/kamel-config-cluster-ocp3/action.yml
@@ -0,0 +1,192 @@
+# ---------------------------------------------------------------------------
+# 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-ocp3
+description: 'Provides configuration for making available kubernetes cluster on ocp3'
+
+runs:
+ using: "composite"
+ steps:
+ - name: Get OpenShift Client (oc)
+ shell: bash
+ run: |
+ export OPENSHIFT_VERSION=v3.11.0
+ export OPENSHIFT_COMMIT=0cbc58b
+ export MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
+
+ sudo rm -f /etc/resolv.conf
+ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
+ sudo sh -c 'echo "DNS=8.8.8.8 4.4.4.4" >> /etc/systemd/resolved.conf'
+ sudo service systemd-resolved restart
+
+ # set docker0 to promiscuous mode
+ sudo ip link set docker0 promisc on
+
+ # Download and install the oc binary
+ sudo mount --make-shared /
+
+ sudo service docker stop
+ sudo echo '{"insecure-registries": ["172.30.0.0/16"]}' | sudo tee /etc/docker/daemon.json > /dev/null
+ sudo service docker start
+
+ DOWNLOAD_URL=https://github.com/openshift/origin/releases/download/$OPENSHIFT_VERSION/openshift-origin-client-tools-$OPENSHIFT_VERSION-$OPENSHIFT_COMMIT-linux-64bit.tar.gz
+ wget -O client.tar.gz ${DOWNLOAD_URL}
+ tar xvzOf client.tar.gz > oc.bin
+ sudo mv oc.bin /usr/local/bin/oc
+ sudo chmod 755 /usr/local/bin/oc
+
+ - id: start-openshift
+ name: Start OpenShift Cluster
+ shell: bash
+ run: |
+ # Figure out this host's IP address
+ IP_ADDR="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)"
+
+ # Setup cluster dir
+ sudo mkdir -p /home/runner/lib/oc
+ sudo chmod 777 /home/runner/lib/oc
+ cd /home/runner/lib/oc
+
+ # Start OpenShift
+ oc cluster up --public-hostname=$IP_ADDR --enable=persistent-volumes,registry,router
+ oc login -u system:admin
+
+ # Export the context used for admin login
+ echo "KUBE_ADMIN_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
+
+ # Wait until we have a ready node in openshift
+ TIMEOUT=0
+ TIMEOUT_COUNT=60
+ until [ $TIMEOUT -eq $TIMEOUT_COUNT ]; do
+ if [ -n "$(oc get nodes | grep Ready)" ]; then
+ break
+ fi
+ echo "openshift is not up yet"
+ TIMEOUT=$((TIMEOUT+1))
+ sleep 5
+ done
+
+ if [ $TIMEOUT -eq $TIMEOUT_COUNT ]; then
+ echo "Failed to start openshift"
+ exit 1
+ fi
+
+ echo "openshift is deployed and reachable"
+
+ - id: info
+ name: Info
+ shell: bash
+ run: |
+ oc describe nodes
+
+ - id: configure-developer-user
+ name: Configure Developer User
+ shell: bash
+ run: |
+ # Aggregate pod eviction permission to the default admin role
+ cat <> $GITHUB_ENV
+
+
+ - id: extract-kube-config
+ shell: bash
+ run: |
+ echo "IMAGE_REGISTRY=" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_INSECURE=false" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster/action.yaml b/.github/actions/kamel-config-cluster/action.yaml
new file mode 100644
index 0000000000..2ff0b64ab9
--- /dev/null
+++ b/.github/actions/kamel-config-cluster/action.yaml
@@ -0,0 +1,180 @@
+# ---------------------------------------------------------------------------
+# 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 platform'
+
+inputs:
+ cluster-type:
+ description: 'The type of cluster required: [kind, ocp3, custom]'
+ required: true
+ default: 'kind'
+ kube-config-data:
+ description: 'The kube-config-data - required for custom config only'
+ required: false
+ kube-admin-user-ctx:
+ description: 'The kube-admin-user-ctx - required for custom config only'
+ required: false
+ kube-user-ctx:
+ description: 'The kube-user-ctx - required for custom config only'
+ required: false
+ image-registry:
+ description: 'The image-registry - required for custom config only'
+ required: false
+ image-registry-insecure:
+ description: 'The image-registry-insecure - required for custom config only'
+ required: false
+ opm:
+ description: 'Install opm alongside cluster for bundle-related operations'
+ required: false
+ default: false
+ olm:
+ description: 'Check for & install OLM alongside cluster for bundle-related operations'
+ required: false
+ default: false
+
+runs:
+ using: "composite"
+ steps:
+ #
+ # TODO
+ # Due to lack of if in steps, need to use conditional action which
+ # does not currently include output support so have to put all vars
+ # as environment vars. When either ChristopherHX or github support allow
+ # for alternative then update accordingly.
+ #
+ - id: execute-kind
+ name: Maybe Execute Kind Cluster
+ uses: ./.github/actions/conditional
+ with:
+ if: ${{ inputs.cluster-type == 'kind' }}
+ step: |
+ uses: ./.github/actions/kamel-config-cluster-kind
+
+ - id: execute-ocp3
+ name: Maybe Execute Minishift Cluster
+ uses: ./.github/actions/conditional
+ with:
+ if: ${{ inputs.cluster-type == 'ocp3' }}
+ step: |
+ uses: ./.github/actions/kamel-config-cluster-ocp3
+
+ - id: execute-custom
+ name: Maybe Execute Custom Cluster
+ uses: ./.github/actions/conditional
+ env:
+ KUBE_CONFIG_DATA: ${{ inputs.kube-config-data }}
+ KUBE_ADMIN_USER_CTX: ${{ inputs.kube-admin-user-ctx }}
+ KUBE_USER_CTX: ${{ inputs.kube-user-ctx }}
+ IMAGE_REGISTRY: ${{ inputs.image-registry }}
+ IMAGE_REGISTRY_INSECURE: ${{ inputs.image-registry-insecure }}
+ with:
+ if: ${{ inputs.cluster-type == 'custom' }}
+ step: |
+ uses: ./.github/actions/kamel-config-cluster-custom
+
+ - id: execute-invalid
+ name: Execute Invalid Cluster
+ uses: ./.github/actions/conditional
+ with:
+ if: ${{ inputs.cluster-type != 'kind' && inputs.cluster-type != 'ocp3' && inputs.cluster-type != 'custom' }}
+ step: |
+ shell: bash
+ run: |
+ echo "Error: Unrecognised platform request for type of cluster. Should be kind, ocp3 or custom."
+ exit 1
+
+ - id: platform-info
+ shell: bash
+ run: |
+ echo "::set-output name=registry::$(echo ${{ env.IMAGE_REGISTRY }})"
+ echo "::set-output name=registry-insecure::$(echo ${{ env.IMAGE_REGISTRY_INSECURE }})"
+ echo "::set-output name=kube-admin-user-ctx::$(echo ${{ env.KUBE_ADMIN_USER_CTX }})"
+ echo "::set-output name=kube-user-ctx::$(echo ${{ env.KUBE_USER_CTX }})"
+
+ #
+ # Install opm if required
+ #
+ - id: install-opm
+ name: Install opm if required
+ shell: bash
+ run: |
+ if [ "${{ inputs.opm }}" == "true" ]; then
+ curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.19.5/linux-amd64-opm -o opm
+ chmod +x opm
+ sudo mv opm /usr/local/bin/
+ fi
+
+ #
+ # Install OLM if required
+ #
+ - id: install-olm
+ name: Install OLM
+ shell: bash
+ run: |
+ if [ "${{ inputs.olm }}" != "true" ]; then
+ # OLM not required
+ echo "OLM not required"
+ 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.platform-info.outputs.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 apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.17.0/crds.yaml
+ # wait for a while to be sure CRDs are installed
+ sleep 1
+ kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.17.0/olm.yaml
+ fi
+ set -e
+
+ #
+ # Change back to original context
+ #
+ echo "Return to original kube context"
+ kubectl config use-context "${ctx}"
+
+ echo "Complete"
+
+outputs:
+ image-registry:
+ description: "Registry for storing images"
+ value: ${{ steps.platform-info.outputs.registry }}
+ image-registry-insecure:
+ description: "Whether the image registry require secure/authenticated access"
+ value: ${{ steps.platform-info.outputs.registry-insecure }}
+ kube-admin-user-ctx:
+ description: "The admin user context of the cluster"
+ value: ${{ steps.platform-info.outputs.kube-admin-user-ctx }}
+ kube-user-ctx:
+ description: "The user context of the cluster"
+ value: ${{ steps.platform-info.outputs.kube-user-ctx }}
diff --git a/.github/actions/kamel-install-cluster-setup/action.yml b/.github/actions/kamel-install-cluster-setup/action.yml
new file mode 100644
index 0000000000..e1ac5bbff1
--- /dev/null
+++ b/.github/actions/kamel-install-cluster-setup/action.yml
@@ -0,0 +1,54 @@
+# ---------------------------------------------------------------------------
+# 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-install-cluster-setup
+description: 'Execute kamel to install the cluster-level artifacts'
+
+inputs:
+ kube-admin-user-ctx:
+ description: "The administration user context of the cluster"
+ required: true
+
+runs:
+ using: "composite"
+ steps:
+ - id: execute-kamel
+ name: Install Camel-K Cluster Resources
+ shell: bash
+ run: |
+ #
+ # Get current context
+ #
+ ctx=$(kubectl config current-context)
+
+ #
+ # Need to be admin so switch to the admin context
+ #
+ kubectl config use-context "${{ inputs.kube-admin-user-ctx }}"
+
+ kamel install --cluster-setup
+
+ #
+ # Change back to original context
+ #
+ kubectl config use-context "${ctx}"
+
+ - id: post-execution
+ shell: bash
+ run: |
+ rm -f /tmp/config
+ export -n KUBECONFIG
diff --git a/.github/actions/kamel-install-knative/action.yml b/.github/actions/kamel-install-knative/action.yml
new file mode 100644
index 0000000000..4b33123607
--- /dev/null
+++ b/.github/actions/kamel-install-knative/action.yml
@@ -0,0 +1,63 @@
+# ---------------------------------------------------------------------------
+# 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-install-knative
+description: 'Install Knative artifacts'
+runs:
+ using: "composite"
+ steps:
+ - name: Install Knative
+ shell: bash
+ run: |
+ # Prerequisites
+ sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
+
+ export SERVING_VERSION=knative-v1.1.0
+ export EVENTING_VERSION=knative-v1.1.0
+ export KOURIER_VERSION=knative-v1.1.0
+
+ # Serving
+ kubectl apply --filename https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-crds.yaml
+ curl -L -s https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
+
+ # Kourier
+ kubectl apply --filename https://github.com/knative-sandbox/net-kourier/releases/download/$KOURIER_VERSION/kourier.yaml
+ kubectl patch configmap/config-network \
+ --namespace knative-serving \
+ --type merge \
+ --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
+
+ # Eventing
+ kubectl apply --filename https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-crds.yaml
+ curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
+
+ # Eventing channels
+ curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/in-memory-channel.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
+
+ # Eventing broker
+ curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/mt-channel-broker.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
+
+ # Eventing sugar controller for injection
+ kubectl apply -f https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-sugar-controller.yaml
+
+ # Wait for installation completed
+ echo "Waiting for all pods to be ready in kourier-system"
+ kubectl wait --for=condition=Ready pod --all -n kourier-system --timeout=60s
+ echo "Waiting for all pods to be ready in knative-serving"
+ kubectl wait --for=condition=Ready pod --all -n knative-serving --timeout=60s
+ echo "Waiting for all pods to be ready in knative-eventing"
+ kubectl wait --for=condition=Ready pod --all -n knative-eventing --timeout=60s
diff --git a/.github/actions/kamel-prepare-env/action.yml b/.github/actions/kamel-prepare-env/action.yml
new file mode 100644
index 0000000000..f1b5acd7f3
--- /dev/null
+++ b/.github/actions/kamel-prepare-env/action.yml
@@ -0,0 +1,105 @@
+# ---------------------------------------------------------------------------
+# 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'
+
+runs:
+ using: "composite"
+ steps:
+ #
+ # 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.
+ #
+ - id: read-env-file
+ uses: ./.github/actions/action-dotenv-to-setenv
+ with:
+ env-file: .github/.env
+
+ - name: Cleanup
+ shell: bash
+ run: |
+ ls -lart
+ echo "Initial status:"
+ df -h
+
+ if [ "$RUNNER_OS" == "Linux" ]; then
+ echo "Cleaning up resources:"
+ sudo swapoff -a
+ sudo rm -f /swapfile
+ sudo apt clean
+ sudo rm -rf /usr/share/dotnet
+ sudo rm -rf /opt/ghc
+ sudo rm -rf "/usr/local/share/boost"
+ sudo rm -rf "$AGENT_TOOLSDIRECTORY"
+ df -kh
+ docker rmi $(docker image ls -aq) || true # Don't fail if image is not present
+ df -kh
+ else
+ echo "OS $RUNNER_OS is not yet supported"
+ exit 1
+ fi
+
+ echo "Final status:"
+ df -h
+
+ - name: Set up JDK 11
+ uses: AdoptOpenJDK/install-jdk@v1
+ with:
+ version: "11"
+
+ - name: Set Go
+ uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
+ with:
+ go-version: 1.16.x
+
+ - name: (Re-)install kustomize
+ shell: bash
+ run: |
+ # reinstall kustomize to be always on the same version
+ sudo rm $(which kustomize)
+ 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@v1
+ with:
+ version: 'latest'
+
+ - id: report-platform
+ name: Report Platform
+ shell: bash
+ run : |
+ if [ -n "${{ env.TEST_PLATFORM_CLUSTER }}" ]; then
+ echo "::set-output name=platform::$(echo ${{ env.TEST_PLATFORM_CLUSTER }})"
+ else
+ echo "::set-output name=platform::$(echo kind)"
+ fi
+
+outputs:
+ cluster-platform:
+ description: "Preferred environment set by .env file (default 'kind')"
+ value: ${{ steps.report-platform.outputs.platform }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7831f9e58a..c8ceb9fbd6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -54,18 +54,19 @@ jobs:
# TODO: test an all the supported OS
# [ubuntu-20.04, macos-latest, windows-latest]
os: [ubuntu-20.04]
+
runs-on: ${{ matrix.os }}
steps:
- - name: Set up JDK 11
- uses: AdoptOpenJDK/install-jdk@v1
- with:
- version: "11"
- - name: Install Go
- uses: actions/setup-go@v1
- with:
- go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
+ with:
+ persist-credentials: false
+ submodules: recursive
+
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
+
- name: Cache modules
uses: actions/cache@v1
with:
@@ -73,5 +74,6 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
+
- name: Test
run: make
diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
index b520ff8a7e..f78cc67ce0 100644
--- a/.github/workflows/builder.yml
+++ b/.github/workflows/builder.yml
@@ -58,72 +58,53 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- - name: Cleanup
- run: |
- ls -lart
- echo "Initial status:"
- df -h
+ with:
+ persist-credentials: false
+ submodules: recursive
- echo "Cleaning up resources:"
- sudo swapoff -a
- sudo rm -f /swapfile
- sudo apt clean
- docker rmi $(docker image ls -aq)
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
- echo "Final status:"
- df -h
- - name: Set up JDK 11
- uses: AdoptOpenJDK/install-jdk@v1
+ - id: configure-platform
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
with:
- version: "11"
- - name: Set Go
- uses: actions/setup-go@v1
+ cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
+ kube-config-data: ${{ secrets.KUBE_CONFIG_DATA }}
+ kube-admin-user-ctx: ${{ secrets.KUBE_ADMIN_USER_CTX }}
+ kube-user-ctx: ${{ secrets.KUBE_USER_CTX }}
+ image-registry: ${{ secrets.IMAGE_REGISTRY }}
+ image-registry-insecure: ${{ secrets.IMAGE_REGISTRY_INSECURE }}
+
+
+ - id: build-kamel-binary
+ name: Build Kamel Binary
+ uses: ./.github/actions/kamel-build
with:
- go-version: 1.16.x
- - name: Kubernetes KinD Cluster
- uses: container-tools/kind-action@v1
+ image-registry: ${{ steps.configure-platform.outputs.image-registry }}
+
+ - name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
with:
- version: v0.11.0
- node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- - name: Info
- run: |
- kubectl cluster-info
- kubectl describe nodes
- - name: Build Operator
- run: |
- echo "Build project"
- export CUSTOM_IMAGE=${KIND_REGISTRY}/apache/camel-k
- echo "LOCAL_IMAGE_NAME=${CUSTOM_IMAGE}" >> $GITHUB_ENV
- echo "LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
- make PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images images-push
+ kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
- sudo mv ./kamel /usr/local/bin
- name: Run IT
- # Disable registry tests as not compatible with KinD
- #env:
- # TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
- # TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
- # TEST_GITHUB_PACKAGES_REPO: ${{ secrets.TEST_GITHUB_PACKAGES_REPO }}
- # TEST_GITHUB_PACKAGES_USERNAME: ${{ secrets.TEST_GITHUB_PACKAGES_USERNAME }}
- # TEST_GITHUB_PACKAGES_PASSWORD: ${{ secrets.TEST_GITHUB_PACKAGES_PASSWORD }}
env:
KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ matrix.publisher }}
run: |
- echo "Installing camel k cluster resources"
- kamel install --cluster-setup
-
- # Configure install options
- export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.LOCAL_IMAGE_VERSION }}
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
- export KAMEL_INSTALL_REGISTRY_INSECURE=true
+ # Cluster environment
+ export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
- export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
-
- # Configure test options
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+ # Test options
+ export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+ export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
+
# Then run integration tests
make test-builder
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index e333dbc1cc..950b1272e0 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -51,112 +51,53 @@ jobs:
test:
runs-on: ubuntu-20.04
steps:
+
- name: Checkout code
uses: actions/checkout@v2
- - name: Cleanup
- run: |
- ls -lart
- echo "Initial status:"
- df -h
-
- echo "Cleaning up resources:"
- sudo swapoff -a
- sudo rm -f /swapfile
- sudo apt clean
- sudo rm -rf /usr/share/dotnet
- sudo rm -rf /opt/ghc
- sudo rm -rf "/usr/local/share/boost"
- sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- docker rmi $(docker image ls -aq)
-
- echo "Final status:"
- df -h
- - name: Set up JDK 11
- uses: AdoptOpenJDK/install-jdk@v1
with:
- version: "11"
- - name: Set Go
- uses: actions/setup-go@v1
- with:
- go-version: 1.16.x
- - name: Kubernetes KinD Cluster
- uses: container-tools/kind-action@v1
- with:
- version: v0.11.0
- node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- - name: Info
- run: |
- kubectl version
- kubectl cluster-info
- kubectl describe nodes
- - name: Install Knative
- run: |
- # Prerequisites
- sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
-
- export SERVING_VERSION=knative-v1.1.0
- export EVENTING_VERSION=knative-v1.1.0
- export KOURIER_VERSION=knative-v1.1.0
-
- # Serving
- kubectl apply --filename https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-crds.yaml
- curl -L -s https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
-
- # Kourier
- kubectl apply --filename https://github.com/knative-sandbox/net-kourier/releases/download/$KOURIER_VERSION/kourier.yaml
- kubectl patch configmap/config-network \
- --namespace knative-serving \
- --type merge \
- --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
-
- # Eventing
- kubectl apply --filename https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-crds.yaml
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
+ persist-credentials: false
+ submodules: recursive
- # Eventing channels
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/in-memory-channel.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
- # Eventing broker
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/mt-channel-broker.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
+ - id: configure-platform
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
+ with:
+ cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
- # Eventing sugar controller for injection
- kubectl apply -f https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-sugar-controller.yaml
+ - name: Install Knative
+ uses: ./.github/actions/kamel-install-knative
- # Wait for installation completed
- echo "Waiting for all pods to be ready in kourier-system"
- kubectl wait --for=condition=Ready pod --all -n kourier-system --timeout=60s
- echo "Waiting for all pods to be ready in knative-serving"
- kubectl wait --for=condition=Ready pod --all -n knative-serving --timeout=60s
- echo "Waiting for all pods to be ready in knative-eventing"
- kubectl wait --for=condition=Ready pod --all -n knative-eventing --timeout=60s
+ - id: build-kamel-binary
+ name: Build Kamel Binary
+ uses: ./.github/actions/kamel-build
+ with:
+ image-registry: ${{ steps.configure-platform.outputs.image-registry }}
- - name: Build Operator
- run: |
- echo "Build project"
- export CUSTOM_IMAGE=${KIND_REGISTRY}/apache/camel-k
- echo "LOCAL_IMAGE_NAME=${CUSTOM_IMAGE}" >> $GITHUB_ENV
- echo "LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
- make PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images images-push
+ - name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
+ with:
+ kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
- sudo mv ./kamel /usr/local/bin
- name: Run IT
run: |
- echo "Installing camel k cluster resources"
- kamel install --cluster-setup
-
- # Configure install options
- export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.LOCAL_IMAGE_VERSION }}
- export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
- export KAMEL_INSTALL_REGISTRY_INSECURE=true
+ # Cluster environment
+ export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
-
- # Configure test options
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+ # Test options
+ export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
+ export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+ export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
+
# Then run integration tests
make test-knative
@@ -165,119 +106,61 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- - name: Cleanup
- run: |
- ls -lart
- echo "Initial status:"
- df -h
+ with:
+ persist-credentials: false
+ submodules: recursive
- echo "Cleaning up resources:"
- sudo swapoff -a
- sudo rm -f /swapfile
- sudo apt clean
- sudo rm -rf /usr/share/dotnet
- sudo rm -rf /opt/ghc
- sudo rm -rf "/usr/local/share/boost"
- sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- docker rmi $(docker image ls -aq)
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
- echo "Final status:"
- df -h
- - name: Set up JDK 11
- uses: AdoptOpenJDK/install-jdk@v1
- with:
- version: "11"
- - name: Set Go
- uses: actions/setup-go@v1
- with:
- go-version: 1.16.x
- name: Get YAKS
run: |
export YAKS_VERSION=0.4.0
curl --fail -L https://github.com/citrusframework/yaks/releases/download/v${YAKS_VERSION}/yaks-${YAKS_VERSION}-linux-64bit.tar.gz -o yaks.tar.gz
tar -zxf yaks.tar.gz
sudo mv yaks /usr/local/bin/
- - name: Kubernetes KinD Cluster
- uses: container-tools/kind-action@v1
+
+ - id: configure-platform
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
with:
- version: v0.11.0
- node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- - name: Info
- run: |
- kubectl version
- kubectl cluster-info
- kubectl describe nodes
+ cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
+
- name: Install YAKS
run: |
yaks install --cluster-setup
- - name: Install Knative
- run: |
- # Prerequisites
- sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
-
- export SERVING_VERSION=knative-v1.1.0
- export EVENTING_VERSION=knative-v1.1.0
- export KOURIER_VERSION=knative-v1.1.0
-
- # Serving
- kubectl apply --filename https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-crds.yaml
- curl -L -s https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
-
- # Kourier
- kubectl apply --filename https://github.com/knative-sandbox/net-kourier/releases/download/$KOURIER_VERSION/kourier.yaml
- kubectl patch configmap/config-network \
- --namespace knative-serving \
- --type merge \
- --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
-
- # Eventing
- kubectl apply --filename https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-crds.yaml
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
-
- # Eventing channels
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/in-memory-channel.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
- # Eventing broker
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/mt-channel-broker.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
-
- # Eventing sugar controller for injection
- kubectl apply -f https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-sugar-controller.yaml
+ - name: Install Knative
+ uses: ./.github/actions/kamel-install-knative
- # Wait for installation completed
- echo "Waiting for all pods to be ready in kourier-system"
- kubectl wait --for=condition=Ready pod --all -n kourier-system --timeout=60s
- echo "Waiting for all pods to be ready in knative-serving"
- kubectl wait --for=condition=Ready pod --all -n knative-serving --timeout=60s
- echo "Waiting for all pods to be ready in knative-eventing"
- kubectl wait --for=condition=Ready pod --all -n knative-eventing --timeout=60s
+ - id: build-kamel-binary
+ name: Build Kamel Binary
+ uses: ./.github/actions/kamel-build
+ with:
+ image-registry: ${{ steps.configure-platform.outputs.image-registry }}
- - name: Build Operator
- run: |
- echo "Build project"
- export CUSTOM_IMAGE=${KIND_REGISTRY}/apache/camel-k
- echo "LOCAL_IMAGE_NAME=${CUSTOM_IMAGE}" >> $GITHUB_ENV
- echo "LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
- make PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images images-push
+ - name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
+ with:
+ kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
- sudo mv ./kamel /usr/local/bin
- name: Run IT
run: |
- echo "Installing camel k cluster resources"
- kamel install --cluster-setup
-
- # Configure install options
- export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.LOCAL_IMAGE_VERSION }}
- export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
- export KAMEL_INSTALL_REGISTRY_INSECURE=true
+ # Cluster environment
+ export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
-
- # Configure test options
- export CAMEL_K_TEST_IMAGE_NAME=$KIND_REGISTRY/apache/camel-k
+ export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+ # Test options
+ export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+ export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
+ export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
+
# Install Yaks globally
yaks install
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index 654d70a986..ca23a018b5 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -55,75 +55,46 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- - name: Cleanup
- run: |
- ls -lart
- echo "Initial status:"
- df -h
+ with:
+ persist-credentials: false
+ submodules: recursive
- echo "Cleaning up resources:"
- sudo swapoff -a
- sudo rm -f /swapfile
- sudo apt clean
- sudo rm -rf /usr/share/dotnet
- sudo rm -rf /opt/ghc
- sudo rm -rf "/usr/local/share/boost"
- sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- docker rmi $(docker image ls -aq)
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
- echo "Final status:"
- df -h
- - name: Set up JDK 11
- uses: AdoptOpenJDK/install-jdk@v1
+ - id: configure-platform
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
with:
- version: "11"
- - name: Set Go
- uses: actions/setup-go@v1
+ cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
+
+ - id: build-kamel-binary
+ name: Build Kamel Binary
+ uses: ./.github/actions/kamel-build
with:
- go-version: 1.16.x
- - name: Kubernetes KinD Cluster
- uses: container-tools/kind-action@v1
+ image-registry: ${{ steps.configure-platform.outputs.image-registry }}
+
+ - name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
with:
- version: v0.11.0
- node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- - name: Info
- run: |
- kubectl cluster-info
- kubectl describe nodes
- - name: Build Operator
- run: |
- echo "Build project"
- export CUSTOM_IMAGE=${KIND_REGISTRY}/apache/camel-k
- echo "LOCAL_IMAGE_NAME=${CUSTOM_IMAGE}" >> $GITHUB_ENV
- echo "LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
- make PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images images-push
+ kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
- sudo mv ./kamel /usr/local/bin
- name: Run IT
- # Disable registry tests as not compatible with KinD
- #env:
- # TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
- # TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
- # TEST_GITHUB_PACKAGES_REPO: ${{ secrets.TEST_GITHUB_PACKAGES_REPO }}
- # TEST_GITHUB_PACKAGES_USERNAME: ${{ secrets.TEST_GITHUB_PACKAGES_USERNAME }}
- # TEST_GITHUB_PACKAGES_PASSWORD: ${{ secrets.TEST_GITHUB_PACKAGES_PASSWORD }}
run: |
- echo "Installing camel k cluster resources"
- kamel install --cluster-setup
-
- # Configure install options
- export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.LOCAL_IMAGE_VERSION }}
- export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=$KIND_REGISTRY
- export KAMEL_INSTALL_REGISTRY_INSECURE=true
+ # Cluster environment
+ export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
-
- # Configure test options
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+ # Test options
+ export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+ export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
+
# Then run integration tests
make test-integration
make test-service-binding
diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml
index a1a0856640..16d8eb6a83 100644
--- a/.github/workflows/local.yml
+++ b/.github/workflows/local.yml
@@ -55,33 +55,20 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- - name: Cleanup
- run: |
- ls -lart
- echo "Initial status:"
- df -h
+ with:
+ persist-credentials: false
+ submodules: recursive
- echo "Cleaning up resources:"
- sudo swapoff -a
- sudo rm -f /swapfile
- sudo apt clean
- docker rmi $(docker image ls -aq)
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
- echo "Final status:"
- df -h
- - name: Set up JDK 11
- uses: AdoptOpenJDK/install-jdk@v1
- with:
- version: "11"
- - name: Set Go
- uses: actions/setup-go@v1
+ - id: build-kamel-binary
+ name: Build Kamel Binary
+ uses: ./.github/actions/kamel-build
with:
- go-version: 1.16.x
- - name: Build Kamel
- run: |
- echo "Build project"
- make build-kamel
- sudo mv ./kamel /usr/local/bin
+ make-rules: 'build-kamel'
+
- name: Run IT
run: |
# Configure staging repos
diff --git a/.github/workflows/openshift.yml b/.github/workflows/openshift.yml
index c7cd72df94..64d28b61f9 100644
--- a/.github/workflows/openshift.yml
+++ b/.github/workflows/openshift.yml
@@ -55,198 +55,34 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- - name: Cleanup
- run: |
- ls -lart
- echo "Initial status:"
- df -h
-
- echo "Cleaning up resources:"
- sudo swapoff -a
- sudo rm -f /swapfile
- sudo apt clean
- sudo rm -rf /usr/share/dotnet
- sudo rm -rf /opt/ghc
- sudo rm -rf "/usr/local/share/boost"
- sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- docker rmi $(docker image ls -aq)
-
- echo "Final status:"
- df -h
- - name: Set up JDK 11
- uses: AdoptOpenJDK/install-jdk@v1
with:
- version: "11"
- - name: Set Go
- uses: actions/setup-go@v1
- with:
- go-version: 1.16.x
- - name: Get OpenShift Client (oc)
- run: |
- export OPENSHIFT_VERSION=v3.11.0
- export OPENSHIFT_COMMIT=0cbc58b
- export MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-
- sudo rm -f /etc/resolv.conf
- sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
- sudo sh -c 'echo "DNS=8.8.8.8 4.4.4.4" >> /etc/systemd/resolved.conf'
- sudo service systemd-resolved restart
-
- # set docker0 to promiscuous mode
- sudo ip link set docker0 promisc on
-
- # Download and install the oc binary
- sudo mount --make-shared /
-
- sudo service docker stop
- sudo echo '{"insecure-registries": ["172.30.0.0/16"]}' | sudo tee /etc/docker/daemon.json > /dev/null
- sudo service docker start
-
- DOWNLOAD_URL=https://github.com/openshift/origin/releases/download/$OPENSHIFT_VERSION/openshift-origin-client-tools-$OPENSHIFT_VERSION-$OPENSHIFT_COMMIT-linux-64bit.tar.gz
- wget -O client.tar.gz ${DOWNLOAD_URL}
- tar xvzOf client.tar.gz > oc.bin
- sudo mv oc.bin /usr/local/bin/oc
- sudo chmod 755 /usr/local/bin/oc
-
- - name: Start OpenShift Cluster
- run: |
- # Figure out this host's IP address
- IP_ADDR="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)"
+ persist-credentials: false
+ submodules: recursive
- # Setup cluster dir
- sudo mkdir -p /home/runner/lib/oc
- sudo chmod 777 /home/runner/lib/oc
- cd /home/runner/lib/oc
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
- # Start OpenShift
- oc cluster up --public-hostname=$IP_ADDR --enable=persistent-volumes,registry,router
- oc login -u system:admin
-
- # Wait until we have a ready node in openshift
- TIMEOUT=0
- TIMEOUT_COUNT=60
- until [ $TIMEOUT -eq $TIMEOUT_COUNT ]; do
- if [ -n "$(oc get nodes | grep Ready)" ]; then
- break
- fi
- echo "openshift is not up yet"
- TIMEOUT=$((TIMEOUT+1))
- sleep 5
- done
+ - id: configure-platform
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
+ with:
+ cluster-type: 'ocp3'
- if [ $TIMEOUT -eq $TIMEOUT_COUNT ]; then
- echo "Failed to start openshift"
- exit 1
- fi
+ - id: build-kamel-binary
+ name: Build Kamel Binary
+ uses: ./.github/actions/kamel-build
- echo "openshift is deployed and reachable"
+ - name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
+ with:
+ kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
- - name: Info
- run: |
- oc describe nodes
- name: Run IT
- #env:
- # TEST_DOCKER_HUB_USERNAME: ${{ secrets.TEST_DOCKER_HUB_USERNAME }}
- # TEST_DOCKER_HUB_PASSWORD: ${{ secrets.TEST_DOCKER_HUB_PASSWORD }}
- # TEST_GITHUB_PACKAGES_REPO: ${{ secrets.TEST_GITHUB_PACKAGES_REPO }}
- # TEST_GITHUB_PACKAGES_USERNAME: ${{ secrets.TEST_GITHUB_PACKAGES_USERNAME }}
- # TEST_GITHUB_PACKAGES_PASSWORD: ${{ secrets.TEST_GITHUB_PACKAGES_PASSWORD }}
run: |
- # Compute registry parameters
- echo "Build project"
-
- make PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images
-
# Make the Apache Snapshots or Apache Staging repository enabled by default
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- echo "installing camel k cluster resources"
- ./kamel install --cluster-setup
-
- # Aggregate pod eviction permission to the default admin role
- cat <> $GITHUB_ENV
- echo "LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
- make PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images images-push
- - name: Build Operator bundle
- run: |
- echo "Build Operator bundle"
-
- # reinstall kustomize to be always on the same version
- sudo rm $(which kustomize)
-
- make kustomize
-
- # replace image
- $(cd config/manifests && kustomize edit set image "docker.io/apache/camel-k=${{ env.LOCAL_IMAGE_NAME }}:${{ env.LOCAL_IMAGE_VERSION }}")
-
- # Patch CSV with the 'replaces' field to define the upgrade graph
- # Use sed as the manifest/bases file is not included in the kustomize config
- BASE_VERSION=$(echo ${{ env.LOCAL_IMAGE_VERSION }} | grep -Po "\d.\d.\d")
- sed -i "/ version: ${BASE_VERSION}/a \ \ replaces: camel-k-operator.v$(make get-last-released-version)" config/manifests/bases/camel-k.clusterserviceversion.yaml
- export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
- export LOCAL_IMAGE_BUNDLE=${KIND_REGISTRY}/apache/camel-k-bundle:${{ env.LOCAL_IMAGE_VERSION }}
- echo "LOCAL_IMAGE_BUNDLE=${LOCAL_IMAGE_BUNDLE}" >> $GITHUB_ENV
- export PREV_XY_CHANNEL=stable-$(make get-last-released-version | grep -Po "\d.\d")
- echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
- export NEW_XY_CHANNEL=stable-$(make get-version | grep -Po "\d.\d")
- echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV
- make bundle-build BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" CHANNELS="${NEW_XY_CHANNEL}"
- docker push ${LOCAL_IMAGE_BUNDLE}
- - name: Create new index image
- run: |
- export LOCAL_IIB=${KIND_REGISTRY}/apache/camel-k-iib:${{ env.LOCAL_IMAGE_VERSION }}
- echo "LOCAL_IIB=${LOCAL_IIB}" >> $GITHUB_ENV
- sudo opm index add --bundles ${{ env.LOCAL_IMAGE_BUNDLE }} -c docker --from-index quay.io/operatorhubio/catalog:latest --tag ${LOCAL_IIB} --skip-tls
- docker push ${LOCAL_IIB}
+ echo "Kamel version installed: $(kamel version)"
+
+ - id: build-kamel-binary
+ name: Build Kamel Binary
+ uses: ./.github/actions/kamel-build
+ with:
+ image-registry: ${{ steps.configure-platform.outputs.image-registry }}
+ # Avoid overwriting last-released version of binary
+ install-kamel-binary: false
+
+ - id: build-kamel-bundle
+ name: Build Kamel Metadata Bundle
+ uses: ./.github/actions/kamel-build-bundle
+ with:
+ image-registry: ${{ steps.configure-platform.outputs.image-registry }}
+ local-image-name: ${{ steps.build-kamel-binary.outputs.local-image-name }}
+ local-image-version: ${{ steps.build-kamel-binary.outputs.local-image-version }}
+
- name: Run IT
run: |
# Use the last released Kamel CLI
export RELEASED_KAMEL_BIN=/usr/local/bin/kamel
+ echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)"
+
# Configure install options
- export CUSTOM_IMAGE=${{ env.LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.LOCAL_IMAGE_VERSION }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${KIND_REGISTRY}
- export KAMEL_INSTALL_REGISTRY_INSECURE=true
+ export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
# Configure test options
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
- export CAMEL_K_NEW_IIB=${{ env.LOCAL_IIB }}
+ export CAMEL_K_NEW_IIB=${{ steps.build-kamel-bundle.outputs.local-image-bundle-index }}
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_PREV_UPGRADE_CHANNEL=${{ env.PREV_XY_CHANNEL }}
diff --git a/.gitmodules b/.gitmodules
index 38b2437b42..aa99c61594 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,11 @@
[submodule ".github/actions/changelog"]
path = .github/actions/changelog
url = https://github.com/CharMixer/auto-changelog-action
+[submodule ".github/actions/conditional"]
+ path = .github/actions/conditional
+ url = https://github.com/ChristopherHX/conditional.git
+ branch = 3fce4b7a3171a839b482306f9fd3aba0c2112a24
+[submodule ".github/actions/action-dotenv-to-setenv"]
+ path = .github/actions/action-dotenv-to-setenv
+ url = https://github.com/c-py/action-dotenv-to-setenv.git
+ branch = tags/v3
diff --git a/script/Makefile b/script/Makefile
index 038e15bb33..631e10bbbc 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -319,6 +319,9 @@ images-push-staging:
docker tag $(CUSTOM_IMAGE):$(CUSTOM_VERSION) $(STAGING_IMAGE_NAME):$(CUSTOM_VERSION)
docker push $(STAGING_IMAGE_NAME):$(CUSTOM_VERSION)
+get-image:
+ @echo $(CUSTOM_IMAGE)
+
get-version:
@echo $(CUSTOM_VERSION)
From 94fcbe117767979a7aa09e184a09ef6f62e862ad Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Wed, 17 Nov 2021 13:51:44 +0000
Subject: [PATCH 02/40] Fixes failure in OLM upgrade e2e tests
* Makefile
* Updates LAST RELEASED VERSION to 1.6.1 as this is included in the
released index image. 1.7.0 needs to replace this rather than 1.6.0
* Adds pre-bundle rule for updating the CSV manifest prior to building
the bundle
* actions
* Adds more checking to ensure the action is performing as expected
* Since replaces is added using Makefile, it is removed from here
* *.go
* Converts uninstall command to a function which is then guaranteed to
execute via a deferral
---
.../actions/kamel-build-bundle/action.yaml | 13 +++++----
.github/workflows/upgrade.yml | 17 ++++++++---
e2e/support/test_support.go | 8 +++++
e2e/upgrade/cli_upgrade_test.go | 6 ++--
e2e/upgrade/olm_upgrade_test.go | 6 ++--
script/Makefile | 29 +++++++++++++++++--
6 files changed, 61 insertions(+), 18 deletions(-)
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index 19a3c95869..22b5e69e7a 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -47,18 +47,19 @@ runs:
# replace image
$(cd config/manifests && kustomize edit set image "docker.io/apache/camel-k=${{ inputs.local-image-name }}:${{ inputs.local-image-version }}")
- # Patch CSV with the 'replaces' field to define the upgrade graph
- # Use sed as the manifest/bases file is not included in the kustomize config
- BASE_VERSION=$(echo ${{ inputs.local-image-version }} | grep -Po "\d.\d.\d")
- sed -i "/ version: ${BASE_VERSION}/a \ \ replaces: camel-k-operator.v$(make get-last-released-version)" config/manifests/bases/camel-k.clusterserviceversion.yaml
-
export CUSTOM_IMAGE=${{ inputs.local-image-name }}
export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry }}/apache/camel-k-bundle:${{ inputs.local-image-version }}
+
export PREV_XY_CHANNEL=stable-$(make get-last-released-version | grep -Po "\d.\d")
echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
export NEW_XY_CHANNEL=stable-$(make get-version | grep -Po "\d.\d")
echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV
- make bundle-build BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" CHANNELS="${NEW_XY_CHANNEL}"
+
+ make bundle-build \
+ BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} \
+ DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" \
+ CHANNELS="${NEW_XY_CHANNEL}"
+
docker push ${LOCAL_IMAGE_BUNDLE}
echo "::set-output name=local-image-bundle::$(echo ${LOCAL_IMAGE_BUNDLE})"
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 8b5d1ce418..26c972cc17 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -75,10 +75,19 @@ jobs:
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-64bit.tar.gz -o kamel.tar.gz
- tar -zxf kamel.tar.gz
- sudo mv kamel /usr/local/bin/
- echo "Kamel version installed: $(kamel version)"
+ curl -L https://github.com/apache/camel-k/releases/download/v${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-64bit.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
+ sudo mv /tmp/kamel /usr/local/bin/
+ if [ $? == 0 ]; then
+ echo "Kamel version installed: $(kamel version)"
+ else
+ echo "ERROR: Failed to install kamel binary ${KAMEL_VERSION}"
+ exit 1
+ fi
- id: build-kamel-binary
name: Build Kamel Binary
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 1a69db0568..ccfb9b2ccf 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -1811,6 +1811,14 @@ func NewTestNamespace(injectKnativeBroker bool) ctrl.Object {
return obj
}
+func UninstallKamel(t *testing.T, args ...string) {
+ uargs := []string{"uninstall"}
+ uargs = append(uargs, args...)
+ if err := Kamel(uargs...).Execute(); err != nil {
+ t.Logf("Warning: An error occurred whilst trying to uninstall kamel: %s", err.Error())
+ }
+}
+
func GetOutputString(command *cobra.Command) string {
var buf bytes.Buffer
diff --git a/e2e/upgrade/cli_upgrade_test.go b/e2e/upgrade/cli_upgrade_test.go
index 65415bb3f5..f8e5a91fa5 100644
--- a/e2e/upgrade/cli_upgrade_test.go
+++ b/e2e/upgrade/cli_upgrade_test.go
@@ -38,6 +38,8 @@ import (
func TestOperatorUpgrade(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
+ defer UninstallKamel(t, "--all", "--olm=false")
+
version, ok := os.LookupEnv("KAMEL_K_TEST_RELEASE_VERSION")
Expect(ok).To(BeTrue())
@@ -112,9 +114,5 @@ func TestOperatorUpgrade(t *testing.T) {
// Check the Integration runs correctly
Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
-
- // Clean up
- Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
- Expect(Kamel("uninstall", "--all", "--olm=false").Execute()).To(Succeed())
})
}
diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go
index 8eea3f021e..981aae3e9e 100644
--- a/e2e/upgrade/olm_upgrade_test.go
+++ b/e2e/upgrade/olm_upgrade_test.go
@@ -46,6 +46,9 @@ import (
const catalogSourceName = "test-camel-k-source"
func TestOLMAutomaticUpgrade(t *testing.T) {
+ // Clean up cluster-wide resources that are not removed by OLM
+ defer UninstallKamel(t, "--all", "--olm=false")
+
prevIIB := os.Getenv("CAMEL_K_PREV_IIB")
newIIB := os.Getenv("CAMEL_K_NEW_IIB")
kamel := os.Getenv("RELEASED_KAMEL_BIN")
@@ -98,6 +101,7 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
prevCSVVersion = clusterServiceVersion(noAdditionalConditions, ns)().Spec.Version
prevIPVersionPrefix = fmt.Sprintf("%d.%d", prevCSVVersion.Version.Major, prevCSVVersion.Version.Minor)
+ t.Logf("Upgrading from Previous CSV Version: %s", prevCSVVersion.Version.String())
// Check the operator pod is running
Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
@@ -192,8 +196,6 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
// Clean up
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
Expect(Kamel("uninstall", "-n", ns).Execute()).To(Succeed())
- // Clean up cluster-wide resources that are not removed by OLM
- Expect(Kamel("uninstall", "--all", "--olm=false").Execute()).To(Succeed())
})
})
}
diff --git a/script/Makefile b/script/Makefile
index 631e10bbbc..672f5b1c12 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -16,6 +16,7 @@
VERSIONFILE := pkg/util/defaults/defaults.go
VERSION ?= 1.9.0-SNAPSHOT
OPERATOR_VERSION := $(subst -SNAPSHOT,,$(VERSION))
+LAST_RELEASED_IMAGE_NAME := camel-k-operator
LAST_RELEASED_VERSION := 1.8.0
RUNTIME_VERSION := 1.11.0
BUILDAH_VERSION := 1.14.0
@@ -50,6 +51,12 @@ LINT_DEADLINE := 10m
CHANNELS ?= $(OPERATOR_VERSION)
DEFAULT_CHANNEL ?= $(OPERATOR_VERSION)
PACKAGE := camel-k
+CSV_VERSION := $(CUSTOM_VERSION:-SNAPSHOT=)
+CSV_DISPLAY_NAME := Camel K Operator
+CSV_SUPPORT := Camel
+CSV_REPLACES := $(LAST_RELEASED_IMAGE_NAME).v$(LAST_RELEASED_VERSION)
+CSV_FILENAME := $(PACKAGE).clusterserviceversion.yaml
+CSV_PATH := config/manifests/bases/$(CSV_FILENAME)
# Used to push pre-release artifacts
STAGING_IMAGE_NAME := docker.io/camelk/camel-k
@@ -325,6 +332,9 @@ get-image:
get-version:
@echo $(CUSTOM_VERSION)
+get-last-released-img-name:
+ @echo $(LAST_RELEASED_IMAGE_NAME)
+
get-last-released-version:
@echo $(LAST_RELEASED_VERSION)
@@ -338,7 +348,7 @@ git-tag:
./script/git_tag.sh $(CUSTOM_VERSION) $(RELEASE_GIT_REMOTE)
cross-compile:
- # we must wrap the goldflags parameters with quotes as they will need to
+ # we must wrap the goldflags parameters with quotes as they will need to
# be processed as a single argument by the cross compile script
./script/cross_compile.sh $(CUSTOM_VERSION) $(subst ","\",$(GOFLAGS))
@@ -464,7 +474,22 @@ BUNDLE_PACKAGE := --package=$(PACKAGE)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) $(BUNDLE_PACKAGE)
-bundle: set-version generate-crd $(BUNDLE_CAMEL_APIS) kustomize operator-sdk
+#
+# Tailor the manifest according to default values for this project
+# Note. to successfully make the bundle the name must match that specified in the PROJECT file
+#
+pre-bundle:
+# bundle name must match that which appears in PROJECT file
+ @sed -i 's/projectName: .*/projectName: $(PACKAGE)/' PROJECT
+ @sed -i 's~^ containerImage: .*~ containerImage: $(CUSTOM_IMAGE):$(CUSTOM_VERSION)~' $(CSV_PATH)
+ @sed -i 's/^ support: .*/ support: $(CSV_SUPPORT)/' $(CSV_PATH)
+ @sed -i 's/^ name: .*.\(v.*\)/ name: $(PACKAGE).v$(CSV_VERSION)/' $(CSV_PATH)
+ @sed -i 's/^ displayName: .*/ displayName: $(CSV_DISPLAY_NAME)/' $(CSV_PATH)
+ @sed -i 's/^ replaces: .*/ replaces: $(CSV_REPLACES)/' $(CSV_PATH)
+ @sed -i 's/^ version: .*/ version: $(CSV_VERSION)/' $(CSV_PATH)
+ @sed -i '/ version: ${CSV_VERSION}/a \ \ replaces: $(CSV_REPLACES)' $(CSV_PATH)
+
+bundle: set-version generate-crd $(BUNDLE_CAMEL_APIS) kustomize operator-sdk pre-bundle
@# Sets the operator image to the preferred image:tag
@cd config/manifests && $(KUSTOMIZE) edit set image $(IMAGE_NAME)=$(CUSTOM_IMAGE):$(CUSTOM_VERSION)
@# Build kustomize manifests
From bb1585291c2014ba77d635e8f1e3c10e58911361 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Mon, 13 Dec 2021 16:57:08 +0000
Subject: [PATCH 03/40] Moves install of opm to prepare-env action
* This is a test requirement rather than a platform requirement so install
should be determined by prepare-env.
---
.../actions/kamel-config-cluster/action.yaml | 4 ----
.github/actions/kamel-prepare-env/action.yml | 19 +++++++++++++++++++
.github/workflows/upgrade.yml | 3 ++-
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/.github/actions/kamel-config-cluster/action.yaml b/.github/actions/kamel-config-cluster/action.yaml
index 2ff0b64ab9..b76b603dfb 100644
--- a/.github/actions/kamel-config-cluster/action.yaml
+++ b/.github/actions/kamel-config-cluster/action.yaml
@@ -38,10 +38,6 @@ inputs:
image-registry-insecure:
description: 'The image-registry-insecure - required for custom config only'
required: false
- opm:
- description: 'Install opm alongside cluster for bundle-related operations'
- required: false
- default: false
olm:
description: 'Check for & install OLM alongside cluster for bundle-related operations'
required: false
diff --git a/.github/actions/kamel-prepare-env/action.yml b/.github/actions/kamel-prepare-env/action.yml
index f1b5acd7f3..36b9278098 100644
--- a/.github/actions/kamel-prepare-env/action.yml
+++ b/.github/actions/kamel-prepare-env/action.yml
@@ -18,6 +18,12 @@
name: kamel-prepare-env
description: 'Initialise the test environment with tools'
+inputs:
+ install-opm:
+ description: 'Install opm alongside cluster for bundle-related operations'
+ required: false
+ default: false
+
runs:
using: "composite"
steps:
@@ -89,6 +95,19 @@ runs:
with:
version: 'latest'
+ #
+ # Install opm if required
+ #
+ - id: install-opm
+ name: Install opm if required
+ shell: bash
+ run: |
+ if [ "${{ inputs.install-opm }}" == "true" ]; then
+ curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.19.5/linux-amd64-opm -o opm
+ chmod +x opm
+ sudo mv opm /usr/local/bin/
+ fi
+
- id: report-platform
name: Report Platform
shell: bash
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 26c972cc17..24325717e7 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -62,13 +62,14 @@ jobs:
- id: prepare-env
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
+ with:
+ install-opm: true
- id: configure-platform
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
- opm: true
olm: true
- name: Get Released Kamel CLI
From e0c5c0d3ee45b15b191910e1d2eb2586ac1eee8f Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 5 Nov 2021 12:52:59 +0000
Subject: [PATCH 04/40] When tests fail and project is dumped, clear up
afterwards
---
e2e/support/test_support.go | 17 ++++++++++++++++-
e2e/upgrade/olm_upgrade_test.go | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index ccfb9b2ccf..ff13fc9108 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -1673,6 +1673,12 @@ func InvokeUserTestCode(t *testing.T, ns string, doRun func(string)) {
if err := util.Dump(TestContext, TestClient(), ns, t); err != nil {
t.Logf("Error while dumping namespace %s: %v\n", ns, err)
}
+
+ //
+ // Ensure everything is removed after dumping
+ // in order to ensure a clean cluster
+ //
+ uninstallKamelInternal(t, "--all", "--olm=false")
}
}()
@@ -1811,7 +1817,7 @@ func NewTestNamespace(injectKnativeBroker bool) ctrl.Object {
return obj
}
-func UninstallKamel(t *testing.T, args ...string) {
+func uninstallKamelInternal(t *testing.T, args ...string) {
uargs := []string{"uninstall"}
uargs = append(uargs, args...)
if err := Kamel(uargs...).Execute(); err != nil {
@@ -1819,6 +1825,15 @@ func UninstallKamel(t *testing.T, args ...string) {
}
}
+func UninstallKamel(t *testing.T, args ...string) {
+ if t.Failed() {
+ // then dump needs to execute first
+ return
+ }
+
+ uninstallKamelInternal(t, args...)
+}
+
func GetOutputString(command *cobra.Command) string {
var buf bytes.Buffer
diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go
index 981aae3e9e..f454d3738d 100644
--- a/e2e/upgrade/olm_upgrade_test.go
+++ b/e2e/upgrade/olm_upgrade_test.go
@@ -101,7 +101,7 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
prevCSVVersion = clusterServiceVersion(noAdditionalConditions, ns)().Spec.Version
prevIPVersionPrefix = fmt.Sprintf("%d.%d", prevCSVVersion.Version.Major, prevCSVVersion.Version.Minor)
- t.Logf("Upgrading from Previous CSV Version: %s", prevCSVVersion.Version.String())
+ t.Logf("Using Previous CSV Version: %s", prevCSVVersion.Version.String())
// Check the operator pod is running
Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
From 01a1be7a88f360f38928bea2ef203d9ba3dd68e5 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 16 Nov 2021 14:45:36 +0000
Subject: [PATCH 05/40] Converts the upgrade workflow into a composite action
* Allows the re-use of the workflow actions in other workflows. This way
the majority of changes to the workflow remain upstream and not in any
downstream repositories.
* Splits the image-registry into push and pull registeries since openshift
uses different URLs for its internal registry when its exposed externally
* Custom action takes a single json config rather than multiple inputs and
reads them into env vars. This means that the json can be inserted into
a single secret that is passed in from the workflow (secrets cannot be
imported directly by actions).
---
.github/actions/e2e-upgrade/action.yml | 109 ++++++++++++++++
.../actions/kamel-build-bundle/action.yaml | 114 +++++++++++++++--
.github/actions/kamel-build/action.yml | 33 +++--
.../kamel-config-cluster-custom/action.yml | 116 +++++++++++++++---
.../kamel-config-cluster-kind/action.yml | 10 +-
.../kamel-config-cluster-ocp3/action.yml | 4 +-
.../actions/kamel-config-cluster/action.yaml | 96 +++++++++------
.github/workflows/upgrade.yml | 75 +----------
8 files changed, 411 insertions(+), 146 deletions(-)
create mode 100644 .github/actions/e2e-upgrade/action.yml
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
new file mode 100644
index 0000000000..6edc9b518c
--- /dev/null
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -0,0 +1,109 @@
+# ---------------------------------------------------------------------------
+# 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-upgrade
+description: 'End-to-End tests for upgrading to new version'
+
+inputs:
+ platform-config:
+ description: 'The configuration of the underlying cluster (if cluster-type is custom)'
+ required: false
+
+runs:
+ using: "composite"
+
+ steps:
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
+ with:
+ install-opm: true
+
+ - id: configure-platform
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
+ with:
+ cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
+ platform-config: ${{ inputs.platform-config }}
+
+ - 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-64bit.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 is same script as it was defined
+ #
+ export RELEASED_KAMEL_BINARY=/tmp/kamel-${KAMEL_VERSION}
+ echo "RELEASED_KAMEL_BINARY=${RELEASED_KAMEL_BINARY}" >> $GITHUB_ENV
+ mv /tmp/kamel ${RELEASED_KAMEL_BINARY}
+ if [ $? == 0 ]; then
+ echo "Info: Kamel version installed: $(${RELEASED_KAMEL_BINARY} version)"
+ else
+ echo "Error: Failed to install kamel binary ${KAMEL_VERSION}"
+ exit 1
+ fi
+
+ - id: build-kamel-binary
+ name: Build Kamel Binary
+ uses: ./.github/actions/kamel-build
+ with:
+ image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
+ image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
+ image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
+ # Avoid overwriting last-released version of binary
+ install-kamel-binary: false
+
+ - id: build-kamel-bundle
+ name: Build Kamel Metadata Bundle
+ uses: ./.github/actions/kamel-build-bundle
+ with:
+ image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
+ image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
+ image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
+ local-image-name: ${{ steps.build-kamel-binary.outputs.local-image-name }}
+ local-image-version: ${{ steps.build-kamel-binary.outputs.local-image-version }}
+
+ - name: Run IT
+ shell: bash
+ run: |
+ # Use the last released Kamel CLI
+ export RELEASED_KAMEL_BIN=${{ env.RELEASED_KAMEL_BINARY }}
+
+ echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)"
+
+ # Configure install options
+ export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
+ export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+ export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry-pull-host }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+
+ # Configure test options
+ export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
+ export CAMEL_K_NEW_IIB=${{ steps.build-kamel-bundle.outputs.local-image-bundle-index }}
+ export KAMEL_K_TEST_RELEASE_VERSION=$(make get-last-released-version)
+ export KAMEL_K_TEST_OPERATOR_CURRENT_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
+
+ # Then run integration tests
+ make test-upgrade
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index 22b5e69e7a..f0eff2cf36 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -19,9 +19,16 @@ name: kamel-build-bundle
description: 'Builds kamel operator metadata bundle'
inputs:
- image-registry:
- description: 'Location of image registry to push bundle'
- required: true
+ 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
@@ -44,11 +51,32 @@ runs:
exit 1
fi
- # replace image
- $(cd config/manifests && kustomize edit set image "docker.io/apache/camel-k=${{ inputs.local-image-name }}:${{ inputs.local-image-version }}")
+ if [ -z "${{ inputs.local-image-name }}" ]; then
+ echo "Error: local-image-name not defined"
+ exit 1
+ fi
+
+ if [ -z "${{ inputs.local-image-version }}" ]; then
+ echo "Error: local-image-version not defined"
+ exit 1
+ fi
+
+ if [ -z "${{ inputs.image-registry-push-host }}" ]; then
+ echo "Error: image-registry-push-host not defined"
+ exit 1
+ fi
+
+ if [ -z "${{ inputs.image-registry-pull-host }}" ]; then
+ echo "Error: image-registry-pull-host not defined"
+ exit 1
+ fi
+ #
+ # Build with the PUSH host to ensure the correct image:tag
+ # for docker to push the image.
+ #
+ export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}
export CUSTOM_IMAGE=${{ inputs.local-image-name }}
- export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry }}/apache/camel-k-bundle:${{ inputs.local-image-version }}
export PREV_XY_CHANNEL=stable-$(make get-last-released-version | grep -Po "\d.\d")
echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
@@ -62,22 +90,92 @@ runs:
docker push ${LOCAL_IMAGE_BUNDLE}
+ #
+ # Use the PULL host to ensure the correct image:tag
+ # is passed into the tests for the deployment to pull from
+ #
+ export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}
echo "::set-output name=local-image-bundle::$(echo ${LOCAL_IMAGE_BUNDLE})"
- id: build-index-image
name: Create New Index Image
shell: bash
run: |
- export LOCAL_IIB=${{ inputs.image-registry }}/apache/camel-k-iib:${{ inputs.local-image-version }}
+ export LOCAL_IIB=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}
if ! command -v opm &> /dev/null
then
echo "opm could not be found. Has it not been installed?"
exit 1
fi
- opm index add --bundles ${{ steps.build-bundle-image.outputs.local-image-bundle }} -c docker --from-index quay.io/operatorhubio/catalog:latest --tag ${LOCAL_IIB} --skip-tls
+ # Shorten the vars
+ PUSH_REGISTRY=${{ inputs.image-registry-push-host }}
+ PULL_REGISTRY=${{ inputs.image-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 -e 's/.*:\([0-9]\+\).*/\1/')
+ 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
+ sudo sed -i "s/\(localhost.*\)/\1 ${PULL_HOST}/g" /etc/hosts
+
+ #
+ # Bring up the registry:2 instance if not already started
+ #
+ reg=$(docker ps -q -f name=triage-registry)
+ if [ -z "${reg}" ]; then
+ docker run -d -p ${PULL_PORT}:5000 --name triage-registry registry:2
+ fi
+
+ #
+ # Tag the bundle image
+ #
+ docker tag \
+ ${PUSH_REGISTRY}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }} \
+ ${{ steps.build-bundle-image.outputs.local-image-bundle }}
+
+ # Push the bundle image to the registry
+ #
+ docker push ${{ steps.build-bundle-image.outputs.local-image-bundle }}
+ fi
+
+ #
+ # Construct an index image containing the newly built bundle image
+ #
+ opm index add \
+ -c docker --skip-tls \
+ --bundles ${{ steps.build-bundle-image.outputs.local-image-bundle }} \
+ --from-index quay.io/operatorhubio/catalog:latest \
+ --tag ${LOCAL_IIB}
+
docker push ${LOCAL_IIB}
+ export LOCAL_IIB=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}
echo "::set-output name=local-image-bundle-index::$(echo ${LOCAL_IIB})"
outputs:
diff --git a/.github/actions/kamel-build/action.yml b/.github/actions/kamel-build/action.yml
index 7414da1413..f6af262847 100644
--- a/.github/actions/kamel-build/action.yml
+++ b/.github/actions/kamel-build/action.yml
@@ -19,9 +19,16 @@ name: kamel-build
description: 'Builds kamel operator binary'
inputs:
- image-registry:
- description: 'Location of image registry if required'
+ 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
@@ -39,9 +46,12 @@ runs:
run: |
echo "Build Kamel from source"
- if [ -n "${{ inputs.image-registry }}" ]; then
- export CUSTOM_IMAGE=${{ inputs.image-registry }}/apache/camel-k
- echo "::set-output name=custom-img::$(echo ${CUSTOM_IMAGE})"
+ if [ -n "${{ inputs.image-registry-push-host }}" ]; then
+ #
+ # Build with the PUSH host to ensure the correct image:tag
+ # for docker to push the image.
+ #
+ export CUSTOM_IMAGE=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k
fi
RULES="PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images"
@@ -49,7 +59,7 @@ runs:
RULES="${{ inputs.make-rules }}"
fi
- if [ -n "${{ inputs.image-registry }}" ]; then
+ if [ -n "${{ inputs.image-registry-push-host }}" ]; then
RULES="${RULES} images-push"
fi
@@ -61,14 +71,15 @@ runs:
echo "Kamel version installed: $(kamel version)"
fi
- echo "::set-output name=local-img-name::$(make get-image)"
+ #
+ # Use the PULL host to ensure the correct image:tag
+ # is passed into the tests for the deployment to pull from
+ #
+ export LOCAL_IMAGE_NAME=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k
+ echo "::set-output name=local-img-name::$(echo ${LOCAL_IMAGE_NAME})"
echo "::set-output name=local-img-version::$(make get-version)"
-
outputs:
- custom-image:
- description: "Reference of the camel-k image"
- value: ${{ steps.build-operator.outputs.custom-img }}
local-image-name:
description: "Reference of the camel-k image"
value: ${{ steps.build-operator.outputs.local-img-name }}
diff --git a/.github/actions/kamel-config-cluster-custom/action.yml b/.github/actions/kamel-config-cluster-custom/action.yml
index 46bbe5e388..56bf532fee 100644
--- a/.github/actions/kamel-config-cluster-custom/action.yml
+++ b/.github/actions/kamel-config-cluster-custom/action.yml
@@ -21,49 +21,93 @@ description: 'Provides configuration for acessing a custom kubernetes cluster'
runs:
using: "composite"
steps:
+ - name: Read platform-config variable to temporary file & override PLATFORM_TYPE if platform config defined
+ shell: bash
+ run: |
+ export PLATFORM_CONFIG=/tmp/platform-config.json
+
+ touch "${PLATFORM_CONFIG}"
+ if [ -z "${{ env.PLATFORM_CONFIG_DATA }}" ]; then
+ echo "Error: No PLATFORM_CONFIG_DATA has been defined"
+ exit 1
+ fi
+
+ cat << EOF > "${PLATFORM_CONFIG}"
+ ${{ env.PLATFORM_CONFIG_DATA }}
+ EOF
+
+ if [ ! -f "${PLATFORM_CONFIG}" ]; then
+ echo "Error: No file ${PLATFORM_CONFIG} has been created"
+ exit 1
+ fi
+
+ if [ -s "${PLATFORM_CONFIG}" ]; then
+ echo "Info: Platform configuration defined"
+ echo "PLATFORM_CONFIG=${PLATFORM_CONFIG}" >> $GITHUB_ENV
+ else
+ echo "Error: No platform configuration defined"
+ exit 1
+ fi
+
+ - name: Platform-config JSON to variables
+ uses: antifree/json-to-variables@v1.0.1
+ with:
+ filename: ${{ env.PLATFORM_CONFIG }}
+ prefix: 'e2e'
+
- id: connect-cluster
name: Connect to cluster
shell: bash
run: |
- if [ -z "${KUBE_CONFIG_DATA}" ]; then
- echo "Error: KUBE_CONFIG_DATA secret cannot be found"
+ if [ -z "${{ env.e2e_kube-config-data }}" ]; then
+ echo "Error: kube config data property cannot be found"
exit 1
fi
- if [ -z "${KUBE_ADMIN_USER_CTX}" ]; then
- echo "Error: KUBE_ADMIN_USER_CTX secret cannot be found"
+ if [ -z "${{ env.e2e_kube-admin-user-ctx }}" ]; then
+ echo "Error: kube admin context property cannot be found"
exit 1
fi
- if [ -z "${KUBE_USER_CTX}" ]; then
- echo "Error: KUBE_USER_CTX secret cannot be found"
+ if [ -z "${{ env.e2e_kube-user-ctx }}" ]; then
+ echo "Error: kube user context property cannot be found"
exit 1
fi
- # IMAGE_REGISTRY & IMAGE_REGISTRY_INSECURE are optional
+ if [ -z "${{ env.e2e_image-registry-pull-host }}" ]; then
+ echo "Error: image registry pull host property cannot be found"
+ exit 1
+ fi
+
+ if [ -z "${{ env.e2e_image-registry-push-host }}" ]; then
+ echo "Error: image registry build host property cannot be found"
+ exit 1
+ fi
+
+ if [ -n "${{ env.e2e_image-registry-user }}" ] && [ -n "${{ env.e2e_image-registry-token }}" ]; then
+ echo "Secured registry in use so login with docker"
+ docker login \
+ -u "${{ env.e2e_image-registry-user }}" \
+ -p "${{ env.e2e_image-registry-token }}" \
+ "${{ env.e2e_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
+ echo -n "${{ env.e2e_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 "${KUBE_ADMIN_USER_CTX}"
+ kubectl config use-context "${{ env.e2e_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
- # Export the context variables
- echo "KUBE_ADMIN_USER_CTX=${KUBE_ADMIN_USER_CTX}" >> $GITHUB_ENV
- echo "KUBE_USER_CTX=${KUBE_USER_CTX}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY=${IMAGE_REGISTRY}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_INSECURE=${IMAGE_REGISTRY_INSECURE}" >> $GITHUB_ENV
-
- id: info
name: Info
shell: bash
@@ -128,4 +172,44 @@ runs:
EOF
# Set the context to the user
- kubectl config use-context "${{ env.KUBE_USER_CTX }}"
+ kubectl config use-context "${{ env.e2e_kube-user-ctx }}"
+
+ - id: extract-config
+ shell: bash
+ run: |
+ echo "IMAGE_REGISTRY_PUSH_HOST=${{ env.e2e_image-registry-push-host }}" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_PULL_HOST=${{ env.e2e_image-registry-pull-host }}" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_INSECURE=${{ env.e2e_image-registry-insecure }}" >> $GITHUB_ENV
+
+ #
+ # Export the image namespace if defined in the platform config
+ #
+ if [ -n "${{ env.e2e_image-namespace }}" ]; then
+ echo "IMAGE_NAMESPACE=${{ env.e2e_image-namespace }}" >> $GITHUB_ENV
+ fi
+
+ #
+ # Export the context used for admin and user
+ #
+ echo "KUBE_ADMIN_USER_CTX=${{ env.e2e_kube-admin-user-ctx }}" >> $GITHUB_ENV
+ echo "KUBE_USER_CTX=${{ env.e2e_kube-user-ctx }}" >> $GITHUB_ENV
+
+ #
+ # Export the flag for installing olm
+ #
+ echo "INSTALL_OLM=${{ env.e2e_install-olm }}" >> $GITHUB_ENV
+
+ #
+ # Clear out environment variables no longer required
+ #
+ echo "PLATFORM_CONFIG=" >> $GITHUB_ENV
+ echo "e2e_image-registry-push-host=" >> $GITHUB_ENV
+ echo "e2e_image-registry-pull-host=" >> $GITHUB_ENV
+ echo "e2e_image-namespace=" >> $GITHUB_ENV
+ echo "e2e_image-registry-user=" >> $GITHUB_ENV
+ echo "e2e_image-registry-token=" >> $GITHUB_ENV
+ echo "e2e_image-registry-insecure=" >> $GITHUB_ENV
+ echo "e2e_kube-admin-user-ctx=" >> $GITHUB_ENV
+ echo "e2e_kube-config-data=" >> $GITHUB_ENV
+ echo "e2e_kube-user-ctx=" >> $GITHUB_ENV
+ echo "e2e_install-olm=" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster-kind/action.yml b/.github/actions/kamel-config-cluster-kind/action.yml
index 48b02bd995..e6b62b8b94 100644
--- a/.github/actions/kamel-config-cluster-kind/action.yml
+++ b/.github/actions/kamel-config-cluster-kind/action.yml
@@ -37,7 +37,9 @@ runs:
- id: extract-config
shell: bash
run: |
- echo "IMAGE_REGISTRY=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
+ # Kind has the same interface for both pushing and pulling images in its registry
+ echo "IMAGE_REGISTRY_PUSH_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_PULL_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
echo "IMAGE_REGISTRY_INSECURE=true" >> $GITHUB_ENV
#
@@ -46,3 +48,9 @@ runs:
#
echo "KUBE_ADMIN_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
echo "KUBE_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
+
+ #
+ # Export the flag for installing olm
+ #
+ echo "INSTALL_OLM=true" >> $GITHUB_ENV
+
diff --git a/.github/actions/kamel-config-cluster-ocp3/action.yml b/.github/actions/kamel-config-cluster-ocp3/action.yml
index 8d6bfb9c66..a113361b90 100644
--- a/.github/actions/kamel-config-cluster-ocp3/action.yml
+++ b/.github/actions/kamel-config-cluster-ocp3/action.yml
@@ -188,5 +188,7 @@ runs:
- id: extract-kube-config
shell: bash
run: |
- echo "IMAGE_REGISTRY=" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_PUSH_HOST=" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
echo "IMAGE_REGISTRY_INSECURE=false" >> $GITHUB_ENV
+ echo "INSTALL_OLM=false" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster/action.yaml b/.github/actions/kamel-config-cluster/action.yaml
index b76b603dfb..393baad0a8 100644
--- a/.github/actions/kamel-config-cluster/action.yaml
+++ b/.github/actions/kamel-config-cluster/action.yaml
@@ -23,29 +23,26 @@ inputs:
description: 'The type of cluster required: [kind, ocp3, custom]'
required: true
default: 'kind'
- kube-config-data:
- description: 'The kube-config-data - required for custom config only'
+ platform-config:
+ description: 'The JSON configuration of the platform - required for custom platform type only'
required: false
- kube-admin-user-ctx:
- description: 'The kube-admin-user-ctx - required for custom config only'
- required: false
- kube-user-ctx:
- description: 'The kube-user-ctx - required for custom config only'
- required: false
- image-registry:
- description: 'The image-registry - required for custom config only'
- required: false
- image-registry-insecure:
- description: 'The image-registry-insecure - required for custom config only'
- required: false
- olm:
- description: 'Check for & install OLM alongside cluster for bundle-related operations'
- required: false
- default: false
runs:
using: "composite"
steps:
+ - name: Override platform type if there is a custom platform-config
+ shell: bash
+ run: |
+ if [ -n "${{ inputs.platform-config }}" ]; then
+ #
+ # Have custom platform-config so override platform-type
+ #
+ echo "PLATFORM_TYPE=custom" >> $GITHUB_ENV
+ else
+ echo "Info: No platform configuration supplied."
+ echo "PLATFORM_TYPE=${{ inputs.cluster-type }}" >> $GITHUB_ENV
+ fi
+
#
# TODO
# Due to lack of if in steps, need to use conditional action which
@@ -57,7 +54,7 @@ runs:
name: Maybe Execute Kind Cluster
uses: ./.github/actions/conditional
with:
- if: ${{ inputs.cluster-type == 'kind' }}
+ if: ${{ env.PLATFORM_TYPE == 'kind' }}
step: |
uses: ./.github/actions/kamel-config-cluster-kind
@@ -65,7 +62,7 @@ runs:
name: Maybe Execute Minishift Cluster
uses: ./.github/actions/conditional
with:
- if: ${{ inputs.cluster-type == 'ocp3' }}
+ if: ${{ env.PLATFORM_TYPE == 'ocp3' }}
step: |
uses: ./.github/actions/kamel-config-cluster-ocp3
@@ -73,13 +70,9 @@ runs:
name: Maybe Execute Custom Cluster
uses: ./.github/actions/conditional
env:
- KUBE_CONFIG_DATA: ${{ inputs.kube-config-data }}
- KUBE_ADMIN_USER_CTX: ${{ inputs.kube-admin-user-ctx }}
- KUBE_USER_CTX: ${{ inputs.kube-user-ctx }}
- IMAGE_REGISTRY: ${{ inputs.image-registry }}
- IMAGE_REGISTRY_INSECURE: ${{ inputs.image-registry-insecure }}
+ PLATFORM_CONFIG_DATA: ${{ inputs.platform-config }}
with:
- if: ${{ inputs.cluster-type == 'custom' }}
+ if: ${{ env.PLATFORM_TYPE == 'custom' }}
step: |
uses: ./.github/actions/kamel-config-cluster-custom
@@ -87,7 +80,7 @@ runs:
name: Execute Invalid Cluster
uses: ./.github/actions/conditional
with:
- if: ${{ inputs.cluster-type != 'kind' && inputs.cluster-type != 'ocp3' && inputs.cluster-type != 'custom' }}
+ if: ${{ env.PLATFORM_TYPE != 'kind' && env.PLATFORM_TYPE != 'ocp3' && env.PLATFORM_TYPE != 'custom' }}
step: |
shell: bash
run: |
@@ -96,11 +89,34 @@ runs:
- id: platform-info
shell: bash
+ env:
+ DEFAULT_IMAGE_NAMESPACE: 'apache'
run: |
- echo "::set-output name=registry::$(echo ${{ env.IMAGE_REGISTRY }})"
- echo "::set-output name=registry-insecure::$(echo ${{ env.IMAGE_REGISTRY_INSECURE }})"
+ echo "::set-output name=image-registry-push-host::$(echo ${{ env.IMAGE_REGISTRY_PUSH_HOST }})"
+ echo "::set-output name=image-registry-pull-host::$(echo ${{ env.IMAGE_REGISTRY_PULL_HOST }})"
+ echo "::set-output name=image-registry-insecure::$(echo ${{ env.IMAGE_REGISTRY_INSECURE }})"
echo "::set-output name=kube-admin-user-ctx::$(echo ${{ env.KUBE_ADMIN_USER_CTX }})"
echo "::set-output name=kube-user-ctx::$(echo ${{ env.KUBE_USER_CTX }})"
+ echo "::set-output name=install-olm::$(echo ${{ env.INSTALL_OLM }})"
+
+ if [ -n "${{ env.IMAGE_NAMESPACE }}" ]; then
+ echo "::set-output name=image-namespace::$(echo ${{ env.IMAGE_NAMESPACE }})"
+ else
+ echo "::set-output name=image-namespace::$(echo ${{ env.DEFAULT_IMAGE_NAMESPACE }})"
+ fi
+
+ #
+ # Clear out environment variables
+ #
+ echo "TEST_PLATFORM_CLUSTER=" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_PUSH_HOST=" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
+ echo "IMAGE_REGISTRY_INSECURE=" >> $GITHUB_ENV
+ echo "KUBE_ADMIN_USER_CTX=" >> $GITHUB_ENV
+ echo "KUBE_USER_CTX=" >> $GITHUB_ENV
+ echo "INSTALL_OLM=" >> $GITHUB_ENV
+ echo "IMAGE_NAMESPACE=" >> $GITHUB_ENV
+ echo "DEFAULT_IMAGE_NAMESPACE=" >> $GITHUB_ENV
#
# Install opm if required
@@ -122,9 +138,9 @@ runs:
name: Install OLM
shell: bash
run: |
- if [ "${{ inputs.olm }}" != "true" ]; then
- # OLM not required
- echo "OLM not required"
+ if [ "${{ steps.platform-info.outputs.install-olm }}" == "false" ]; then
+ # OLM explicitly not required - installed by default
+ echo "OLM install not required for this cluster"
exit 0
fi
@@ -162,12 +178,18 @@ runs:
echo "Complete"
outputs:
- image-registry:
- description: "Registry for storing images"
- value: ${{ steps.platform-info.outputs.registry }}
+ image-registry-push-host:
+ description: "Registry for storing images host push interface"
+ value: ${{ steps.platform-info.outputs.image-registry-push-host }}
+ image-registry-pull-host:
+ description: "Registry for storing images host pull interface"
+ value: ${{ steps.platform-info.outputs.image-registry-pull-host }}
image-registry-insecure:
- description: "Whether the image registry require secure/authenticated access"
- value: ${{ steps.platform-info.outputs.registry-insecure }}
+ description: "Whether the image registry requires secure/authenticated access"
+ value: ${{ steps.platform-info.outputs.image-registry-insecure }}
+ image-namespace:
+ description: "Registry namespace for storing images"
+ value: ${{ steps.platform-info.outputs.image-namespace }}
kube-admin-user-ctx:
description: "The admin user context of the cluster"
value: ${{ steps.platform-info.outputs.kube-admin-user-ctx }}
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 24325717e7..8e77ddecfc 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -49,7 +49,6 @@ concurrency:
jobs:
upgrade:
-
runs-on: ubuntu-20.04
steps:
@@ -59,75 +58,7 @@ jobs:
persist-credentials: false
submodules: recursive
- - id: prepare-env
- name: Prepare Test Environment
- uses: ./.github/actions/kamel-prepare-env
- with:
- install-opm: true
-
- - id: configure-platform
- name: Configure Platform
- uses: ./.github/actions/kamel-config-cluster
+ - name: Execute Upgrade Tests
+ uses: ./.github/actions/e2e-upgrade
with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
- olm: true
-
- - 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-64bit.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
- sudo mv /tmp/kamel /usr/local/bin/
- if [ $? == 0 ]; then
- echo "Kamel version installed: $(kamel version)"
- else
- echo "ERROR: Failed to install kamel binary ${KAMEL_VERSION}"
- exit 1
- fi
-
- - id: build-kamel-binary
- name: Build Kamel Binary
- uses: ./.github/actions/kamel-build
- with:
- image-registry: ${{ steps.configure-platform.outputs.image-registry }}
- # Avoid overwriting last-released version of binary
- install-kamel-binary: false
-
- - id: build-kamel-bundle
- name: Build Kamel Metadata Bundle
- uses: ./.github/actions/kamel-build-bundle
- with:
- image-registry: ${{ steps.configure-platform.outputs.image-registry }}
- local-image-name: ${{ steps.build-kamel-binary.outputs.local-image-name }}
- local-image-version: ${{ steps.build-kamel-binary.outputs.local-image-version }}
-
- - name: Run IT
- run: |
- # Use the last released Kamel CLI
- export RELEASED_KAMEL_BIN=/usr/local/bin/kamel
-
- echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)"
-
- # Configure install options
- export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
- export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
-
- # Configure test options
- export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
- export CAMEL_K_NEW_IIB=${{ steps.build-kamel-bundle.outputs.local-image-bundle-index }}
- 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_PREV_UPGRADE_CHANNEL=${{ env.PREV_XY_CHANNEL }}
- export CAMEL_K_NEW_UPGRADE_CHANNEL=${{ env.NEW_XY_CHANNEL }}
-
- # Then run integration tests
- make test-upgrade
+ platform-config: ${{ secrets.E2E_PLATFORM_CONFIG }}
From ca451acc1dd697efaff8ac3ab2a8a1b45462c4b6 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 16 Nov 2021 17:15:19 +0000
Subject: [PATCH 06/40] Converts json-to-variables to private action using
submodule
---
.github/actions/json-to-variables | 1 +
.github/actions/kamel-config-cluster-custom/action.yml | 2 +-
.gitmodules | 4 ++++
3 files changed, 6 insertions(+), 1 deletion(-)
create mode 160000 .github/actions/json-to-variables
diff --git a/.github/actions/json-to-variables b/.github/actions/json-to-variables
new file mode 160000
index 0000000000..cc8c639403
--- /dev/null
+++ b/.github/actions/json-to-variables
@@ -0,0 +1 @@
+Subproject commit cc8c6394031e145c90f7f9ec909d83df92431fb8
diff --git a/.github/actions/kamel-config-cluster-custom/action.yml b/.github/actions/kamel-config-cluster-custom/action.yml
index 56bf532fee..1d521f8531 100644
--- a/.github/actions/kamel-config-cluster-custom/action.yml
+++ b/.github/actions/kamel-config-cluster-custom/action.yml
@@ -50,7 +50,7 @@ runs:
fi
- name: Platform-config JSON to variables
- uses: antifree/json-to-variables@v1.0.1
+ uses: ./.github/actions/json-to-variables
with:
filename: ${{ env.PLATFORM_CONFIG }}
prefix: 'e2e'
diff --git a/.gitmodules b/.gitmodules
index aa99c61594..2b7101c31a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -12,3 +12,7 @@
path = .github/actions/action-dotenv-to-setenv
url = https://github.com/c-py/action-dotenv-to-setenv.git
branch = tags/v3
+[submodule ".github/actions/json-to-variables"]
+ path = .github/actions/json-to-variables
+ url = https://github.com/antifree/json-to-variables.git
+ branch = tags/v1.0.1
From 6b71749e2743db9bdd3eb752e626d44fbc559ddb Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Mon, 13 Dec 2021 17:00:27 +0000
Subject: [PATCH 07/40] Converts kubernetes workflow to a composite action
---
.github/actions/e2e-kubernetes/action.yml | 76 +++++++++++++++++
.github/actions/e2e-upgrade/action.yml | 39 ++++-----
.github/actions/kamel-build-binary/action.yml | 82 +++++++++++++++++++
.../actions/kamel-build-bundle/action.yaml | 8 ++
.github/actions/kamel-build/action.yml | 81 +++++++++---------
.../kamel-config-cluster-custom/action.yml | 64 ++++++++++-----
.../kamel-config-cluster-kind/action.yml | 29 +++++--
.../kamel-config-cluster-ocp3/action.yml | 32 +++++++-
.../actions/kamel-config-cluster/action.yaml | 36 ++++----
.../kamel-install-cluster-setup/action.yml | 5 +-
.github/actions/kamel-prepare-env/action.yml | 64 +++++++++------
.github/workflows/builder.yml | 2 +-
.github/workflows/knative.yml | 4 +-
.github/workflows/kubernetes.yml | 43 +---------
.github/workflows/local.yml | 2 +-
.github/workflows/openshift.yml | 2 +-
16 files changed, 393 insertions(+), 176 deletions(-)
create mode 100644 .github/actions/e2e-kubernetes/action.yml
create mode 100644 .github/actions/kamel-build-binary/action.yml
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
new file mode 100644
index 0000000000..1f55653195
--- /dev/null
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -0,0 +1,76 @@
+# ---------------------------------------------------------------------------
+# 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-kubernetes
+description: 'End-to-End tests for 80/20 use-cases'
+
+inputs:
+ platform-config:
+ description: 'The configuration of the underlying cluster (if cluster-type is custom)'
+ required: false
+
+runs:
+ using: "composite"
+
+ steps:
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
+
+ - id: configure-platform
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
+ with:
+ cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
+ platform-config: ${{ inputs.platform-config }}
+
+ - id: build-kamel
+ name: Build Kamel
+ uses: ./.github/actions/kamel-build
+ with:
+ image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
+ image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
+ image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
+ # Builds the bundle if an OLM is available - depends on cluster being tested
+ build-bundle: ${{ steps.configure-platform.outputs.olm-available }}
+
+ - id: install-kamel-cluster-setup
+ name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
+ with:
+ kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
+
+ - id: run-it
+ name: Run IT
+ shell: bash
+ run: |
+ # Cluster environment
+ export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel.outputs.local-image-version }}
+
+ export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+ export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry-pull-host }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
+ export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
+ export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+
+ # Then run integration tests
+ make test-integration
+ make test-service-binding
+ make test-quarkus-native
+ make test-kustomize
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index 6edc9b518c..fb208220a2 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -30,8 +30,6 @@ runs:
- id: prepare-env
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- with:
- install-opm: true
- id: configure-platform
name: Configure Platform
@@ -39,6 +37,7 @@ runs:
with:
cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
platform-config: ${{ inputs.platform-config }}
+ require-olm: true
- name: Get Released Kamel CLI
shell: bash
@@ -64,25 +63,17 @@ runs:
exit 1
fi
- - id: build-kamel-binary
- name: Build Kamel Binary
+ - id: build-kamel
+ name: Build Kamel
uses: ./.github/actions/kamel-build
with:
image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
- # Avoid overwriting last-released version of binary
- install-kamel-binary: false
-
- - id: build-kamel-bundle
- name: Build Kamel Metadata Bundle
- uses: ./.github/actions/kamel-build-bundle
- with:
- image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
- image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
- image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
- local-image-name: ${{ steps.build-kamel-binary.outputs.local-image-name }}
- local-image-version: ${{ steps.build-kamel-binary.outputs.local-image-version }}
+ # Builds the bundle if an OLM is available.
+ # Since configure-platform requires OLM then this should be true
+ build-bundle: ${{ steps.configure-platform.outputs.olm-available }}
+ kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
- name: Run IT
shell: bash
@@ -93,17 +84,27 @@ runs:
echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)"
# Configure install options
- export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel.outputs.local-image-version }}
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry-pull-host }}
export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ # Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var
+
# Configure test options
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
- export CAMEL_K_NEW_IIB=${{ steps.build-kamel-bundle.outputs.local-image-bundle-index }}
+ export CAMEL_K_NEW_IIB=${{ steps.build-kamel.outputs.local-image-bundle-index }}
export KAMEL_K_TEST_RELEASE_VERSION=$(make get-last-released-version)
export KAMEL_K_TEST_OPERATOR_CURRENT_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# Then run integration tests
make test-upgrade
+
+ - name: Cleanup-Tests
+ if: ${{ always() }}
+ shell: bash
+ run: |
+ if [ -n "${{ env.PLATFORM_CONFIG }}" ]; then
+ rm -f ${{ env.PLATFORM_CONFIG }}
+ fi
diff --git a/.github/actions/kamel-build-binary/action.yml b/.github/actions/kamel-build-binary/action.yml
new file mode 100644
index 0000000000..959d26c624
--- /dev/null
+++ b/.github/actions/kamel-build-binary/action.yml
@@ -0,0 +1,82 @@
+# ---------------------------------------------------------------------------
+# 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: |
+ echo "Build Kamel from source"
+
+ if [ -n "${{ inputs.image-registry-push-host }}" ]; then
+ #
+ # Build with the PUSH host to ensure the correct image:tag
+ # for docker to push the image.
+ #
+ export CUSTOM_IMAGE=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k
+ fi
+
+ RULES="PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images"
+ if [ -n "${{ inputs.make-rules }}" ]; then
+ RULES="${{ inputs.make-rules }}"
+ fi
+
+ if [ -n "${{ inputs.image-registry-push-host }}" ]; then
+ RULES="${RULES} images-push"
+ fi
+
+ make ${RULES}
+
+ echo "Moving kamel binary to /usr/local/bin"
+ sudo mv ./kamel /usr/local/bin
+ 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
+ #
+ export LOCAL_IMAGE_NAME=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k
+ echo "::set-output name=local-img-name::$(echo ${LOCAL_IMAGE_NAME})"
+ echo "::set-output name=local-img-version::$(make get-version)"
+
+outputs:
+ local-image-name:
+ description: "Reference of the camel-k image"
+ value: ${{ steps.build-operator.outputs.local-img-name }}
+ local-image-version:
+ description: "Reference of the camel-k image version"
+ value: ${{ steps.build-operator.outputs.local-img-version }}
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index f0eff2cf36..ee2b56199e 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -97,6 +97,14 @@ runs:
export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}
echo "::set-output name=local-image-bundle::$(echo ${LOCAL_IMAGE_BUNDLE})"
+ - id: install-opm
+ name: Install opm if required
+ shell: bash
+ run: |
+ curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.16.1/linux-amd64-opm -o opm
+ chmod +x opm
+ sudo mv opm /usr/local/bin/
+
- id: build-index-image
name: Create New Index Image
shell: bash
diff --git a/.github/actions/kamel-build/action.yml b/.github/actions/kamel-build/action.yml
index f6af262847..8d14efa003 100644
--- a/.github/actions/kamel-build/action.yml
+++ b/.github/actions/kamel-build/action.yml
@@ -16,7 +16,7 @@
# ---------------------------------------------------------------------------
name: kamel-build
-description: 'Builds kamel operator binary'
+description: 'Builds kamel operator image and the bundle'
inputs:
image-registry-push-host:
@@ -29,60 +29,55 @@ inputs:
description: 'Namespace in which to store the image'
required: false
default: 'apache'
- make-rules:
- description: 'Override the default make rules'
- required: false
install-kamel-binary:
description: 'Install the kamel binary onto the path'
required: false
default: true
+ 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
runs:
using: "composite"
steps:
- - id: build-operator
- name: Build Kamel Operator
- shell: bash
- run: |
- echo "Build Kamel from source"
-
- if [ -n "${{ inputs.image-registry-push-host }}" ]; then
- #
- # Build with the PUSH host to ensure the correct image:tag
- # for docker to push the image.
- #
- export CUSTOM_IMAGE=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k
- fi
-
- RULES="PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images"
- if [ -n "${{ inputs.make-rules }}" ]; then
- RULES="${{ inputs.make-rules }}"
- fi
-
- if [ -n "${{ inputs.image-registry-push-host }}" ]; then
- RULES="${RULES} images-push"
- fi
-
- make ${RULES}
-
- if [ "${{ inputs.install-kamel-binary }}" == "true" ]; then
- echo "Moving kamel binary to /usr/local/bin"
- sudo mv ./kamel /usr/local/bin
- echo "Kamel version installed: $(kamel version)"
- fi
+ - 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 }}
+ install-kamel-binary: ${{ inputs.install-kamel-binary }}
- #
- # Use the PULL host to ensure the correct image:tag
- # is passed into the tests for the deployment to pull from
- #
- export LOCAL_IMAGE_NAME=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k
- echo "::set-output name=local-img-name::$(echo ${LOCAL_IMAGE_NAME})"
- echo "::set-output name=local-img-version::$(make get-version)"
+ #
+ # By default do not build the image bundle
+ #
+ - id: build-kamel-bundle
+ name: Build Kamel Metadata Bundle
+ uses: ./.github/actions/kamel-build-bundle
+ if: ${{ inputs.build-bundle != true }}
+ 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.local-image-name }}
+ local-image-version: ${{ steps.build-kamel-binary.outputs.local-image-version }}
outputs:
local-image-name:
description: "Reference of the camel-k image"
- value: ${{ steps.build-operator.outputs.local-img-name }}
+ value: ${{ steps.build-kamel-binary.outputs.local-image-name }}
local-image-version:
description: "Reference of the camel-k image version"
- value: ${{ steps.build-operator.outputs.local-img-version }}
+ value: ${{ steps.build-kamel-binary.outputs.local-image-version }}
+ local-image-bundle:
+ description: "Reference of the camel-k metadata bundle image"
+ value: ${{ steps.build-kamel-bundle.outputs.local-image-bundle }}
+ local-image-bundle-index:
+ description: "Reference of the camel-k metadata bundle index image"
+ value: ${{ steps.build-kamel-bundle.outputs.local-image-bundle-index }}
diff --git a/.github/actions/kamel-config-cluster-custom/action.yml b/.github/actions/kamel-config-cluster-custom/action.yml
index 1d521f8531..dca1939bf0 100644
--- a/.github/actions/kamel-config-cluster-custom/action.yml
+++ b/.github/actions/kamel-config-cluster-custom/action.yml
@@ -24,8 +24,17 @@ runs:
- name: Read platform-config variable to temporary file & override PLATFORM_TYPE if platform config defined
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
export PLATFORM_CONFIG=/tmp/platform-config.json
+ if [ -f ${PLATFORM_CONFIG} ]; then
+ rm -f ${PLATFORM_CONFIG}
+ fi
+
touch "${PLATFORM_CONFIG}"
if [ -z "${{ env.PLATFORM_CONFIG_DATA }}" ]; then
echo "Error: No PLATFORM_CONFIG_DATA has been defined"
@@ -50,15 +59,24 @@ runs:
fi
- name: Platform-config JSON to variables
- uses: ./.github/actions/json-to-variables
+ uses: ./.github/actions/conditional
with:
- filename: ${{ env.PLATFORM_CONFIG }}
- prefix: 'e2e'
+ if: ${{ env.CLUSTER_CONFIGURED != 'true' }}
+ step: |
+ uses: ./.github/actions/json-to-variables
+ with:
+ filename: ${{ env.PLATFORM_CONFIG }}
+ prefix: 'e2e'
- id: connect-cluster
name: Connect to cluster
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
if [ -z "${{ env.e2e_kube-config-data }}" ]; then
echo "Error: kube config data property cannot be found"
exit 1
@@ -112,14 +130,24 @@ runs:
name: Info
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
kubectl describe nodes
- id: configure-developer-user
name: Configure Developer User
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
# Aggregate pod eviction permission to the default admin role
- cat <> $GITHUB_ENV
echo "IMAGE_REGISTRY_PULL_HOST=${{ env.e2e_image-registry-pull-host }}" >> $GITHUB_ENV
echo "IMAGE_REGISTRY_INSECURE=${{ env.e2e_image-registry-insecure }}" >> $GITHUB_ENV
@@ -195,21 +229,11 @@ runs:
echo "KUBE_USER_CTX=${{ env.e2e_kube-user-ctx }}" >> $GITHUB_ENV
#
- # Export the flag for installing olm
+ # Export the flag for olm capability
#
- echo "INSTALL_OLM=${{ env.e2e_install-olm }}" >> $GITHUB_ENV
+ echo "HAS_OLM=${{ env.e2e_has-olm }}" >> $GITHUB_ENV
#
- # Clear out environment variables no longer required
+ # Avoid configuring the cluster repeatedly
#
- echo "PLATFORM_CONFIG=" >> $GITHUB_ENV
- echo "e2e_image-registry-push-host=" >> $GITHUB_ENV
- echo "e2e_image-registry-pull-host=" >> $GITHUB_ENV
- echo "e2e_image-namespace=" >> $GITHUB_ENV
- echo "e2e_image-registry-user=" >> $GITHUB_ENV
- echo "e2e_image-registry-token=" >> $GITHUB_ENV
- echo "e2e_image-registry-insecure=" >> $GITHUB_ENV
- echo "e2e_kube-admin-user-ctx=" >> $GITHUB_ENV
- echo "e2e_kube-config-data=" >> $GITHUB_ENV
- echo "e2e_kube-user-ctx=" >> $GITHUB_ENV
- echo "e2e_install-olm=" >> $GITHUB_ENV
+ echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster-kind/action.yml b/.github/actions/kamel-config-cluster-kind/action.yml
index e6b62b8b94..7181b36381 100644
--- a/.github/actions/kamel-config-cluster-kind/action.yml
+++ b/.github/actions/kamel-config-cluster-kind/action.yml
@@ -23,20 +23,35 @@ runs:
steps:
- id: install-cluster
name: Install Cluster
- uses: container-tools/kind-action@v1
+ uses: ./.github/actions/conditional
with:
- version: v0.11.0
- node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
+ if: ${{ env.CLUSTER_CONFIGURED != 'true' }}
+ step: |
+ uses: container-tools/kind-action@v1
+ with:
+ version: v0.11.0
+ node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
+
- id: info
name: Info
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
kubectl cluster-info
kubectl describe nodes
- id: extract-config
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
# Kind has the same interface for both pushing and pulling images in its registry
echo "IMAGE_REGISTRY_PUSH_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
echo "IMAGE_REGISTRY_PULL_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
@@ -50,7 +65,11 @@ runs:
echo "KUBE_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
#
- # Export the flag for installing olm
+ # Export the flag for olm capability
#
- echo "INSTALL_OLM=true" >> $GITHUB_ENV
+ echo "HAS_OLM=false" >> $GITHUB_ENV
+ #
+ # Avoid configuring the cluster repeatedly
+ #
+ echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster-ocp3/action.yml b/.github/actions/kamel-config-cluster-ocp3/action.yml
index a113361b90..330389df5f 100644
--- a/.github/actions/kamel-config-cluster-ocp3/action.yml
+++ b/.github/actions/kamel-config-cluster-ocp3/action.yml
@@ -24,6 +24,11 @@ runs:
- name: Get OpenShift Client (oc)
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
export OPENSHIFT_VERSION=v3.11.0
export OPENSHIFT_COMMIT=0cbc58b
export MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
@@ -53,6 +58,11 @@ runs:
name: Start OpenShift Cluster
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
# Figure out this host's IP address
IP_ADDR="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)"
@@ -91,12 +101,22 @@ runs:
name: Info
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
oc describe nodes
- id: configure-developer-user
name: Configure Developer User
shell: bash
run: |
+ if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
+ echo "Cluster configuration already performed ... skipping"
+ exit 0
+ fi
+
# Aggregate pod eviction permission to the default admin role
cat <> $GITHUB_ENV
echo "IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
echo "IMAGE_REGISTRY_INSECURE=false" >> $GITHUB_ENV
- echo "INSTALL_OLM=false" >> $GITHUB_ENV
+ echo "HAS_OLM=true" >> $GITHUB_ENV
+
+ #
+ # Avoid configuring the cluster repeatedly
+ #
+ echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster/action.yaml b/.github/actions/kamel-config-cluster/action.yaml
index 393baad0a8..894fb34adc 100644
--- a/.github/actions/kamel-config-cluster/action.yaml
+++ b/.github/actions/kamel-config-cluster/action.yaml
@@ -26,6 +26,9 @@ inputs:
platform-config:
description: 'The JSON configuration of the platform - required for custom platform type only'
required: false
+ require-olm:
+ description: 'If OLM is not available by default ensure that it is installed'
+ default: false
runs:
using: "composite"
@@ -97,7 +100,7 @@ runs:
echo "::set-output name=image-registry-insecure::$(echo ${{ env.IMAGE_REGISTRY_INSECURE }})"
echo "::set-output name=kube-admin-user-ctx::$(echo ${{ env.KUBE_ADMIN_USER_CTX }})"
echo "::set-output name=kube-user-ctx::$(echo ${{ env.KUBE_USER_CTX }})"
- echo "::set-output name=install-olm::$(echo ${{ env.INSTALL_OLM }})"
+ echo "::set-output name=has-olm::$(echo ${{ env.HAS_OLM }})"
if [ -n "${{ env.IMAGE_NAMESPACE }}" ]; then
echo "::set-output name=image-namespace::$(echo ${{ env.IMAGE_NAMESPACE }})"
@@ -105,19 +108,6 @@ runs:
echo "::set-output name=image-namespace::$(echo ${{ env.DEFAULT_IMAGE_NAMESPACE }})"
fi
- #
- # Clear out environment variables
- #
- echo "TEST_PLATFORM_CLUSTER=" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_PUSH_HOST=" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_INSECURE=" >> $GITHUB_ENV
- echo "KUBE_ADMIN_USER_CTX=" >> $GITHUB_ENV
- echo "KUBE_USER_CTX=" >> $GITHUB_ENV
- echo "INSTALL_OLM=" >> $GITHUB_ENV
- echo "IMAGE_NAMESPACE=" >> $GITHUB_ENV
- echo "DEFAULT_IMAGE_NAMESPACE=" >> $GITHUB_ENV
-
#
# Install opm if required
#
@@ -138,9 +128,17 @@ runs:
name: Install OLM
shell: bash
run: |
- if [ "${{ steps.platform-info.outputs.install-olm }}" == "false" ]; then
- # OLM explicitly not required - installed by default
- echo "OLM install not required for this cluster"
+ if [ "${{ steps.platform-info.outputs.has-olm }}" == "true" ]; then
+ # OLM already installed by default
+ echo "OLM already available in cluster"
+ echo "::set-output name=has-olm::$(echo true)"
+ exit 0
+ fi
+
+ if [ "${{ inputs.require-olm }}" != "true" ]; then
+ # OLM not explicitly requested
+ echo "OLM not explicity required for testing"
+ echo "::set-output name=has-olm::$(echo false)"
exit 0
fi
@@ -176,6 +174,7 @@ runs:
kubectl config use-context "${ctx}"
echo "Complete"
+ echo "::set-output name=has-olm::$(echo true)"
outputs:
image-registry-push-host:
@@ -196,3 +195,6 @@ outputs:
kube-user-ctx:
description: "The user context of the cluster"
value: ${{ steps.platform-info.outputs.kube-user-ctx }}
+ olm-available:
+ description: "Whether an OLM service is available in the cluster"
+ value: ${{ steps.install-olm.outputs.has-olm }}
diff --git a/.github/actions/kamel-install-cluster-setup/action.yml b/.github/actions/kamel-install-cluster-setup/action.yml
index e1ac5bbff1..a0f17ae33c 100644
--- a/.github/actions/kamel-install-cluster-setup/action.yml
+++ b/.github/actions/kamel-install-cluster-setup/action.yml
@@ -40,7 +40,10 @@ runs:
#
kubectl config use-context "${{ inputs.kube-admin-user-ctx }}"
- kamel install --cluster-setup
+ #
+ # Ensure built binary CRDs are always installed by turning off olm
+ #
+ kamel install --cluster-setup --olm=false
#
# Change back to original context
diff --git a/.github/actions/kamel-prepare-env/action.yml b/.github/actions/kamel-prepare-env/action.yml
index 36b9278098..f3ec4581ab 100644
--- a/.github/actions/kamel-prepare-env/action.yml
+++ b/.github/actions/kamel-prepare-env/action.yml
@@ -18,12 +18,6 @@
name: kamel-prepare-env
description: 'Initialise the test environment with tools'
-inputs:
- install-opm:
- description: 'Install opm alongside cluster for bundle-related operations'
- required: false
- default: false
-
runs:
using: "composite"
steps:
@@ -42,6 +36,14 @@ runs:
- name: Cleanup
shell: bash
run: |
+ #
+ # Only perform the cleaning once.
+ #
+ if [ "${{ env.ENV_PREPARED }}" == "true" ]; then
+ echo "Cleaning of docker already performed ... skipping"
+ exit 0
+ fi
+
ls -lart
echo "Initial status:"
df -h
@@ -67,18 +69,34 @@ runs:
df -h
- name: Set up JDK 11
- uses: AdoptOpenJDK/install-jdk@v1
+ uses: ./.github/actions/conditional
with:
- version: "11"
+ if: ${{ env.ENV_PREPARED != 'true' }}
+ step: |
+ uses: AdoptOpenJDK/install-jdk@v1
+ with:
+ version: "11"
- name: Set Go
- uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
+ uses: ./.github/actions/conditional
with:
- go-version: 1.16.x
+ if: ${{ env.ENV_PREPARED != 'true' }}
+ step: |
+ uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
+ with:
+ go-version: 1.16.x
- name: (Re-)install kustomize
shell: bash
run: |
+ #
+ # Only perform the kustomize install once.
+ #
+ if [ "${{ env.ENV_PREPARED }}" == "true" ]; then
+ echo "Install of kustomize already performed ... skipping"
+ exit 0
+ fi
+
# reinstall kustomize to be always on the same version
sudo rm $(which kustomize)
make kustomize
@@ -91,22 +109,13 @@ runs:
# Install a version of kubectl for generic access to cluster
#
- id: install-kubectl
- uses: azure/setup-kubectl@v1
+ uses: ./.github/actions/conditional
with:
- version: 'latest'
-
- #
- # Install opm if required
- #
- - id: install-opm
- name: Install opm if required
- shell: bash
- run: |
- if [ "${{ inputs.install-opm }}" == "true" ]; then
- curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.19.5/linux-amd64-opm -o opm
- chmod +x opm
- sudo mv opm /usr/local/bin/
- fi
+ if: ${{ env.ENV_PREPARED != 'true' }}
+ step: |
+ uses: azure/setup-kubectl@v1
+ with:
+ version: 'latest'
- id: report-platform
name: Report Platform
@@ -118,6 +127,11 @@ runs:
echo "::set-output name=platform::$(echo kind)"
fi
+ #
+ # Avoid preparing the environment repeatedly
+ #
+ echo "ENV_PREPARED=true" >> $GITHUB_ENV
+
outputs:
cluster-platform:
description: "Preferred environment set by .env file (default 'kind')"
diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
index f78cc67ce0..888e128090 100644
--- a/.github/workflows/builder.yml
+++ b/.github/workflows/builder.yml
@@ -80,7 +80,7 @@ jobs:
- id: build-kamel-binary
name: Build Kamel Binary
- uses: ./.github/actions/kamel-build
+ uses: ./.github/actions/kamel-build-binary
with:
image-registry: ${{ steps.configure-platform.outputs.image-registry }}
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index 950b1272e0..e9048b0ca8 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -73,7 +73,7 @@ jobs:
- id: build-kamel-binary
name: Build Kamel Binary
- uses: ./.github/actions/kamel-build
+ uses: ./.github/actions/kamel-build-binary
with:
image-registry: ${{ steps.configure-platform.outputs.image-registry }}
@@ -136,7 +136,7 @@ jobs:
- id: build-kamel-binary
name: Build Kamel Binary
- uses: ./.github/actions/kamel-build
+ uses: ./.github/actions/kamel-build-binary
with:
image-registry: ${{ steps.configure-platform.outputs.image-registry }}
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index ca23a018b5..fa5b64cae2 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -59,44 +59,7 @@ jobs:
persist-credentials: false
submodules: recursive
- - id: prepare-env
- name: Prepare Test Environment
- uses: ./.github/actions/kamel-prepare-env
-
- - id: configure-platform
- name: Configure Platform
- uses: ./.github/actions/kamel-config-cluster
- with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
-
- - id: build-kamel-binary
- name: Build Kamel Binary
- uses: ./.github/actions/kamel-build
- with:
- image-registry: ${{ steps.configure-platform.outputs.image-registry }}
-
- - name: Install Kamel Cluster Setup
- uses: ./.github/actions/kamel-install-cluster-setup
+ - name: Execute Tests
+ uses: ./.github/actions/e2e-kubernetes
with:
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
-
- - name: Run IT
- run: |
- # Cluster environment
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
- export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
- export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
- export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
- export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
-
- # Test options
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
-
- # Then run integration tests
- make test-integration
- make test-service-binding
- make test-quarkus-native
- make test-kustomize
+ platform-config: ${{ secrets.E2E_PLATFORM_CONFIG }}
diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml
index 16d8eb6a83..cd8a9a23da 100644
--- a/.github/workflows/local.yml
+++ b/.github/workflows/local.yml
@@ -65,7 +65,7 @@ jobs:
- id: build-kamel-binary
name: Build Kamel Binary
- uses: ./.github/actions/kamel-build
+ uses: ./.github/actions/kamel-build-binary
with:
make-rules: 'build-kamel'
diff --git a/.github/workflows/openshift.yml b/.github/workflows/openshift.yml
index 64d28b61f9..0470dbb152 100644
--- a/.github/workflows/openshift.yml
+++ b/.github/workflows/openshift.yml
@@ -71,7 +71,7 @@ jobs:
- id: build-kamel-binary
name: Build Kamel Binary
- uses: ./.github/actions/kamel-build
+ uses: ./.github/actions/kamel-build-binary
- name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
From 7e0637c4c4c5f9ed0bb27c13e830618b2f213851 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 23 Nov 2021 18:25:18 +0000
Subject: [PATCH 08/40] Migrate if to full workflow & refactor action outputs
* If conditional syntax now added to composite actions so can replace the
interim conditional workaround action with built-in syntax
* Replace action outputs with global environment variables
* Easier to debug as printed in logs
* If actions are if-conditioned to not execute, if already run, then
their outputs will not exist whereas global env vars will. This makes
it possible to retain the env vars while skipping repeated executions
of the same actions
---
.github/.env | 2 +-
.github/actions/conditional | 1 -
.github/actions/e2e-kubernetes/action.yml | 26 ++---
.github/actions/e2e-upgrade/action.yml | 46 +++-----
.github/actions/kamel-build-binary/action.yml | 13 +--
.../actions/kamel-build-bundle/action.yaml | 30 ++---
.github/actions/kamel-build/action.yml | 25 +---
.../kamel-config-cluster-custom/action.yml | 96 +++++++--------
.../kamel-config-cluster-kind/action.yml | 37 +++---
.../kamel-config-cluster-ocp3/action.yml | 44 ++-----
.../actions/kamel-config-cluster/action.yaml | 110 +++++-------------
.github/actions/kamel-prepare-env/action.yml | 69 ++++-------
.github/workflows/kubernetes.yml | 2 +-
.github/workflows/upgrade.yml | 2 +-
.gitmodules | 4 -
15 files changed, 164 insertions(+), 343 deletions(-)
delete mode 160000 .github/actions/conditional
diff --git a/.github/.env b/.github/.env
index cd5940c1d9..eae28d66a3 100644
--- a/.github/.env
+++ b/.github/.env
@@ -1 +1 @@
-TEST_PLATFORM_CLUSTER=kind
+TEST_CLUSTER=kind
diff --git a/.github/actions/conditional b/.github/actions/conditional
deleted file mode 160000
index 3fce4b7a31..0000000000
--- a/.github/actions/conditional
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 3fce4b7a3171a839b482306f9fd3aba0c2112a24
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index 1f55653195..05b84db810 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -19,7 +19,7 @@ name: e2e-kubernetes
description: 'End-to-End tests for 80/20 use-cases'
inputs:
- platform-config:
+ cluster-config-data:
description: 'The configuration of the underlying cluster (if cluster-type is custom)'
required: false
@@ -31,40 +31,40 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-platform
+ - id: configure-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
- platform-config: ${{ inputs.platform-config }}
+ cluster-type: ${{ env.TEST_CLUSTER }}
+ cluster-config-data: ${{ inputs.cluster-config-data }}
- id: build-kamel
name: Build Kamel
uses: ./.github/actions/kamel-build
with:
- image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
- image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
- image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
+ image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
+ image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
# Builds the bundle if an OLM is available - depends on cluster being tested
- build-bundle: ${{ steps.configure-platform.outputs.olm-available }}
+ build-bundle: ${{ env.CLUSTER_HAS_OLM }}
- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
with:
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
+ kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
- id: run-it
name: Run IT
shell: bash
run: |
# Cluster environment
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.local-image-version }}
+ export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index fb208220a2..b2516b6fd8 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -19,7 +19,7 @@ name: e2e-upgrade
description: 'End-to-End tests for upgrading to new version'
inputs:
- platform-config:
+ cluster-config-data:
description: 'The configuration of the underlying cluster (if cluster-type is custom)'
required: false
@@ -31,12 +31,12 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-platform
- name: Configure Platform
+ - id: configure-cluster
+ name: Configure Cluster
uses: ./.github/actions/kamel-config-cluster
with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
- platform-config: ${{ inputs.platform-config }}
+ cluster-type: ${{ env.TEST_CLUSTER }}
+ cluster-config-data: ${{ inputs.cluster-config-data }}
require-olm: true
- name: Get Released Kamel CLI
@@ -51,13 +51,13 @@ runs:
fi
#
- # Note: cannot use GITHUB_ENV vars is same script as it was defined
+ # Note: cannot use GITHUB_ENV vars in same script as it was defined
#
export RELEASED_KAMEL_BINARY=/tmp/kamel-${KAMEL_VERSION}
- echo "RELEASED_KAMEL_BINARY=${RELEASED_KAMEL_BINARY}" >> $GITHUB_ENV
mv /tmp/kamel ${RELEASED_KAMEL_BINARY}
if [ $? == 0 ]; then
echo "Info: Kamel version installed: $(${RELEASED_KAMEL_BINARY} version)"
+ echo "E2E_UPGRADE_RELEASED_KAMEL_BINARY=${RELEASED_KAMEL_BINARY}" >> $GITHUB_ENV
else
echo "Error: Failed to install kamel binary ${KAMEL_VERSION}"
exit 1
@@ -67,44 +67,36 @@ runs:
name: Build Kamel
uses: ./.github/actions/kamel-build
with:
- image-registry-push-host: ${{ steps.configure-platform.outputs.image-registry-push-host }}
- image-registry-pull-host: ${{ steps.configure-platform.outputs.image-registry-pull-host }}
- image-namespace: ${{ steps.configure-platform.outputs.image-namespace }}
+ image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
+ image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
# Builds the bundle if an OLM is available.
- # Since configure-platform requires OLM then this should be true
- build-bundle: ${{ steps.configure-platform.outputs.olm-available }}
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
+ # Since configure-cluster requires OLM then this should be true
+ build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
- name: Run IT
shell: bash
run: |
# Use the last released Kamel CLI
- export RELEASED_KAMEL_BIN=${{ env.RELEASED_KAMEL_BINARY }}
+ export RELEASED_KAMEL_BIN=${{ env.E2E_UPGRADE_RELEASED_KAMEL_BINARY }}
echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)"
# Configure install options
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.local-image-version }}
+ export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
+ export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
# Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var
# Configure test options
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
- export CAMEL_K_NEW_IIB=${{ steps.build-kamel.outputs.local-image-bundle-index }}
+ export CAMEL_K_NEW_IIB=${{ env.BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX }}
export KAMEL_K_TEST_RELEASE_VERSION=$(make get-last-released-version)
export KAMEL_K_TEST_OPERATOR_CURRENT_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
# Then run integration tests
make test-upgrade
-
- - name: Cleanup-Tests
- if: ${{ always() }}
- shell: bash
- run: |
- if [ -n "${{ env.PLATFORM_CONFIG }}" ]; then
- rm -f ${{ env.PLATFORM_CONFIG }}
- fi
diff --git a/.github/actions/kamel-build-binary/action.yml b/.github/actions/kamel-build-binary/action.yml
index 959d26c624..e2216fa0b2 100644
--- a/.github/actions/kamel-build-binary/action.yml
+++ b/.github/actions/kamel-build-binary/action.yml
@@ -69,14 +69,5 @@ runs:
# Use the PULL host to ensure the correct image:tag
# is passed into the tests for the deployment to pull from
#
- export LOCAL_IMAGE_NAME=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k
- echo "::set-output name=local-img-name::$(echo ${LOCAL_IMAGE_NAME})"
- echo "::set-output name=local-img-version::$(make get-version)"
-
-outputs:
- local-image-name:
- description: "Reference of the camel-k image"
- value: ${{ steps.build-operator.outputs.local-img-name }}
- local-image-version:
- description: "Reference of the camel-k image version"
- value: ${{ steps.build-operator.outputs.local-img-version }}
+ echo "BUILD_BINARY_LOCAL_IMAGE_NAME=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k" >> $GITHUB_ENV
+ echo "BUILD_BINARY_LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index ee2b56199e..e490b416c5 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -94,16 +94,18 @@ runs:
# Use the PULL host to ensure the correct image:tag
# is passed into the tests for the deployment to pull from
#
- export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}
- echo "::set-output name=local-image-bundle::$(echo ${LOCAL_IMAGE_BUNDLE})"
+ echo "BUILD_BUNDLE_LOCAL_IMAGE=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}" >> $GITHUB_ENV
- id: install-opm
name: Install opm if required
shell: bash
run: |
- curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.16.1/linux-amd64-opm -o opm
- chmod +x opm
- sudo mv opm /usr/local/bin/
+ if ! command -v opm &> /dev/null
+ then
+ curl -L https://github.com/operator-framework/operator-registry/releases/download/v1.16.1/linux-amd64-opm -o opm
+ chmod +x opm
+ sudo mv opm /usr/local/bin/
+ fi
- id: build-index-image
name: Create New Index Image
@@ -165,11 +167,11 @@ runs:
#
docker tag \
${PUSH_REGISTRY}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }} \
- ${{ steps.build-bundle-image.outputs.local-image-bundle }}
+ ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }}
# Push the bundle image to the registry
#
- docker push ${{ steps.build-bundle-image.outputs.local-image-bundle }}
+ docker push ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }}
fi
#
@@ -177,19 +179,9 @@ runs:
#
opm index add \
-c docker --skip-tls \
- --bundles ${{ steps.build-bundle-image.outputs.local-image-bundle }} \
+ --bundles ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }} \
--from-index quay.io/operatorhubio/catalog:latest \
--tag ${LOCAL_IIB}
docker push ${LOCAL_IIB}
-
- export LOCAL_IIB=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}
- echo "::set-output name=local-image-bundle-index::$(echo ${LOCAL_IIB})"
-
-outputs:
- local-image-bundle:
- description: "Reference of the camel-k metadata bundle image"
- value: ${{ steps.build-bundle-image.outputs.local-image-bundle }}
- local-image-bundle-index:
- description: "Reference of the camel-k metadata bundle index image"
- value: ${{ steps.build-index-image.outputs.local-image-bundle-index }}
+ echo "BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-build/action.yml b/.github/actions/kamel-build/action.yml
index 8d14efa003..1d23a34359 100644
--- a/.github/actions/kamel-build/action.yml
+++ b/.github/actions/kamel-build/action.yml
@@ -29,10 +29,6 @@ inputs:
description: 'Namespace in which to store the image'
required: false
default: 'apache'
- install-kamel-binary:
- description: 'Install the kamel binary onto the path'
- required: false
- default: true
make-rules:
description: 'Override the default make rules'
required: false
@@ -52,7 +48,6 @@ runs:
image-registry-pull-host: ${{ inputs.image-registry-pull-host }}
image-namespace: ${{ inputs.image-namespace }}
make-rules: ${{ inputs.make-rules }}
- install-kamel-binary: ${{ inputs.install-kamel-binary }}
#
# By default do not build the image bundle
@@ -60,24 +55,10 @@ runs:
- id: build-kamel-bundle
name: Build Kamel Metadata Bundle
uses: ./.github/actions/kamel-build-bundle
- if: ${{ inputs.build-bundle != true }}
+ if: ${{ inputs.build-bundle == 'true' }}
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.local-image-name }}
- local-image-version: ${{ steps.build-kamel-binary.outputs.local-image-version }}
-
-outputs:
- local-image-name:
- description: "Reference of the camel-k image"
- value: ${{ steps.build-kamel-binary.outputs.local-image-name }}
- local-image-version:
- description: "Reference of the camel-k image version"
- value: ${{ steps.build-kamel-binary.outputs.local-image-version }}
- local-image-bundle:
- description: "Reference of the camel-k metadata bundle image"
- value: ${{ steps.build-kamel-bundle.outputs.local-image-bundle }}
- local-image-bundle-index:
- description: "Reference of the camel-k metadata bundle index image"
- value: ${{ steps.build-kamel-bundle.outputs.local-image-bundle-index }}
+ local-image-name: ${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ local-image-version: ${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
diff --git a/.github/actions/kamel-config-cluster-custom/action.yml b/.github/actions/kamel-config-cluster-custom/action.yml
index dca1939bf0..bb566e20b7 100644
--- a/.github/actions/kamel-config-cluster-custom/action.yml
+++ b/.github/actions/kamel-config-cluster-custom/action.yml
@@ -18,65 +18,59 @@
name: kamel-config-cluster-custom
description: 'Provides configuration for acessing a custom kubernetes cluster'
+inputs:
+ cluster-config-data:
+ description: 'The JSON configuration of the cluster'
+ required: true
+
runs:
using: "composite"
steps:
- - name: Read platform-config variable to temporary file & override PLATFORM_TYPE if platform config defined
+ - name: Read cluster-config-data variable to temporary file & override CLUSTER_TYPE if cluster config defined
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
- export PLATFORM_CONFIG=/tmp/platform-config.json
+ export CLUSTER_CONFIG_FILE=/tmp/cluster-config.json
- if [ -f ${PLATFORM_CONFIG} ]; then
- rm -f ${PLATFORM_CONFIG}
+ if [ -f ${CLUSTER_CONFIG_FILE} ]; then
+ rm -f ${CLUSTER_CONFIG_FILE}
fi
- touch "${PLATFORM_CONFIG}"
- if [ -z "${{ env.PLATFORM_CONFIG_DATA }}" ]; then
- echo "Error: No PLATFORM_CONFIG_DATA has been defined"
+ touch "${CLUSTER_CONFIG_FILE}"
+ if [ -z "${{ inputs.cluster-config-data }}" ]; then
+ echo "Error: No cluster-config-data parameter has been defined"
exit 1
fi
- cat << EOF > "${PLATFORM_CONFIG}"
- ${{ env.PLATFORM_CONFIG_DATA }}
+ cat << EOF > "${CLUSTER_CONFIG_FILE}"
+ ${{ inputs.cluster-config-data }}
EOF
- if [ ! -f "${PLATFORM_CONFIG}" ]; then
- echo "Error: No file ${PLATFORM_CONFIG} has been created"
+ if [ ! -f "${CLUSTER_CONFIG_FILE}" ]; then
+ echo "Error: No file ${CLUSTER_CONFIG_FILE} has been created"
exit 1
fi
- if [ -s "${PLATFORM_CONFIG}" ]; then
- echo "Info: Platform configuration defined"
- echo "PLATFORM_CONFIG=${PLATFORM_CONFIG}" >> $GITHUB_ENV
+ if [ -s "${CLUSTER_CONFIG_FILE}" ]; then
+ echo "Info: Cluster configuration defined"
+ echo "CLUSTER_CONFIG_FILE=${CLUSTER_CONFIG_FILE}" >> $GITHUB_ENV
else
- echo "Error: No platform configuration defined"
+ echo "Error: No cluster configuration defined"
exit 1
fi
- - name: Platform-config JSON to variables
- uses: ./.github/actions/conditional
+ - name: Cluster config JSON to variables
+ uses: ./.github/actions/json-to-variables
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
with:
- if: ${{ env.CLUSTER_CONFIGURED != 'true' }}
- step: |
- uses: ./.github/actions/json-to-variables
- with:
- filename: ${{ env.PLATFORM_CONFIG }}
- prefix: 'e2e'
+ filename: ${{ env.CLUSTER_CONFIG_FILE }}
+ prefix: 'e2e'
- id: connect-cluster
name: Connect to cluster
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
if [ -z "${{ env.e2e_kube-config-data }}" ]; then
echo "Error: kube config data property cannot be found"
exit 1
@@ -129,23 +123,15 @@ runs:
- id: info
name: Info
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
kubectl describe nodes
- id: configure-developer-user
name: Configure Developer User
shell: bash
+ if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
# Aggregate pod eviction permission to the default admin role
cat <> $GITHUB_ENV
- echo "IMAGE_REGISTRY_PULL_HOST=${{ env.e2e_image-registry-pull-host }}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_INSECURE=${{ env.e2e_image-registry-insecure }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PUSH_HOST=${{ env.e2e_image-registry-push-host }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=${{ env.e2e_image-registry-pull-host }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_INSECURE=${{ env.e2e_image-registry-insecure }}" >> $GITHUB_ENV
#
- # Export the image namespace if defined in the platform config
+ # Export the image namespace if defined in the cluster config
#
if [ -n "${{ env.e2e_image-namespace }}" ]; then
- echo "IMAGE_NAMESPACE=${{ env.e2e_image-namespace }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_NAMESPACE=${{ env.e2e_image-namespace }}" >> $GITHUB_ENV
fi
#
# Export the context used for admin and user
#
- echo "KUBE_ADMIN_USER_CTX=${{ env.e2e_kube-admin-user-ctx }}" >> $GITHUB_ENV
- echo "KUBE_USER_CTX=${{ env.e2e_kube-user-ctx }}" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_ADMIN_USER_CTX=${{ env.e2e_kube-admin-user-ctx }}" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_USER_CTX=${{ env.e2e_kube-user-ctx }}" >> $GITHUB_ENV
#
# Export the flag for olm capability
#
- echo "HAS_OLM=${{ env.e2e_has-olm }}" >> $GITHUB_ENV
+ echo "CLUSTER_HAS_OLM=${{ env.e2e_has-olm }}" >> $GITHUB_ENV
#
# Avoid configuring the cluster repeatedly
#
- echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
+ echo "CLUSTER_CUSTOM_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster-kind/action.yml b/.github/actions/kamel-config-cluster-kind/action.yml
index 7181b36381..e6803948a3 100644
--- a/.github/actions/kamel-config-cluster-kind/action.yml
+++ b/.github/actions/kamel-config-cluster-kind/action.yml
@@ -23,53 +23,42 @@ runs:
steps:
- id: install-cluster
name: Install Cluster
- uses: ./.github/actions/conditional
+ uses: container-tools/kind-action@v1
+ if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }}
with:
- if: ${{ env.CLUSTER_CONFIGURED != 'true' }}
- step: |
- uses: container-tools/kind-action@v1
- with:
- version: v0.11.0
- node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
+ version: v0.11.0
+ node_image: kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- id: info
name: Info
shell: bash
+ if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
kubectl cluster-info
kubectl describe nodes
- id: extract-config
shell: bash
+ if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
# Kind has the same interface for both pushing and pulling images in its registry
- echo "IMAGE_REGISTRY_PUSH_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_PULL_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_INSECURE=true" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PUSH_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_INSECURE=true" >> $GITHUB_ENV
#
# Export the context used for admin and user
# Since kind has no rbac switched on then these can be the same
#
- echo "KUBE_ADMIN_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
- echo "KUBE_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_ADMIN_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
#
# Export the flag for olm capability
#
- echo "HAS_OLM=false" >> $GITHUB_ENV
+ echo "CLUSTER_HAS_OLM=false" >> $GITHUB_ENV
#
# Avoid configuring the cluster repeatedly
#
- echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
+ echo "CLUSTER_KIND_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster-ocp3/action.yml b/.github/actions/kamel-config-cluster-ocp3/action.yml
index 330389df5f..2be4ca9add 100644
--- a/.github/actions/kamel-config-cluster-ocp3/action.yml
+++ b/.github/actions/kamel-config-cluster-ocp3/action.yml
@@ -23,12 +23,8 @@ runs:
steps:
- name: Get OpenShift Client (oc)
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
export OPENSHIFT_VERSION=v3.11.0
export OPENSHIFT_COMMIT=0cbc58b
export MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
@@ -57,12 +53,8 @@ runs:
- id: start-openshift
name: Start OpenShift Cluster
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
# Figure out this host's IP address
IP_ADDR="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)"
@@ -76,7 +68,7 @@ runs:
oc login -u system:admin
# Export the context used for admin login
- echo "KUBE_ADMIN_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
+ echo "CLUSTER_KUBE_ADMIN_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
# Wait until we have a ready node in openshift
TIMEOUT=0
@@ -100,23 +92,15 @@ runs:
- id: info
name: Info
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
oc describe nodes
- id: configure-developer-user
name: Configure Developer User
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
# Aggregate pod eviction permission to the default admin role
cat <> $GITHUB_ENV
+ echo "CLUSTER_KUBE_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
- id: extract-kube-config
shell: bash
+ if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- if [ "${{ env.CLUSTER_CONFIGURED }}" == "true" ]; then
- echo "Cluster configuration already performed ... skipping"
- exit 0
- fi
-
- echo "IMAGE_REGISTRY_PUSH_HOST=" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
- echo "IMAGE_REGISTRY_INSECURE=false" >> $GITHUB_ENV
- echo "HAS_OLM=true" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PUSH_HOST=" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
+ echo "CLUSTER_IMAGE_REGISTRY_INSECURE=false" >> $GITHUB_ENV
+ echo "CLUSTER_HAS_OLM=true" >> $GITHUB_ENV
#
# Avoid configuring the cluster repeatedly
#
- echo "CLUSTER_CONFIGURED=true" >> $GITHUB_ENV
+ echo "CLUSTER_OCP3_CONFIGURED=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-config-cluster/action.yaml b/.github/actions/kamel-config-cluster/action.yaml
index 894fb34adc..7e87850825 100644
--- a/.github/actions/kamel-config-cluster/action.yaml
+++ b/.github/actions/kamel-config-cluster/action.yaml
@@ -16,15 +16,15 @@
# ---------------------------------------------------------------------------
name: kamel-config-cluster
-description: 'Delegates to respective cluster action depending on type of requested platform'
+description: 'Delegates to respective cluster action depending on type of requested cluster'
inputs:
cluster-type:
description: 'The type of cluster required: [kind, ocp3, custom]'
required: true
default: 'kind'
- platform-config:
- description: 'The JSON configuration of the platform - required for custom platform type only'
+ cluster-config-data:
+ description: 'The JSON configuration of the cluster - required for custom cluster type only'
required: false
require-olm:
description: 'If OLM is not available by default ensure that it is installed'
@@ -33,79 +33,51 @@ inputs:
runs:
using: "composite"
steps:
- - name: Override platform type if there is a custom platform-config
+ - name: Override cluster type if there is a custom cluster-config
shell: bash
run: |
- if [ -n "${{ inputs.platform-config }}" ]; then
+ if [ -n "${{ inputs.cluster-config-data }}" ]; then
#
- # Have custom platform-config so override platform-type
+ # Have custom cluster-config-data so override cluster-type
#
- echo "PLATFORM_TYPE=custom" >> $GITHUB_ENV
+ echo "CLUSTER_TYPE=custom" >> $GITHUB_ENV
else
- echo "Info: No platform configuration supplied."
- echo "PLATFORM_TYPE=${{ inputs.cluster-type }}" >> $GITHUB_ENV
+ echo "Info: No cluster configuration supplied."
+ echo "CLUSTER_TYPE=${{ inputs.cluster-type }}" >> $GITHUB_ENV
fi
- #
- # TODO
- # Due to lack of if in steps, need to use conditional action which
- # does not currently include output support so have to put all vars
- # as environment vars. When either ChristopherHX or github support allow
- # for alternative then update accordingly.
- #
- id: execute-kind
name: Maybe Execute Kind Cluster
- uses: ./.github/actions/conditional
- with:
- if: ${{ env.PLATFORM_TYPE == 'kind' }}
- step: |
- uses: ./.github/actions/kamel-config-cluster-kind
+ uses: ./.github/actions/kamel-config-cluster-kind
+ if: ${{ env.CLUSTER_TYPE == 'kind' }}
- id: execute-ocp3
name: Maybe Execute Minishift Cluster
- uses: ./.github/actions/conditional
- with:
- if: ${{ env.PLATFORM_TYPE == 'ocp3' }}
- step: |
- uses: ./.github/actions/kamel-config-cluster-ocp3
+ uses: ./.github/actions/kamel-config-cluster-ocp3
+ if: ${{ env.CLUSTER_TYPE == 'ocp3' }}
- id: execute-custom
name: Maybe Execute Custom Cluster
- uses: ./.github/actions/conditional
- env:
- PLATFORM_CONFIG_DATA: ${{ inputs.platform-config }}
+ uses: ./.github/actions/kamel-config-cluster-custom
+ if: ${{ env.CLUSTER_TYPE == 'custom' }}
with:
- if: ${{ env.PLATFORM_TYPE == 'custom' }}
- step: |
- uses: ./.github/actions/kamel-config-cluster-custom
+ cluster-config-data: ${{ inputs.cluster-config-data }}
- id: execute-invalid
name: Execute Invalid Cluster
- uses: ./.github/actions/conditional
- with:
- if: ${{ env.PLATFORM_TYPE != 'kind' && env.PLATFORM_TYPE != 'ocp3' && env.PLATFORM_TYPE != 'custom' }}
- step: |
- shell: bash
- run: |
- echo "Error: Unrecognised platform request for type of cluster. Should be kind, ocp3 or custom."
- exit 1
-
- - id: platform-info
+ if: ${{ env.CLUSTER_TYPE != 'kind' && env.CLUSTER_TYPE != 'ocp3' && env.CLUSTER_TYPE != 'custom' }}
+ shell: bash
+ run: |
+ echo "Error: Unrecognised cluster request for type of cluster. Should be kind, ocp3 or custom."
+ exit 1
+
+ - id: image-namespace
shell: bash
env:
DEFAULT_IMAGE_NAMESPACE: 'apache'
run: |
- echo "::set-output name=image-registry-push-host::$(echo ${{ env.IMAGE_REGISTRY_PUSH_HOST }})"
- echo "::set-output name=image-registry-pull-host::$(echo ${{ env.IMAGE_REGISTRY_PULL_HOST }})"
- echo "::set-output name=image-registry-insecure::$(echo ${{ env.IMAGE_REGISTRY_INSECURE }})"
- echo "::set-output name=kube-admin-user-ctx::$(echo ${{ env.KUBE_ADMIN_USER_CTX }})"
- echo "::set-output name=kube-user-ctx::$(echo ${{ env.KUBE_USER_CTX }})"
- echo "::set-output name=has-olm::$(echo ${{ env.HAS_OLM }})"
-
- if [ -n "${{ env.IMAGE_NAMESPACE }}" ]; then
- echo "::set-output name=image-namespace::$(echo ${{ env.IMAGE_NAMESPACE }})"
- else
- echo "::set-output name=image-namespace::$(echo ${{ env.DEFAULT_IMAGE_NAMESPACE }})"
+ if [ -z "${{ env.CLUSTER_IMAGE_NAMESPACE }}" ]; then
+ echo "CLUSTER_IMAGE_NAMESPACE=apache" >> $GITHUB_ENV
fi
#
@@ -128,17 +100,16 @@ runs:
name: Install OLM
shell: bash
run: |
- if [ "${{ steps.platform-info.outputs.has-olm }}" == "true" ]; then
+ if [ "${{ env.CLUSTER_HAS_OLM }}" == "true" ]; then
# OLM already installed by default
echo "OLM already available in cluster"
- echo "::set-output name=has-olm::$(echo true)"
exit 0
fi
if [ "${{ inputs.require-olm }}" != "true" ]; then
# OLM not explicitly requested
echo "OLM not explicity required for testing"
- echo "::set-output name=has-olm::$(echo false)"
+ echo "CLUSTER_HAS_OLM=false" >> $GITHUB_ENV
exit 0
fi
@@ -152,7 +123,7 @@ runs:
# Need to be admin so switch to the admin context
#
echo "Change to kube admin context"
- kubectl config use-context "${{ steps.platform-info.outputs.kube-admin-user-ctx }}"
+ kubectl config use-context "${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}"
set +e
echo "Check if OLM is already installed"
@@ -174,27 +145,4 @@ runs:
kubectl config use-context "${ctx}"
echo "Complete"
- echo "::set-output name=has-olm::$(echo true)"
-
-outputs:
- image-registry-push-host:
- description: "Registry for storing images host push interface"
- value: ${{ steps.platform-info.outputs.image-registry-push-host }}
- image-registry-pull-host:
- description: "Registry for storing images host pull interface"
- value: ${{ steps.platform-info.outputs.image-registry-pull-host }}
- image-registry-insecure:
- description: "Whether the image registry requires secure/authenticated access"
- value: ${{ steps.platform-info.outputs.image-registry-insecure }}
- image-namespace:
- description: "Registry namespace for storing images"
- value: ${{ steps.platform-info.outputs.image-namespace }}
- kube-admin-user-ctx:
- description: "The admin user context of the cluster"
- value: ${{ steps.platform-info.outputs.kube-admin-user-ctx }}
- kube-user-ctx:
- description: "The user context of the cluster"
- value: ${{ steps.platform-info.outputs.kube-user-ctx }}
- olm-available:
- description: "Whether an OLM service is available in the cluster"
- value: ${{ steps.install-olm.outputs.has-olm }}
+ echo "CLUSTER_HAS_OLM=true" >> $GITHUB_ENV
diff --git a/.github/actions/kamel-prepare-env/action.yml b/.github/actions/kamel-prepare-env/action.yml
index f3ec4581ab..45871e10b1 100644
--- a/.github/actions/kamel-prepare-env/action.yml
+++ b/.github/actions/kamel-prepare-env/action.yml
@@ -16,7 +16,7 @@
# ---------------------------------------------------------------------------
name: kamel-prepare-env
-description: 'Initialise the test environment with tools'
+description: 'Initialise the test environment with tools. (Will only run once per workflow)'
runs:
using: "composite"
@@ -28,22 +28,19 @@ runs:
# clean-up since that step removes all docker image in order to
# claim back as much space as possible.
#
+ # Expects env file with following vars:
+ # TEST_CLUSTER
+ #
- id: read-env-file
uses: ./.github/actions/action-dotenv-to-setenv
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
with:
env-file: .github/.env
- name: Cleanup
shell: bash
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
run: |
- #
- # Only perform the cleaning once.
- #
- if [ "${{ env.ENV_PREPARED }}" == "true" ]; then
- echo "Cleaning of docker already performed ... skipping"
- exit 0
- fi
-
ls -lart
echo "Initial status:"
df -h
@@ -69,34 +66,21 @@ runs:
df -h
- name: Set up JDK 11
- uses: ./.github/actions/conditional
+ uses: AdoptOpenJDK/install-jdk@v1
+ if: ${{ env.ENV_PREPARED != 'true' }}
with:
- if: ${{ env.ENV_PREPARED != 'true' }}
- step: |
- uses: AdoptOpenJDK/install-jdk@v1
- with:
- version: "11"
+ version: "11"
- name: Set Go
- uses: ./.github/actions/conditional
+ uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
with:
- if: ${{ env.ENV_PREPARED != 'true' }}
- step: |
- uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
- with:
- go-version: 1.16.x
+ go-version: 1.16.x
- name: (Re-)install kustomize
shell: bash
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
run: |
- #
- # Only perform the kustomize install once.
- #
- if [ "${{ env.ENV_PREPARED }}" == "true" ]; then
- echo "Install of kustomize already performed ... skipping"
- exit 0
- fi
-
# reinstall kustomize to be always on the same version
sudo rm $(which kustomize)
make kustomize
@@ -109,30 +93,17 @@ runs:
# Install a version of kubectl for generic access to cluster
#
- id: install-kubectl
- uses: ./.github/actions/conditional
+ uses: azure/setup-kubectl@v1
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
with:
- if: ${{ env.ENV_PREPARED != 'true' }}
- step: |
- uses: azure/setup-kubectl@v1
- with:
- version: 'latest'
+ version: 'latest'
- - id: report-platform
- name: Report Platform
+ - id: complete-action
+ name: Environment Prepared
shell: bash
+ if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
run : |
- if [ -n "${{ env.TEST_PLATFORM_CLUSTER }}" ]; then
- echo "::set-output name=platform::$(echo ${{ env.TEST_PLATFORM_CLUSTER }})"
- else
- echo "::set-output name=platform::$(echo kind)"
- fi
-
#
# Avoid preparing the environment repeatedly
#
- echo "ENV_PREPARED=true" >> $GITHUB_ENV
-
-outputs:
- cluster-platform:
- description: "Preferred environment set by .env file (default 'kind')"
- value: ${{ steps.report-platform.outputs.platform }}
+ echo "KAMEL_PREPARE_ENV=true" >> $GITHUB_ENV
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index fa5b64cae2..55ce811170 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -62,4 +62,4 @@ jobs:
- name: Execute Tests
uses: ./.github/actions/e2e-kubernetes
with:
- platform-config: ${{ secrets.E2E_PLATFORM_CONFIG }}
+ cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 8e77ddecfc..7967dc0553 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -61,4 +61,4 @@ jobs:
- name: Execute Upgrade Tests
uses: ./.github/actions/e2e-upgrade
with:
- platform-config: ${{ secrets.E2E_PLATFORM_CONFIG }}
+ cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
diff --git a/.gitmodules b/.gitmodules
index 2b7101c31a..237f21a3dd 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,10 +4,6 @@
[submodule ".github/actions/changelog"]
path = .github/actions/changelog
url = https://github.com/CharMixer/auto-changelog-action
-[submodule ".github/actions/conditional"]
- path = .github/actions/conditional
- url = https://github.com/ChristopherHX/conditional.git
- branch = 3fce4b7a3171a839b482306f9fd3aba0c2112a24
[submodule ".github/actions/action-dotenv-to-setenv"]
path = .github/actions/action-dotenv-to-setenv
url = https://github.com/c-py/action-dotenv-to-setenv.git
From b48b921f2a85f95130525b68d36eee1ec78cd905 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 23 Nov 2021 18:26:02 +0000
Subject: [PATCH 09/40] Adds the creation of a catalog source to tests
* Since the bundle is built by default for OLM-enabled cluster, the tests
need a catalog source with which to access it. Having it created within
each namespace does not work as the catalogsource can take a couple of
restarts to execute correctly. Therefore, a single catalogsource created
prior to the test-running is far more effective.
---
.github/actions/e2e-kubernetes/action.yml | 10 +++++
.github/actions/e2e-upgrade/action.yml | 3 +-
.../actions/kamel-build-bundle/action.yaml | 38 +++++++++++++++++++
.github/actions/kamel-build/action.yml | 4 ++
.../kamel-config-cluster-custom/action.yml | 1 +
5 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index 05b84db810..44adb5f182 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -47,6 +47,8 @@ runs:
image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
# Builds the bundle if an OLM is available - depends on cluster being tested
build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ # Can be empty and so catalog source will not be created
+ catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
@@ -62,6 +64,14 @@ runs:
export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+ #
+ # If bundle has been built and installed then use it
+ #
+ if [ -n "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ export KAMEL_INSTALL_OLM_SOURCE=${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}
+ fi
+
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index b2516b6fd8..5b3c36a35f 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -73,7 +73,8 @@ runs:
# Builds the bundle if an OLM is available.
# Since configure-cluster requires OLM then this should be true
build-bundle: ${{ env.CLUSTER_HAS_OLM }}
- kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
+ # Can be empty and so catalog source will not be created
+ catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
- name: Run IT
shell: bash
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index e490b416c5..54cc48f757 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -35,6 +35,9 @@ inputs:
local-image-version:
description: "Reference of the camel-k image version"
required: true
+ catalog-source-namespace:
+ description: 'Namespace in which to install the catalog source for the bundle (if required)'
+ required: false
runs:
using: "composite"
@@ -185,3 +188,38 @@ runs:
docker push ${LOCAL_IIB}
echo "BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}" >> $GITHUB_ENV
+
+ - id: build-image-catalog
+ name: Create a new catalog to host the index image
+ shell: bash
+ run: |
+
+ if [ -z "${{ inputs.catalog-source-namespace }}" ]; then
+ echo "No catalog source namespace defined ... skipping catalog source creation"
+ exit 0
+ fi
+
+ kubectl get ns ${{ inputs.catalog-source-namespace }} &> /dev/null
+ if [ $? != 0 ]; then
+ echo "Error: Catalog source cannot be created as namespace ${{ inputs.catalog-source-namespace }} does not exist."
+ exit 1
+ fi
+
+ export BUILD_CATALOG_SOURCE="camel-k-test-source"
+ echo "BUILD_BUNDLE_CATALOG_SOURCE=${BUILD_CATALOG_SOURCE}" >> $GITHUB_ENV
+
+ cat <> $GITHUB_ENV
echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=${{ env.e2e_image-registry-pull-host }}" >> $GITHUB_ENV
echo "CLUSTER_IMAGE_REGISTRY_INSECURE=${{ env.e2e_image-registry-insecure }}" >> $GITHUB_ENV
+ echo "CLUSTER_CATALOG_SOURCE_NAMESPACE=${{ env.e2e_catalog-source-namespace }}" >> $GITHUB_ENV
#
# Export the image namespace if defined in the cluster config
From 58562b6d83bee3671a3f874dc02135b5acfd9acb Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 23 Nov 2021 18:08:39 +0000
Subject: [PATCH 10/40] camel-k-operator service-account needs to access OLM
* The tekton test uses the camel-k-operator sa for installing the kamel
operator but lacks the necessary permissions for accessing the OLM, inc.
clusterserviceversion and subscription.
---
config/rbac/operator-role.yaml | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/config/rbac/operator-role.yaml b/config/rbac/operator-role.yaml
index 0941d6ee29..e50508176a 100644
--- a/config/rbac/operator-role.yaml
+++ b/config/rbac/operator-role.yaml
@@ -165,3 +165,24 @@ rules:
- patch
- update
- watch
+- apiGroups:
+ - operators.coreos.com
+ resources:
+ - operatorgroups
+ - subscriptions
+ - installplans
+ verbs:
+ - create
+ - delete
+ - update
+ - get
+ - list
+ - watch
+- apiGroups:
+ - operators.coreos.com
+ resources:
+ - clusterserviceversions
+ verbs:
+ - get
+ - list
+ - watch
From 506101ef95bf903894bcfb1eeecd0066bde8e2ac Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 23 Nov 2021 18:11:19 +0000
Subject: [PATCH 11/40] Adds a cleanup action for post workflow clearing up of
the cluster
* Since the cluster is being used more than once in custom use-cases, the
cleaning up and resetting becomes crucial.
---
.github/actions/e2e-kubernetes/action.yml | 4 ++
.github/actions/e2e-upgrade/action.yml | 4 ++
.github/actions/kamel-cleanup/action.yaml | 49 +++++++++++++++++++++++
3 files changed, 57 insertions(+)
create mode 100644 .github/actions/kamel-cleanup/action.yaml
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index 44adb5f182..4d290d6657 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -84,3 +84,7 @@ runs:
make test-service-binding
make test-quarkus-native
make test-kustomize
+
+ - name: Cleanup
+ uses: ./.github/actions/kamel-cleanup
+ if: ${{ always() }}
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index 5b3c36a35f..9ea4ed86db 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -101,3 +101,7 @@ runs:
# Then run integration tests
make test-upgrade
+
+ - name: Cleanup
+ uses: ./.github/actions/kamel-cleanup
+ if: ${{ always() }}
diff --git a/.github/actions/kamel-cleanup/action.yaml b/.github/actions/kamel-cleanup/action.yaml
new file mode 100644
index 0000000000..fce145100f
--- /dev/null
+++ b/.github/actions/kamel-cleanup/action.yaml
@@ -0,0 +1,49 @@
+# ---------------------------------------------------------------------------
+# 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-cleanup
+description: 'Cleans up the target cluster, removing any e2e test resources'
+
+runs:
+ using: "composite"
+ steps:
+ - id: remove-installed-camel-crds
+ name: Remove Installed Camel CRDs
+ shell: bash
+ if: ${{ always() }}
+ run: |
+ set +e
+ kubectl get crds | grep camel | awk '{print $1}' | xargs kubectl delete crd &> /dev/null
+ set -e
+
+ - id: remove-kamel-catalog-source
+ name: Remove Catalog Source
+ shell: bash
+ if: ${{ always() }}
+ run: |
+ if [ -z "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
+ # Catalog source never defined so nothing to do
+ exit 0
+ fi
+
+ set +e
+ CATALOG_NS=$(kubectl get catalogsource --all-namespaces | grep ${{ env.BUILD_BUNDLE_CATALOG_SOURCE }} | awk {'print $1'})
+ for ns in ${CATALOG_NS}
+ do
+ kubectl delete CatalogSource ${{ env.BUILD_BUNDLE_CATALOG_SOURCE }} -n ${ns}
+ done
+ set -e
From aa02db4f42af8603c118800b71d89448cb0ccb7e Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Wed, 24 Nov 2021 12:32:26 +0000
Subject: [PATCH 12/40] Adds ability to skip build by downloading existing
binary build image
---
.github/actions/kamel-build-binary/action.yml | 32 +++++++++++++------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/.github/actions/kamel-build-binary/action.yml b/.github/actions/kamel-build-binary/action.yml
index e2216fa0b2..1355bf2a56 100644
--- a/.github/actions/kamel-build-binary/action.yml
+++ b/.github/actions/kamel-build-binary/action.yml
@@ -40,8 +40,6 @@ runs:
name: Build Kamel Operator
shell: bash
run: |
- echo "Build Kamel from source"
-
if [ -n "${{ inputs.image-registry-push-host }}" ]; then
#
# Build with the PUSH host to ensure the correct image:tag
@@ -50,16 +48,30 @@ runs:
export CUSTOM_IMAGE=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k
fi
- RULES="PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images"
- if [ -n "${{ inputs.make-rules }}" ]; then
- RULES="${{ inputs.make-rules }}"
- fi
+ if [ -n "${{ env.DEBUG_USE_EXISTING_IMAGE }}" ] && [ -n "${CUSTOM_IMAGE}" ]; then
+ echo "Fetching Kamel from existing build"
- if [ -n "${{ inputs.image-registry-push-host }}" ]; then
- RULES="${RULES} images-push"
- fi
+ docker pull ${{ env.DEBUG_USE_EXISTING_IMAGE }}
+ id=$(docker create ${{ env.DEBUG_USE_EXISTING_IMAGE }})
+ docker cp $id:/usr/local/bin/kamel .
+
+ docker tag ${{ env.DEBUG_USE_EXISTING_IMAGE }} ${CUSTOM_IMAGE}:$(make get-version)
+ docker push ${CUSTOM_IMAGE}:$(make get-version)
+ else
- make ${RULES}
+ echo "Build Kamel from source"
+
+ RULES="PACKAGE_ARTIFACTS_STRATEGY=download build package-artifacts images"
+ if [ -n "${{ inputs.make-rules }}" ]; then
+ RULES="${{ inputs.make-rules }}"
+ fi
+
+ if [ -n "${{ inputs.image-registry-push-host }}" ]; then
+ RULES="${RULES} images-push"
+ fi
+
+ make ${RULES}
+ fi
echo "Moving kamel binary to /usr/local/bin"
sudo mv ./kamel /usr/local/bin
From 24870a140cd11c39c630f9e1bffd95bda39c4a9f Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Wed, 24 Nov 2021 15:09:40 +0000
Subject: [PATCH 13/40] Mask potentially sensitive values in the log
---
.github/actions/kamel-config-cluster-custom/action.yml | 10 ++++++++++
.github/actions/kamel-prepare-env/action.yml | 3 +++
2 files changed, 13 insertions(+)
diff --git a/.github/actions/kamel-config-cluster-custom/action.yml b/.github/actions/kamel-config-cluster-custom/action.yml
index 9af8276247..e5986e1025 100644
--- a/.github/actions/kamel-config-cluster-custom/action.yml
+++ b/.github/actions/kamel-config-cluster-custom/action.yml
@@ -71,6 +71,16 @@ runs:
shell: bash
if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
+ echo "::add-mask::${{ env.e2e_kube-config-data }}"
+ echo "::add-mask::${{ env.e2e_kube-admin-user-ctx }}"
+ echo "::add-mask::${{ env.e2e_kube-user-ctx }}"
+ echo "::add-mask::${{ env.e2e_image-registry-pull-host }}"
+ echo "::add-mask::${{ env.e2e_image-registry-push-host }}"
+ echo "::add-mask::${{ env.e2e_image-registry-user }}"
+ echo "::add-mask::${{ env.e2e_image-registry-token }}"
+ echo "::add-mask::${{ env.e2e_image-namespace }}"
+ echo "::add-mask::${{ env.e2e_catalog-source-namespace }}"
+
if [ -z "${{ env.e2e_kube-config-data }}" ]; then
echo "Error: kube config data property cannot be found"
exit 1
diff --git a/.github/actions/kamel-prepare-env/action.yml b/.github/actions/kamel-prepare-env/action.yml
index 45871e10b1..666ae87f3b 100644
--- a/.github/actions/kamel-prepare-env/action.yml
+++ b/.github/actions/kamel-prepare-env/action.yml
@@ -103,6 +103,9 @@ runs:
shell: bash
if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
run : |
+
+ echo "::add-mask::${{ env.DEBUG_USE_EXISTING_IMAGE }}"
+
#
# Avoid preparing the environment repeatedly
#
From 30bb37bd160ccd15f9ab377293da5ab1785a0d5f Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Wed, 24 Nov 2021 21:34:28 +0000
Subject: [PATCH 14/40] Converts remaining e2e tests to actions
* Modifies workflows accordingly
---
.github/actions/e2e-build/action.yml | 40 ++++++
.github/actions/e2e-builder/action.yml | 91 ++++++++++++++
.github/actions/e2e-knative-yaks/action.yml | 99 +++++++++++++++
.github/actions/e2e-knative/action.yml | 93 ++++++++++++++
.github/actions/e2e-local/action.yml | 43 +++++++
.github/actions/kamel-install-yaks/action.yml | 35 ++++++
.github/workflows/build.yml | 16 +--
.github/workflows/builder.yml | 49 +-------
.github/workflows/knative.yml | 114 ++----------------
.github/workflows/local.yml | 19 +--
10 files changed, 421 insertions(+), 178 deletions(-)
create mode 100644 .github/actions/e2e-build/action.yml
create mode 100644 .github/actions/e2e-builder/action.yml
create mode 100644 .github/actions/e2e-knative-yaks/action.yml
create mode 100644 .github/actions/e2e-knative/action.yml
create mode 100644 .github/actions/e2e-local/action.yml
create mode 100644 .github/actions/kamel-install-yaks/action.yml
diff --git a/.github/actions/e2e-build/action.yml b/.github/actions/e2e-build/action.yml
new file mode 100644
index 0000000000..feaad8cde1
--- /dev/null
+++ b/.github/actions/e2e-build/action.yml
@@ -0,0 +1,40 @@
+# ---------------------------------------------------------------------------
+# 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-build
+description: 'End-to-End tests for build use-cases'
+
+runs:
+ using: "composite"
+
+ steps:
+
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
+
+ - name: Cache modules
+ uses: actions/cache@v1
+ with:
+ path: ~/go/pkg/mod
+ key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
+ restore-keys: |
+ ${{ runner.os }}-go-
+
+ - name: Test
+ shell: bash
+ run: make
diff --git a/.github/actions/e2e-builder/action.yml b/.github/actions/e2e-builder/action.yml
new file mode 100644
index 0000000000..68f931101b
--- /dev/null
+++ b/.github/actions/e2e-builder/action.yml
@@ -0,0 +1,91 @@
+# ---------------------------------------------------------------------------
+# 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-builder
+description: 'End-to-End tests for builder use-cases'
+
+inputs:
+ cluster-config-data:
+ description: 'The configuration of the underlying cluster (if cluster-type is custom)'
+ required: false
+ publisher:
+ description: 'The publishing strategy to be used'
+ required: true
+
+runs:
+ using: "composite"
+
+ steps:
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
+
+ - id: configure-cluster
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
+ with:
+ cluster-type: ${{ env.TEST_CLUSTER }}
+ cluster-config-data: ${{ inputs.cluster-config-data }}
+
+ - id: build-kamel
+ name: Build Kamel
+ uses: ./.github/actions/kamel-build
+ with:
+ image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
+ image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ # Builds the bundle if an OLM is available - depends on cluster being tested
+ build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ # Can be empty and so catalog source will not be created
+ catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
+
+ - id: install-kamel-cluster-setup
+ name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
+ with:
+ kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
+
+ - id: run-it
+ name: Run IT
+ shell: bash
+ env:
+ KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ inputs.publisher }}
+ run: |
+ # Cluster environment
+ export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+
+ #
+ # If bundle has been built and installed then use it
+ #
+ if [ -n "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ export KAMEL_INSTALL_OLM_SOURCE=${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}
+ fi
+
+ export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
+ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
+ export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
+ export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+
+ # Then run integration tests
+ make test-builder
+
+ - name: Cleanup
+ uses: ./.github/actions/kamel-cleanup
+ if: ${{ always() }}
diff --git a/.github/actions/e2e-knative-yaks/action.yml b/.github/actions/e2e-knative-yaks/action.yml
new file mode 100644
index 0000000000..e72e4ce3cc
--- /dev/null
+++ b/.github/actions/e2e-knative-yaks/action.yml
@@ -0,0 +1,99 @@
+# ---------------------------------------------------------------------------
+# 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-yaks
+description: 'End-to-End tests for knative use-cases using yaks'
+
+inputs:
+ cluster-config-data:
+ description: 'The configuration of the underlying cluster (if cluster-type is custom)'
+ required: false
+
+runs:
+ using: "composite"
+
+ steps:
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
+
+ - id: configure-cluster
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
+ with:
+ cluster-type: ${{ env.TEST_CLUSTER }}
+ cluster-config-data: ${{ inputs.cluster-config-data }}
+
+ - name: Install YAKS
+ uses: ./.github/actions/kamel-install-yaks
+
+ - name: Install Knative
+ uses: ./.github/actions/kamel-install-knative
+
+ - id: build-kamel
+ name: Build Kamel
+ uses: ./.github/actions/kamel-build
+ with:
+ image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
+ image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ # Builds the bundle if an OLM is available - depends on cluster being tested
+ build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ # Can be empty and so catalog source will not be created
+ catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
+
+ - id: install-kamel-cluster-setup
+ name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
+ with:
+ kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
+
+ - id: run-it
+ name: Run IT
+ shell: bash
+ run: |
+ # Cluster environment
+ export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+
+ #
+ # If bundle has been built and installed then use it
+ #
+ if [ -n "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ export KAMEL_INSTALL_OLM_SOURCE=${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}
+ fi
+
+ export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
+ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
+ export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
+ export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+
+ # Test options
+ export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+ export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
+
+ # Install Yaks globally
+ yaks install
+
+ # Then run integration tests
+ yaks test e2e/yaks/common
+
+ - name: Cleanup
+ uses: ./.github/actions/kamel-cleanup
+ if: ${{ always() }}
diff --git a/.github/actions/e2e-knative/action.yml b/.github/actions/e2e-knative/action.yml
new file mode 100644
index 0000000000..1c929d34d9
--- /dev/null
+++ b/.github/actions/e2e-knative/action.yml
@@ -0,0 +1,93 @@
+# ---------------------------------------------------------------------------
+# 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
+
+runs:
+ using: "composite"
+
+ steps:
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
+
+ - id: configure-cluster
+ name: Configure Platform
+ uses: ./.github/actions/kamel-config-cluster
+ with:
+ cluster-type: ${{ env.TEST_CLUSTER }}
+ cluster-config-data: ${{ inputs.cluster-config-data }}
+
+ - name: Install Knative
+ uses: ./.github/actions/kamel-install-knative
+
+ - id: build-kamel
+ name: Build Kamel
+ uses: ./.github/actions/kamel-build
+ with:
+ image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
+ image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ # Builds the bundle if an OLM is available - depends on cluster being tested
+ build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ # Can be empty and so catalog source will not be created
+ catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
+
+ - id: install-kamel-cluster-setup
+ name: Install Kamel Cluster Setup
+ uses: ./.github/actions/kamel-install-cluster-setup
+ with:
+ kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
+
+ - id: run-it
+ name: Run IT
+ shell: bash
+ run: |
+ # Cluster environment
+ export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
+ export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+
+ #
+ # If bundle has been built and installed then use it
+ #
+ if [ -n "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ export KAMEL_INSTALL_OLM_SOURCE=${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}
+ fi
+
+ export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
+ export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
+ export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
+ export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+
+ # Test options
+ export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+ export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
+
+ # Then run integration tests
+ make test-knative
+
+ - name: Cleanup
+ uses: ./.github/actions/kamel-cleanup
+ if: ${{ always() }}
diff --git a/.github/actions/e2e-local/action.yml b/.github/actions/e2e-local/action.yml
new file mode 100644
index 0000000000..47a9d27896
--- /dev/null
+++ b/.github/actions/e2e-local/action.yml
@@ -0,0 +1,43 @@
+# ---------------------------------------------------------------------------
+# 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-local
+description: 'End-to-End tests for local use-cases'
+
+runs:
+ using: "composite"
+
+ steps:
+ - id: prepare-env
+ name: Prepare Test Environment
+ uses: ./.github/actions/kamel-prepare-env
+
+ - id: build-kamel
+ name: Build Kamel
+ uses: ./.github/actions/kamel-build
+ with:
+ make-rules: 'build-kamel'
+
+ - id: run-it
+ name: Run IT
+ shell: bash
+ run: |
+ # Configure staging repos
+ export KAMEL_LOCAL_RUN_MAVEN_REPOSITORIES=$(make get-staging-repo)
+
+ # Then run integration tests
+ make test-local
diff --git a/.github/actions/kamel-install-yaks/action.yml b/.github/actions/kamel-install-yaks/action.yml
new file mode 100644
index 0000000000..7eb72f0cc0
--- /dev/null
+++ b/.github/actions/kamel-install-yaks/action.yml
@@ -0,0 +1,35 @@
+# ---------------------------------------------------------------------------
+# 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-install-yaks
+description: 'Install YAKS artifacts'
+runs:
+ using: "composite"
+ steps:
+ - id: get-yaks
+ name: Get YAKS
+ shell: bash
+ run: |
+ export YAKS_VERSION=0.4.0
+ curl --fail -L https://github.com/citrusframework/yaks/releases/download/v${YAKS_VERSION}/yaks-${YAKS_VERSION}-linux-64bit.tar.gz -o yaks.tar.gz
+ tar -zxf yaks.tar.gz
+ sudo mv yaks /usr/local/bin/
+
+ - name: Install YAKS
+ shell: bash
+ run: |
+ yaks install --cluster-setup
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c8ceb9fbd6..e5c5569e1a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -63,17 +63,5 @@ jobs:
persist-credentials: false
submodules: recursive
- - id: prepare-env
- name: Prepare Test Environment
- uses: ./.github/actions/kamel-prepare-env
-
- - name: Cache modules
- uses: actions/cache@v1
- with:
- path: ~/go/pkg/mod
- key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- restore-keys: |
- ${{ runner.os }}-go-
-
- - name: Test
- run: make
+ - name: Execute Build Tests
+ uses: ./.github/actions/e2e-build
diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
index 888e128090..bd77998deb 100644
--- a/.github/workflows/builder.yml
+++ b/.github/workflows/builder.yml
@@ -62,49 +62,8 @@ jobs:
persist-credentials: false
submodules: recursive
- - id: prepare-env
- name: Prepare Test Environment
- uses: ./.github/actions/kamel-prepare-env
-
- - id: configure-platform
- name: Configure Platform
- uses: ./.github/actions/kamel-config-cluster
+ - name: Execute Builder Tests
+ uses: ./.github/actions/e2e-builder
with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
- kube-config-data: ${{ secrets.KUBE_CONFIG_DATA }}
- kube-admin-user-ctx: ${{ secrets.KUBE_ADMIN_USER_CTX }}
- kube-user-ctx: ${{ secrets.KUBE_USER_CTX }}
- image-registry: ${{ secrets.IMAGE_REGISTRY }}
- image-registry-insecure: ${{ secrets.IMAGE_REGISTRY_INSECURE }}
-
-
- - id: build-kamel-binary
- name: Build Kamel Binary
- uses: ./.github/actions/kamel-build-binary
- with:
- image-registry: ${{ steps.configure-platform.outputs.image-registry }}
-
- - name: Install Kamel Cluster Setup
- uses: ./.github/actions/kamel-install-cluster-setup
- with:
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
-
- - name: Run IT
- env:
- KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ matrix.publisher }}
- run: |
- # Cluster environment
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
- export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
- export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
- export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
- export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
-
- # Test options
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
-
- # Then run integration tests
- make test-builder
+ cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
+ publisher: ${{ matrix.publisher }}
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index e9048b0ca8..d3cdfd7558 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -58,111 +58,21 @@ jobs:
persist-credentials: false
submodules: recursive
- - id: prepare-env
- name: Prepare Test Environment
- uses: ./.github/actions/kamel-prepare-env
-
- - id: configure-platform
- name: Configure Platform
- uses: ./.github/actions/kamel-config-cluster
- with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
-
- - name: Install Knative
- uses: ./.github/actions/kamel-install-knative
-
- - id: build-kamel-binary
- name: Build Kamel Binary
- uses: ./.github/actions/kamel-build-binary
+ - name: Execute KNative Tests
+ uses: ./.github/actions/e2e-knative
with:
- image-registry: ${{ steps.configure-platform.outputs.image-registry }}
-
- - name: Install Kamel Cluster Setup
- uses: ./.github/actions/kamel-install-cluster-setup
- with:
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
-
- - name: Run IT
- run: |
- # Cluster environment
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
- export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
- export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
- export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
- export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
-
- # Test options
- export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
-
- # Then run integration tests
- make test-knative
+ cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
yaks:
runs-on: ubuntu-20.04
steps:
- - name: Checkout code
- uses: actions/checkout@v2
- with:
- persist-credentials: false
- submodules: recursive
-
- - id: prepare-env
- name: Prepare Test Environment
- uses: ./.github/actions/kamel-prepare-env
-
- - name: Get YAKS
- run: |
- export YAKS_VERSION=0.4.0
- curl --fail -L https://github.com/citrusframework/yaks/releases/download/v${YAKS_VERSION}/yaks-${YAKS_VERSION}-linux-64bit.tar.gz -o yaks.tar.gz
- tar -zxf yaks.tar.gz
- sudo mv yaks /usr/local/bin/
-
- - id: configure-platform
- name: Configure Platform
- uses: ./.github/actions/kamel-config-cluster
- with:
- cluster-type: ${{ steps.prepare-env.outputs.cluster-platform }}
-
- - name: Install YAKS
- run: |
- yaks install --cluster-setup
-
- - name: Install Knative
- uses: ./.github/actions/kamel-install-knative
-
- - id: build-kamel-binary
- name: Build Kamel Binary
- uses: ./.github/actions/kamel-build-binary
- with:
- image-registry: ${{ steps.configure-platform.outputs.image-registry }}
-
- - name: Install Kamel Cluster Setup
- uses: ./.github/actions/kamel-install-cluster-setup
- with:
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
-
- - name: Run IT
- run: |
- # Cluster environment
- export KAMEL_INSTALL_REGISTRY=${{ steps.configure-platform.outputs.image-registry }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ steps.configure-platform.outputs.image-registry-insecure }}
- export CUSTOM_IMAGE=${{ steps.build-kamel-binary.outputs.local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel-binary.outputs.local-image-version }}
- export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
- export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
- export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
-
- # Test options
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
- export KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY=Spectrum
-
- # Install Yaks globally
- yaks install
+ - name: Checkout code
+ uses: actions/checkout@v2
+ with:
+ persist-credentials: false
+ submodules: recursive
- # Then run integration tests
- yaks test e2e/yaks/common
+ - name: Execute KNative YAKS Tests
+ uses: ./.github/actions/e2e-knative-yaks
+ with:
+ cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml
index cd8a9a23da..df38900679 100644
--- a/.github/workflows/local.yml
+++ b/.github/workflows/local.yml
@@ -59,20 +59,5 @@ jobs:
persist-credentials: false
submodules: recursive
- - id: prepare-env
- name: Prepare Test Environment
- uses: ./.github/actions/kamel-prepare-env
-
- - id: build-kamel-binary
- name: Build Kamel Binary
- uses: ./.github/actions/kamel-build-binary
- with:
- make-rules: 'build-kamel'
-
- - name: Run IT
- run: |
- # Configure staging repos
- export KAMEL_LOCAL_RUN_MAVEN_REPOSITORIES=$(make get-staging-repo)
-
- # Then run integration tests
- make test-local
+ - name: Execute Local Tests
+ uses: ./.github/actions/e2e-local
From 7d1e54f0a3bc91df01c14c0007b0fc3173651bfe Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Thu, 25 Nov 2021 11:30:34 +0000
Subject: [PATCH 15/40] Fix for building bundle failure
# Permission denied when trying to create the bundle index image
# see issue operator-registry/issues/870
---
.github/actions/kamel-build-bundle/action.yaml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index 54cc48f757..2191680cae 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -179,8 +179,13 @@ runs:
#
# Construct an index image containing the newly built bundle image
+ # Bug:
+ # https://github.com/operator-framework/operator-registry/issues/870
+ # Workaround:
+ # image catalog layers contain root owned files so fails with `permission denied` error.
+ # Running with sudo fixes this error (alternative is to switch to podman)
#
- opm index add \
+ sudo opm index add \
-c docker --skip-tls \
--bundles ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }} \
--from-index quay.io/operatorhubio/catalog:latest \
From 8659a28083812141c5e5f6a33b9ba3f561966d22 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 26 Nov 2021 12:54:50 +0000
Subject: [PATCH 16/40] Cleanup using kamel uninstall
* Replaces use of unintall in e2e code as latter was uninstalling
CRDs between tests so all subsequent tests were failing
---
.github/actions/kamel-cleanup/action.yaml | 10 ++++++++--
e2e/support/test_support.go | 23 -----------------------
e2e/upgrade/cli_upgrade_test.go | 6 ++++--
e2e/upgrade/olm_upgrade_test.go | 5 ++---
4 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/.github/actions/kamel-cleanup/action.yaml b/.github/actions/kamel-cleanup/action.yaml
index fce145100f..338ad37640 100644
--- a/.github/actions/kamel-cleanup/action.yaml
+++ b/.github/actions/kamel-cleanup/action.yaml
@@ -21,12 +21,18 @@ description: 'Cleans up the target cluster, removing any e2e test resources'
runs:
using: "composite"
steps:
- - id: remove-installed-camel-crds
- name: Remove Installed Camel CRDs
+ - id: remove-installed-kamel
+ name: Remove Installed Kamel
shell: bash
if: ${{ always() }}
run: |
set +e
+ if command -v kamel &> /dev/null
+ then
+ kamel uninstall --olm=false --all
+ fi
+
+ # Ensure the CRDs are removed
kubectl get crds | grep camel | awk '{print $1}' | xargs kubectl delete crd &> /dev/null
set -e
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index ff13fc9108..1a69db0568 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -1673,12 +1673,6 @@ func InvokeUserTestCode(t *testing.T, ns string, doRun func(string)) {
if err := util.Dump(TestContext, TestClient(), ns, t); err != nil {
t.Logf("Error while dumping namespace %s: %v\n", ns, err)
}
-
- //
- // Ensure everything is removed after dumping
- // in order to ensure a clean cluster
- //
- uninstallKamelInternal(t, "--all", "--olm=false")
}
}()
@@ -1817,23 +1811,6 @@ func NewTestNamespace(injectKnativeBroker bool) ctrl.Object {
return obj
}
-func uninstallKamelInternal(t *testing.T, args ...string) {
- uargs := []string{"uninstall"}
- uargs = append(uargs, args...)
- if err := Kamel(uargs...).Execute(); err != nil {
- t.Logf("Warning: An error occurred whilst trying to uninstall kamel: %s", err.Error())
- }
-}
-
-func UninstallKamel(t *testing.T, args ...string) {
- if t.Failed() {
- // then dump needs to execute first
- return
- }
-
- uninstallKamelInternal(t, args...)
-}
-
func GetOutputString(command *cobra.Command) string {
var buf bytes.Buffer
diff --git a/e2e/upgrade/cli_upgrade_test.go b/e2e/upgrade/cli_upgrade_test.go
index f8e5a91fa5..65415bb3f5 100644
--- a/e2e/upgrade/cli_upgrade_test.go
+++ b/e2e/upgrade/cli_upgrade_test.go
@@ -38,8 +38,6 @@ import (
func TestOperatorUpgrade(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
- defer UninstallKamel(t, "--all", "--olm=false")
-
version, ok := os.LookupEnv("KAMEL_K_TEST_RELEASE_VERSION")
Expect(ok).To(BeTrue())
@@ -114,5 +112,9 @@ func TestOperatorUpgrade(t *testing.T) {
// Check the Integration runs correctly
Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+
+ // Clean up
+ Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
+ Expect(Kamel("uninstall", "--all", "--olm=false").Execute()).To(Succeed())
})
}
diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go
index f454d3738d..6f6cde3452 100644
--- a/e2e/upgrade/olm_upgrade_test.go
+++ b/e2e/upgrade/olm_upgrade_test.go
@@ -46,9 +46,6 @@ import (
const catalogSourceName = "test-camel-k-source"
func TestOLMAutomaticUpgrade(t *testing.T) {
- // Clean up cluster-wide resources that are not removed by OLM
- defer UninstallKamel(t, "--all", "--olm=false")
-
prevIIB := os.Getenv("CAMEL_K_PREV_IIB")
newIIB := os.Getenv("CAMEL_K_NEW_IIB")
kamel := os.Getenv("RELEASED_KAMEL_BIN")
@@ -196,6 +193,8 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
// Clean up
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
Expect(Kamel("uninstall", "-n", ns).Execute()).To(Succeed())
+ // Clean up cluster-wide resources that are not removed by OLM
+ Expect(Kamel("uninstall", "--all", "--olm=false").Execute()).To(Succeed())
})
})
}
From 1cff9e2c20708646530e3a8d031fbf4b2ff2b5e8 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 26 Nov 2021 15:15:20 +0000
Subject: [PATCH 17/40] Adds support for retaining test projects that failed
---
.github/actions/e2e-builder/action.yml | 1 +
.github/actions/e2e-knative-yaks/action.yml | 1 +
.github/actions/e2e-knative/action.yml | 1 +
.github/actions/e2e-kubernetes/action.yml | 2 ++
.github/actions/e2e-upgrade/action.yml | 1 +
e2e/support/test_support.go | 6 ++++++
6 files changed, 12 insertions(+)
diff --git a/.github/actions/e2e-builder/action.yml b/.github/actions/e2e-builder/action.yml
index 68f931101b..caeff3774c 100644
--- a/.github/actions/e2e-builder/action.yml
+++ b/.github/actions/e2e-builder/action.yml
@@ -82,6 +82,7 @@ runs:
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+ export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
# Then run integration tests
make test-builder
diff --git a/.github/actions/e2e-knative-yaks/action.yml b/.github/actions/e2e-knative-yaks/action.yml
index e72e4ce3cc..fc95dad27e 100644
--- a/.github/actions/e2e-knative-yaks/action.yml
+++ b/.github/actions/e2e-knative-yaks/action.yml
@@ -87,6 +87,7 @@ runs:
# Test options
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
+ export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
# Install Yaks globally
yaks install
diff --git a/.github/actions/e2e-knative/action.yml b/.github/actions/e2e-knative/action.yml
index 1c929d34d9..a1af033ba6 100644
--- a/.github/actions/e2e-knative/action.yml
+++ b/.github/actions/e2e-knative/action.yml
@@ -84,6 +84,7 @@ runs:
# Test options
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
+ export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
# Then run integration tests
make test-knative
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index 4d290d6657..c3ee22f6a4 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -76,8 +76,10 @@ runs:
export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
+
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
+ export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
# Then run integration tests
make test-integration
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index 9ea4ed86db..1da7253b97 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -98,6 +98,7 @@ runs:
export CAMEL_K_NEW_IIB=${{ env.BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX }}
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=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
# Then run integration tests
make test-upgrade
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 1a69db0568..72a02405ae 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -1715,6 +1715,12 @@ func DeleteKnativeBroker(ns metav1.Object) {
}
func DeleteTestNamespace(t *testing.T, ns ctrl.Object) {
+ value, saveNS := os.LookupEnv("CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE")
+ if t.Failed() && saveNS && value == "true" {
+ t.Logf("Warning: retaining failed test project %q", ns.GetName())
+ return
+ }
+
var oc bool
var err error
if oc, err = openshift.IsOpenShift(TestClient()); err != nil {
From 46a5b16e23fc128d566583bdd12bddd15d259276 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 26 Nov 2021 18:34:41 +0000
Subject: [PATCH 18/40] Fix: Renaming of operator to camel-k requires modifying
default operator name
* Operations like uninstall fail to remove the CSV due to the name change
---
pkg/util/olm/operator.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/util/olm/operator.go b/pkg/util/olm/operator.go
index a54a8a755f..295e988143 100644
--- a/pkg/util/olm/operator.go
+++ b/pkg/util/olm/operator.go
@@ -42,7 +42,7 @@ import (
// The following properties can be overridden at build time via ldflags
// DefaultOperatorName is the Camel K operator name in OLM.
-var DefaultOperatorName = "camel-k-operator"
+var DefaultOperatorName = "camel-k"
// DefaultPackage is the Camel K package in OLM.
var DefaultPackage = "camel-k"
From 48dbb21745abb9ebe23d337d3be2757695e62a96 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Mon, 29 Nov 2021 20:48:58 +0000
Subject: [PATCH 19/40] Extends test timeout for builder tests
* Timeout for build default to 60 seconds which is not long enough on OS
---
e2e/builder/build_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/e2e/builder/build_test.go b/e2e/builder/build_test.go
index aca0f6fb77..4bb195ba3a 100644
--- a/e2e/builder/build_test.go
+++ b/e2e/builder/build_test.go
@@ -90,7 +90,7 @@ func doKitFullBuild(t *testing.T, name string, memoryLimit string, buildTimeout
}
Expect(Kamel(buildKitArgs...).Execute()).To(Succeed())
- Eventually(Build(ns, name)).ShouldNot(BeNil())
+ Eventually(Build(ns, name), testTimeout).ShouldNot(BeNil())
Eventually(BuildPhase(ns, name), testTimeout).Should(Equal(v1.BuildPhaseSucceeded))
Eventually(KitPhase(ns, name), testTimeout).Should(Equal(v1.IntegrationKitPhaseReady))
})
From ef587f3d42b59dde1ab7e404705d27b204bf7555 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 30 Nov 2021 10:40:57 +0000
Subject: [PATCH 20/40] Extends test timeout for kubernetes tests
* Timeout for integration start is 60 seconds which is not long enough
on OS
---
e2e/common/config/config_test.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/e2e/common/config/config_test.go b/e2e/common/config/config_test.go
index f764fdc97a..24c04a2593 100644
--- a/e2e/common/config/config_test.go
+++ b/e2e/common/config/config_test.go
@@ -242,8 +242,8 @@ func TestRunConfigExamples(t *testing.T) {
t.Run("Build time property file with precedence", func(t *testing.T) {
Expect(Kamel("run", "-n", ns, "./files/build-property-file-route.groovy", "--build-property", "quarkus.application.name=my-overridden-application", "--build-property", "file:./files/quarkus.properties").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, "build-property-file-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
- Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
- Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutShort).Should(ContainSubstring("my-overridden-application"))
+ Eventually(IntegrationConditionStatus(ns, "build-property-file-route", v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+ Eventually(IntegrationLogs(ns, "build-property-file-route"), TestTimeoutMedium).Should(ContainSubstring("my-overridden-application"))
Expect(Kamel("delete", "--all", "-n", ns).Execute()).To(Succeed())
})
From 760491345abd1a599e3f65fbd3b93caefdd25523 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 30 Nov 2021 19:06:39 +0000
Subject: [PATCH 21/40] Adds support for marking tests as problematic
* If an env var is set then marked tests will be skipped
* Meant as interim option to allow test suites to avoid failure due to
problematic tests rather than regressions in the coding.
---
e2e/common/traits/route_test.go | 12 ++++++++++++
e2e/common/traits/toleration_test.go | 12 ++++++++++++
2 files changed, 24 insertions(+)
diff --git a/e2e/common/traits/route_test.go b/e2e/common/traits/route_test.go
index 9132e49064..aeba12aadf 100644
--- a/e2e/common/traits/route_test.go
+++ b/e2e/common/traits/route_test.go
@@ -34,6 +34,7 @@ import (
"math/big"
rand2 "math/rand"
"net/http"
+ "os"
"testing"
"time"
@@ -69,7 +70,18 @@ var certPem []byte
// then in this case the HTTP client validates the TLS certificate.
var skipClientTLSVerification = true
+/*
+ * TODO
+ * Test needs to be modified as route for unsecured http is not created on OCP.
+ * Already skipped when executed using Kind since cluster does not support route API.
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
func TestRunRoutes(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+
WithNewTestNamespace(t, func(ns string) {
ocp, err := openshift.IsOpenShift(TestClient())
if !ocp {
diff --git a/e2e/common/traits/toleration_test.go b/e2e/common/traits/toleration_test.go
index a58eaaf1ff..711bee440c 100644
--- a/e2e/common/traits/toleration_test.go
+++ b/e2e/common/traits/toleration_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "os"
"testing"
. "github.com/onsi/gomega"
@@ -35,7 +36,18 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
+/*
+ * TODO
+ * Test needs to be modified as taint test for java3 integration does not work on OCP.
+ * Already skipped when executed using Kind since that is only a single-node cluster.
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
func TestTolerationTrait(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+
WithNewTestNamespace(t, func(ns string) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
From 8ed8b354958c5ab9548d2f61f0bda0877e79bad8 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Thu, 2 Dec 2021 14:32:09 +0000
Subject: [PATCH 22/40] Fix: Retrieve IMAGE_NAME value from deployment yaml
rather than constant
* It is possible if set-version has been called, eg. building bundle, for
the image name in the operator-deployment.yaml to be different to that
defined by IMAGE_NAME. This can cause issues when calling functions
such as `kustomize set image $(IMAGE_NAME)=....` as this will work but
the image name in the deployment will never be updated (wrong mapping).
* Use a shell function to find the latest value of IMAGE_NAME & assign
each time a Makefile rule in install is executed.
---
install/Makefile | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/install/Makefile b/install/Makefile
index bbc5a911ab..faf8466d6b 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -59,6 +59,9 @@ OPERATOR := operator
PLACEHOLDER := placeholder
YAML := yaml
+# Fetch the latest image name - may override the original constant
+IMAGE_NAME := $(shell grep image: $(MANAGER)/operator-deployment.yaml | sed 's/.*image: \(.*\):.*/\1/')
+
# Setup patches
ROLE_TO_CROLE_PATCH := $(RBAC)/patch-role-to-clusterrole
ROLEBIN_TO_CROLEBIN_PATCH := $(RBAC)/patch-rolebinding-to-clusterrolebinding
@@ -77,6 +80,7 @@ INT_PLATFORM_PATCH := patch-integration-platform
#
define set-kustomize-image
$(if $(filter $(IMAGE_NAME),$(CUSTOM_IMAGE):$(CUSTOM_VERSION)),,\
+
@cd $(1) && $(KUSTOMIZE) edit set image $(IMAGE_NAME)=$(CUSTOM_IMAGE):$(CUSTOM_VERSION))
endef
From 40e2032ba6eb56093e18a81eeb904863c188c474 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Wed, 8 Dec 2021 10:09:42 +0000
Subject: [PATCH 23/40] Increases test timeout for building, installing ...
---
e2e/common/cli/install_test.go | 2 +-
e2e/common/traits/health_test.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/e2e/common/cli/install_test.go b/e2e/common/cli/install_test.go
index 612ab75ed4..3b4d06133a 100644
--- a/e2e/common/cli/install_test.go
+++ b/e2e/common/cli/install_test.go
@@ -49,7 +49,7 @@ func TestKitMainInstallation(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
Expect(Kamel("kit", "create", "timer", "-d", "camel:timer", "-n", ns).Execute()).To(Succeed())
- Eventually(Build(ns, "timer")).ShouldNot(BeNil())
+ Eventually(Build(ns, "timer"), TestTimeoutMedium).ShouldNot(BeNil())
})
}
diff --git a/e2e/common/traits/health_test.go b/e2e/common/traits/health_test.go
index ccd602ccee..353a6e57c0 100644
--- a/e2e/common/traits/health_test.go
+++ b/e2e/common/traits/health_test.go
@@ -74,7 +74,7 @@ func TestHealthTrait(t *testing.T) {
// Check the ready condition has turned falsy
Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
// And it contains details about the runtime state
- Eventually(IntegrationCondition(ns, "java", v1.IntegrationConditionReady)).Should(And(
+ Eventually(IntegrationCondition(ns, "java", v1.IntegrationConditionReady), TestTimeoutMedium).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionRuntimeNotReadyReason)),
WithTransform(IntegrationConditionMessage, HavePrefix(fmt.Sprintf("[Pod %s runtime is not ready: map[consumer:route1:DOWN context:UP", pod.Name))),
))
From 040459b41fbef9cda4d61c8e06937cd3c6cc3f56 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Mon, 6 Dec 2021 19:35:58 +0000
Subject: [PATCH 24/40] Remove any credential leakage in the log output
* Discontinue using json-to-variables and converted secret to simple
key-value list
* Converts all environment variables into inputs and outputs as these are
not logged
* Creates bash scripts that are called from run: calls as these scripts do
not get logged and set-output and set-mask can be used without leakage
---
.github/actions/e2e-builder/action.yml | 34 ++--
.github/actions/e2e-knative-yaks/action.yml | 34 ++--
.github/actions/e2e-knative/action.yml | 34 ++--
.github/actions/e2e-kubernetes/action.yml | 34 ++--
.github/actions/e2e-upgrade/action.yml | 35 ++--
.github/actions/json-to-variables | 1 -
.github/actions/kamel-build-binary/action.yml | 14 +-
.../actions/kamel-build-bundle/action.yaml | 28 ++-
.github/actions/kamel-build/action.yml | 21 ++-
.github/actions/kamel-cleanup/action.yaml | 11 +-
.../kamel-config-cluster-custom/action.yml | 175 ++++--------------
.../connect-cluster.sh | 142 ++++++++++++++
.../kamel-config-cluster-kind/action.yml | 49 ++---
.../extract-config.sh | 51 +++++
.../kamel-config-cluster-ocp3/action.yml | 57 ++++--
.../actions/kamel-config-cluster/action.yaml | 84 +++++++--
.../kamel-config-cluster/output-config.sh | 81 ++++++++
.github/actions/kamel-prepare-env/action.yml | 3 -
.github/workflows/builder.yml | 1 +
.github/workflows/knative.yml | 2 +
.github/workflows/kubernetes.yml | 1 +
.github/workflows/openshift.yml | 24 ++-
.github/workflows/upgrade.yml | 1 +
.gitmodules | 4 -
config/rbac/operator-role.yaml | 21 ---
25 files changed, 631 insertions(+), 311 deletions(-)
delete mode 160000 .github/actions/json-to-variables
create mode 100755 .github/actions/kamel-config-cluster-custom/connect-cluster.sh
create mode 100755 .github/actions/kamel-config-cluster-kind/extract-config.sh
create mode 100755 .github/actions/kamel-config-cluster/output-config.sh
diff --git a/.github/actions/e2e-builder/action.yml b/.github/actions/e2e-builder/action.yml
index caeff3774c..a4e814bc29 100644
--- a/.github/actions/e2e-builder/action.yml
+++ b/.github/actions/e2e-builder/action.yml
@@ -22,6 +22,9 @@ 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
publisher:
description: 'The publishing strategy to be used'
required: true
@@ -34,30 +37,31 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-cluster
+ - id: config-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
cluster-type: ${{ env.TEST_CLUSTER }}
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: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
- image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ 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 - depends on cluster being tested
- build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }}
# Can be empty and so catalog source will not be created
- catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
+ catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
with:
- kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
+ kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
- id: run-it
name: Run IT
@@ -66,19 +70,19 @@ runs:
KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ inputs.publisher }}
run: |
# Cluster environment
- export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
#
# If bundle has been built and installed then use it
#
- if [ -n "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ env.CLUSTER_IMAGE_NAMESPACE }}
- export KAMEL_INSTALL_OLM_SOURCE=${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}
+ if [ -n "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ steps.config-cluster.outputs.cluster-image-namespace }}
+ export KAMEL_INSTALL_OLM_SOURCE=${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
fi
- export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
+ export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
@@ -90,3 +94,5 @@ runs:
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
+ with:
+ build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
diff --git a/.github/actions/e2e-knative-yaks/action.yml b/.github/actions/e2e-knative-yaks/action.yml
index fc95dad27e..df367aed29 100644
--- a/.github/actions/e2e-knative-yaks/action.yml
+++ b/.github/actions/e2e-knative-yaks/action.yml
@@ -22,6 +22,9 @@ 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"
@@ -31,12 +34,13 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-cluster
+ - id: config-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
cluster-type: ${{ env.TEST_CLUSTER }}
cluster-config-data: ${{ inputs.cluster-config-data }}
+ cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }}
- name: Install YAKS
uses: ./.github/actions/kamel-install-yaks
@@ -48,38 +52,38 @@ runs:
name: Build Kamel
uses: ./.github/actions/kamel-build
with:
- image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
- image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ 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 - depends on cluster being tested
- build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }}
# Can be empty and so catalog source will not be created
- catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
+ catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
with:
- kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
+ kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
- id: run-it
name: Run IT
shell: bash
run: |
# Cluster environment
- export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
#
# If bundle has been built and installed then use it
#
- if [ -n "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ env.CLUSTER_IMAGE_NAMESPACE }}
- export KAMEL_INSTALL_OLM_SOURCE=${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}
+ if [ -n "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ steps.config-cluster.outputs.cluster-image-namespace }}
+ export KAMEL_INSTALL_OLM_SOURCE=${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
fi
- export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
+ export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
@@ -98,3 +102,5 @@ runs:
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
+ with:
+ build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
diff --git a/.github/actions/e2e-knative/action.yml b/.github/actions/e2e-knative/action.yml
index a1af033ba6..ce3658ad5c 100644
--- a/.github/actions/e2e-knative/action.yml
+++ b/.github/actions/e2e-knative/action.yml
@@ -22,6 +22,9 @@ 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"
@@ -31,12 +34,13 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-cluster
+ - id: config-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
cluster-type: ${{ env.TEST_CLUSTER }}
cluster-config-data: ${{ inputs.cluster-config-data }}
+ cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }}
- name: Install Knative
uses: ./.github/actions/kamel-install-knative
@@ -45,38 +49,38 @@ runs:
name: Build Kamel
uses: ./.github/actions/kamel-build
with:
- image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
- image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ 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 - depends on cluster being tested
- build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }}
# Can be empty and so catalog source will not be created
- catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
+ catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
with:
- kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
+ kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
- id: run-it
name: Run IT
shell: bash
run: |
# Cluster environment
- export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
#
# If bundle has been built and installed then use it
#
- if [ -n "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ env.CLUSTER_IMAGE_NAMESPACE }}
- export KAMEL_INSTALL_OLM_SOURCE=${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}
+ if [ -n "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ steps.config-cluster.outputs.cluster-image-namespace }}
+ export KAMEL_INSTALL_OLM_SOURCE=${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
fi
- export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
+ export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
@@ -92,3 +96,5 @@ runs:
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
+ with:
+ build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index c3ee22f6a4..6dfde05fe0 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -22,6 +22,9 @@ 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"
@@ -31,50 +34,51 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-cluster
+ - id: config-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
cluster-type: ${{ env.TEST_CLUSTER }}
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: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
- image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ 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 - depends on cluster being tested
- build-bundle: ${{ env.CLUSTER_HAS_OLM }}
+ build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }}
# Can be empty and so catalog source will not be created
- catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
+ catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
with:
- kube-admin-user-ctx: ${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}
+ kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
- id: run-it
name: Run IT
shell: bash
run: |
# Cluster environment
- export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
#
# If bundle has been built and installed then use it
#
- if [ -n "${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ env.CLUSTER_IMAGE_NAMESPACE }}
- export KAMEL_INSTALL_OLM_SOURCE=${{ env.BUILD_BUNDLE_CATALOG_SOURCE }}
+ if [ -n "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ steps.config-cluster.outputs.cluster-image-namespace }}
+ export KAMEL_INSTALL_OLM_SOURCE=${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
fi
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
+ export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
@@ -90,3 +94,5 @@ runs:
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
+ with:
+ build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index 1da7253b97..b968392b54 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -22,6 +22,9 @@ 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"
@@ -31,15 +34,17 @@ runs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-cluster
+ - id: config-cluster
name: Configure Cluster
uses: ./.github/actions/kamel-config-cluster
with:
cluster-type: ${{ env.TEST_CLUSTER }}
cluster-config-data: ${{ inputs.cluster-config-data }}
+ cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }}
require-olm: true
- - name: Get Released Kamel CLI
+ - id: released-kamel-cli
+ name: Get Released Kamel CLI
shell: bash
run: |
export KAMEL_VERSION=$(make get-last-released-version)
@@ -57,7 +62,7 @@ runs:
mv /tmp/kamel ${RELEASED_KAMEL_BINARY}
if [ $? == 0 ]; then
echo "Info: Kamel version installed: $(${RELEASED_KAMEL_BINARY} version)"
- echo "E2E_UPGRADE_RELEASED_KAMEL_BINARY=${RELEASED_KAMEL_BINARY}" >> $GITHUB_ENV
+ echo "::set-output name=released-kamel-binary::${RELEASED_KAMEL_BINARY}"
else
echo "Error: Failed to install kamel binary ${KAMEL_VERSION}"
exit 1
@@ -67,35 +72,35 @@ runs:
name: Build Kamel
uses: ./.github/actions/kamel-build
with:
- image-registry-push-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PUSH_HOST }}
- image-registry-pull-host: ${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- image-namespace: ${{ env.CLUSTER_IMAGE_NAMESPACE }}
+ 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: ${{ env.CLUSTER_HAS_OLM }}
+ build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }}
# Can be empty and so catalog source will not be created
- catalog-source-namespace: ${{ env.CLUSTER_CATALOG_SOURCE_NAMESPACE }}
+ catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
- name: Run IT
shell: bash
run: |
# Use the last released Kamel CLI
- export RELEASED_KAMEL_BIN=${{ env.E2E_UPGRADE_RELEASED_KAMEL_BINARY }}
+ export RELEASED_KAMEL_BIN=${{ steps.released-kamel-cli.outputs.released-kamel-binary }}
echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)"
# Configure install options
- export CUSTOM_IMAGE=${{ env.BUILD_BINARY_LOCAL_IMAGE_NAME }}
- export CUSTOM_VERSION=${{ env.BUILD_BINARY_LOCAL_IMAGE_VERSION }}
+ export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ env.CLUSTER_IMAGE_REGISTRY_PULL_HOST }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{ env.CLUSTER_IMAGE_REGISTRY_INSECURE }}
+ export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
# Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var
# Configure test options
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
- export CAMEL_K_NEW_IIB=${{ env.BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX }}
+ export CAMEL_K_NEW_IIB=${{ steps.build-kamel.outputs.build-bundle-image-bundle-index }}
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=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
@@ -106,3 +111,5 @@ runs:
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
+ with:
+ build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
diff --git a/.github/actions/json-to-variables b/.github/actions/json-to-variables
deleted file mode 160000
index cc8c639403..0000000000
--- a/.github/actions/json-to-variables
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit cc8c6394031e145c90f7f9ec909d83df92431fb8
diff --git a/.github/actions/kamel-build-binary/action.yml b/.github/actions/kamel-build-binary/action.yml
index 1355bf2a56..8b87dd68b0 100644
--- a/.github/actions/kamel-build-binary/action.yml
+++ b/.github/actions/kamel-build-binary/action.yml
@@ -81,5 +81,15 @@ runs:
# Use the PULL host to ensure the correct image:tag
# is passed into the tests for the deployment to pull from
#
- echo "BUILD_BINARY_LOCAL_IMAGE_NAME=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k" >> $GITHUB_ENV
- echo "BUILD_BINARY_LOCAL_IMAGE_VERSION=$(make get-version)" >> $GITHUB_ENV
+ BUILD_BINARY_LOCAL_IMAGE_NAME="${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k"
+ BUILD_BINARY_LOCAL_IMAGE_VERSION="$(make get-version)"
+ echo "::set-output name=build-binary-local-image-name::${BUILD_BINARY_LOCAL_IMAGE_NAME}"
+ echo "::set-output name=build-binary-local-image-version::${BUILD_BINARY_LOCAL_IMAGE_VERSION}"
+
+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-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index 2191680cae..2a6f65f967 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -97,7 +97,9 @@ runs:
# Use the PULL host to ensure the correct image:tag
# is passed into the tests for the deployment to pull from
#
- echo "BUILD_BUNDLE_LOCAL_IMAGE=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}" >> $GITHUB_ENV
+ BUILD_BUNDLE_LOCAL_IMAGE="${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}"
+ echo "::set-output name=build-bundle-local-image::${BUILD_BUNDLE_LOCAL_IMAGE}"
+
- id: install-opm
name: Install opm if required
@@ -170,11 +172,11 @@ runs:
#
docker tag \
${PUSH_REGISTRY}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }} \
- ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }}
+ ${{ steps.build-bundle-image.outputs.build-bundle-local-image }}
# Push the bundle image to the registry
#
- docker push ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }}
+ docker push ${{ steps.build-bundle-image.outputs.build-bundle-local-image }}
fi
#
@@ -187,12 +189,13 @@ runs:
#
sudo opm index add \
-c docker --skip-tls \
- --bundles ${{ env.BUILD_BUNDLE_LOCAL_IMAGE }} \
+ --bundles ${{ steps.build-bundle-image.outputs.build-bundle-local-image }} \
--from-index quay.io/operatorhubio/catalog:latest \
--tag ${LOCAL_IIB}
docker push ${LOCAL_IIB}
- echo "BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX=${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}" >> $GITHUB_ENV
+ BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX="${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}"
+ echo "::set-output name=build-bundle-image-bundle-index::${BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX}"
- id: build-image-catalog
name: Create a new catalog to host the index image
@@ -211,7 +214,7 @@ runs:
fi
export BUILD_CATALOG_SOURCE="camel-k-test-source"
- echo "BUILD_BUNDLE_CATALOG_SOURCE=${BUILD_CATALOG_SOURCE}" >> $GITHUB_ENV
+ echo "::set-output name=build-bundle-catalog-source-name::${BUILD_CATALOG_SOURCE}"
cat < "${CLUSTER_CONFIG_FILE}"
- ${{ inputs.cluster-config-data }}
- EOF
-
- if [ ! -f "${CLUSTER_CONFIG_FILE}" ]; then
- echo "Error: No file ${CLUSTER_CONFIG_FILE} has been created"
- exit 1
- fi
-
- if [ -s "${CLUSTER_CONFIG_FILE}" ]; then
- echo "Info: Cluster configuration defined"
- echo "CLUSTER_CONFIG_FILE=${CLUSTER_CONFIG_FILE}" >> $GITHUB_ENV
- else
- echo "Error: No cluster configuration defined"
- exit 1
- fi
-
- - name: Cluster config JSON to variables
- uses: ./.github/actions/json-to-variables
- if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
- with:
- filename: ${{ env.CLUSTER_CONFIG_FILE }}
- prefix: 'e2e'
-
- id: connect-cluster
name: Connect to cluster
shell: bash
- if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
- echo "::add-mask::${{ env.e2e_kube-config-data }}"
- echo "::add-mask::${{ env.e2e_kube-admin-user-ctx }}"
- echo "::add-mask::${{ env.e2e_kube-user-ctx }}"
- echo "::add-mask::${{ env.e2e_image-registry-pull-host }}"
- echo "::add-mask::${{ env.e2e_image-registry-push-host }}"
- echo "::add-mask::${{ env.e2e_image-registry-user }}"
- echo "::add-mask::${{ env.e2e_image-registry-token }}"
- echo "::add-mask::${{ env.e2e_image-namespace }}"
- echo "::add-mask::${{ env.e2e_catalog-source-namespace }}"
-
- if [ -z "${{ env.e2e_kube-config-data }}" ]; then
- echo "Error: kube config data property cannot be found"
- exit 1
- fi
-
- if [ -z "${{ env.e2e_kube-admin-user-ctx }}" ]; then
- echo "Error: kube admin context property cannot be found"
- exit 1
- fi
-
- if [ -z "${{ env.e2e_kube-user-ctx }}" ]; then
- echo "Error: kube user context property cannot be found"
- exit 1
- fi
-
- if [ -z "${{ env.e2e_image-registry-pull-host }}" ]; then
- echo "Error: image registry pull host property cannot be found"
- exit 1
- fi
-
- if [ -z "${{ env.e2e_image-registry-push-host }}" ]; then
- echo "Error: image registry build host property cannot be found"
- exit 1
- fi
-
- if [ -n "${{ env.e2e_image-registry-user }}" ] && [ -n "${{ env.e2e_image-registry-token }}" ]; then
- echo "Secured registry in use so login with docker"
- docker login \
- -u "${{ env.e2e_image-registry-user }}" \
- -p "${{ env.e2e_image-registry-token }}" \
- "${{ env.e2e_image-registry-push-host }}"
- fi
-
- # Copy the kube config to the correct location for kubectl
- mkdir -p $HOME/.kube
- echo -n "${{ env.e2e_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 "${{ env.e2e_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
-
- - id: info
- name: Info
- shell: bash
- if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
- run: |
- kubectl describe nodes
+ ./.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
- if: ${{ env.CLUSTER_CUSTOM_CONFIGURED != 'true' }}
run: |
# Aggregate pod eviction permission to the default admin role
cat <> $GITHUB_ENV
- echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=${{ env.e2e_image-registry-pull-host }}" >> $GITHUB_ENV
- echo "CLUSTER_IMAGE_REGISTRY_INSECURE=${{ env.e2e_image-registry-insecure }}" >> $GITHUB_ENV
- echo "CLUSTER_CATALOG_SOURCE_NAMESPACE=${{ env.e2e_catalog-source-namespace }}" >> $GITHUB_ENV
-
- #
- # Export the image namespace if defined in the cluster config
- #
- if [ -n "${{ env.e2e_image-namespace }}" ]; then
- echo "CLUSTER_IMAGE_NAMESPACE=${{ env.e2e_image-namespace }}" >> $GITHUB_ENV
- fi
-
- #
- # Export the context used for admin and user
- #
- echo "CLUSTER_KUBE_ADMIN_USER_CTX=${{ env.e2e_kube-admin-user-ctx }}" >> $GITHUB_ENV
- echo "CLUSTER_KUBE_USER_CTX=${{ env.e2e_kube-user-ctx }}" >> $GITHUB_ENV
-
- #
- # Export the flag for olm capability
- #
- echo "CLUSTER_HAS_OLM=${{ env.e2e_has-olm }}" >> $GITHUB_ENV
-
- #
- # Avoid configuring the cluster repeatedly
- #
- echo "CLUSTER_CUSTOM_CONFIGURED=true" >> $GITHUB_ENV
+ kubectl config use-context ${{ steps.connect-cluster.outputs.cluster-kube-user-ctx }}
+
+outputs:
+ cluster-image-registry-push-host:
+ description: "The image registry to which to push images"
+ value: ${{ steps.connect-cluster.outputs.cluster-image-registry-push-host }}
+ cluster-image-registry-pull-host:
+ description: "The image registry from which to pull images"
+ value: ${{ steps.connect-cluster.outputs.cluster-image-registry-pull-host }}
+ cluster-image-registry-insecure:
+ description: "Whether the pull registry is insecure"
+ value: ${{ steps.connect-cluster.outputs.cluster-image-registry-insecure }}
+ cluster-catalog-source-namespace:
+ description: "The namespace in which to install the OLM catalog source"
+ value: ${{ steps.connect-cluster.outputs.cluster-catalog-source-namespace }}
+ cluster-image-namespace:
+ description: "The namespace to install the camel-k images"
+ value: ${{ steps.connect-cluster.outputs.cluster-image-namespace }}
+ cluster-kube-admin-user-ctx:
+ description: "The context of the kube admin user"
+ value: ${{ steps.connect-cluster.outputs.cluster-kube-admin-user-ctx }}
+ cluster-kube-user-ctx:
+ description: "The context of the kube user"
+ value: ${{ steps.connect-cluster.outputs.cluster-kube-user-ctx }}
+ cluster-has-olm:
+ description: "Does the cluster have OLM"
+ value: ${{ steps.connect-cluster.outputs.cluster-has-olm }}
diff --git a/.github/actions/kamel-config-cluster-custom/connect-cluster.sh b/.github/actions/kamel-config-cluster-custom/connect-cluster.sh
new file mode 100755
index 0000000000..8f6b08736c
--- /dev/null
+++ b/.github/actions/kamel-config-cluster-custom/connect-cluster.sh
@@ -0,0 +1,142 @@
+#!/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.
+# ---------------------------------------------------------------------------
+
+####
+#
+# Configures access to the cluster
+#
+####
+
+set -e
+
+while getopts ":c:k:" opt; do
+ case "${opt}" in
+ c)
+ CLUSTER_CONFIG_DATA=${OPTARG}
+ ;;
+ k)
+ KUBE_CONFIG_DATA=${OPTARG}
+ ;;
+ :)
+ echo "ERROR: Option -$OPTARG requires an argument"
+ exit 1
+ ;;
+ \?)
+ echo "ERROR: Invalid option -$OPTARG"
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+has_property() {
+ if echo "${CLUSTER_CONFIG_DATA}" | grep ${1} &> /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 "::set-output name=cluster-image-registry-push-host::$(get_property image-registry-push-host)"
+echo "::set-output name=cluster-image-registry-pull-host::$(get_property image-registry-pull-host)"
+echo "::set-output name=cluster-image-registry-insecure::$(get_property image-registry-insecure)"
+echo "::set-output name=cluster-catalog-source-namespace::$(get_property catalog-source-namespace)"
+
+#
+# Export the image namespace if defined in the cluster config
+#
+if [ $(has_property image-namespace) ]; then
+ echo "::set-output name=cluster-image-namespace::$(get_property image-namespace)"
+fi
+
+#
+# Export the context used for admin and user
+#
+echo "::set-output name=cluster-kube-admin-user-ctx::$(get_property kube-admin-user-ctx)"
+echo "::set-output name=cluster-kube-user-ctx::$(get_property kube-user-ctx)"
+
+#
+# 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 "::set-output name=cluster-has-olm::$(get_property has-olm)"
+
+#
+# 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
index e6803948a3..3034ee85ac 100644
--- a/.github/actions/kamel-config-cluster-kind/action.yml
+++ b/.github/actions/kamel-config-cluster-kind/action.yml
@@ -37,28 +37,35 @@ runs:
kubectl cluster-info
kubectl describe nodes
- - id: extract-config
- shell: bash
- if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }}
- run: |
- # Kind has the same interface for both pushing and pulling images in its registry
- echo "CLUSTER_IMAGE_REGISTRY_PUSH_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
- echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=${{ env.KIND_REGISTRY }}" >> $GITHUB_ENV
- echo "CLUSTER_IMAGE_REGISTRY_INSECURE=true" >> $GITHUB_ENV
-
#
- # Export the context used for admin and user
- # Since kind has no rbac switched on then these can be the same
+ # Avoid bringing up the cluster repeatedly
#
- echo "CLUSTER_KUBE_ADMIN_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
- echo "CLUSTER_KUBE_USER_CTX=$(kubectl config current-context)" >> $GITHUB_ENV
+ echo "CLUSTER_KIND_CONFIGURED=true" >> $GITHUB_ENV
- #
- # Export the flag for olm capability
- #
- echo "CLUSTER_HAS_OLM=false" >> $GITHUB_ENV
+ - id: extract-config
+ name: Output the config
+ shell: bash
+ run: ./.github/actions/kamel-config-cluster-kind/extract-config.sh
- #
- # Avoid configuring the cluster repeatedly
- #
- echo "CLUSTER_KIND_CONFIGURED=true" >> $GITHUB_ENV
+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 }}
diff --git a/.github/actions/kamel-config-cluster-kind/extract-config.sh b/.github/actions/kamel-config-cluster-kind/extract-config.sh
new file mode 100755
index 0000000000..69b4924657
--- /dev/null
+++ b/.github/actions/kamel-config-cluster-kind/extract-config.sh
@@ -0,0 +1,51 @@
+#!/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 "::set-output name=cluster-image-registry-push-host::${KIND_REGISTRY}"
+echo "::set-output name=cluster-image-registry-pull-host::${KIND_REGISTRY}"
+echo "::set-output name=cluster-image-registry-insecure::$(echo true)"
+
+#
+# Export the context used for admin and user
+# Since kind has no rbac switched on then these can be the same
+#
+echo "::set-output name=cluster-kube-admin-user-ctx::$(kubectl config current-context)"
+echo "::set-output name=cluster-kube-user-ctx::$(kubectl config current-context)"
+
+# Set the image namespace
+echo "::set-output name=cluster-image-namespace::$(echo apache)"
+
+#
+# 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 "::set-output name=cluster-has-olm::$(echo false)"
diff --git a/.github/actions/kamel-config-cluster-ocp3/action.yml b/.github/actions/kamel-config-cluster-ocp3/action.yml
index 2be4ca9add..c6bdf96c77 100644
--- a/.github/actions/kamel-config-cluster-ocp3/action.yml
+++ b/.github/actions/kamel-config-cluster-ocp3/action.yml
@@ -67,9 +67,6 @@ runs:
oc cluster up --public-hostname=$IP_ADDR --enable=persistent-volumes,registry,router
oc login -u system:admin
- # Export the context used for admin login
- echo "CLUSTER_KUBE_ADMIN_USER_CTX=$(oc config current-context)" >> $GITHUB_ENV
-
# Wait until we have a ready node in openshift
TIMEOUT=0
TIMEOUT_COUNT=60
@@ -89,6 +86,11 @@ runs:
echo "openshift is deployed and reachable"
+ #
+ # Avoid configuring the cluster repeatedly
+ #
+ echo "CLUSTER_OCP3_CONFIGURED=true" >> $GITHUB_ENV
+
- id: info
name: Info
shell: bash
@@ -99,8 +101,12 @@ runs:
- id: configure-developer-user
name: Configure Developer User
shell: bash
- if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
+ oc login -u system:admin
+
+ # Export the context used for admin login
+ echo "::set-output name=cluster-kube-admin-user-ctx::$(oc config current-context)"
+
# Aggregate pod eviction permission to the default admin role
cat <> $GITHUB_ENV
+ echo "::set-output name=cluster-kube-user-ctx::$(oc config current-context)"
-
- - id: extract-kube-config
+ - id: extract-config
shell: bash
if: ${{ env.CLUSTER_OCP3_CONFIGURED != 'true' }}
run: |
- echo "CLUSTER_IMAGE_REGISTRY_PUSH_HOST=" >> $GITHUB_ENV
- echo "CLUSTER_IMAGE_REGISTRY_PULL_HOST=" >> $GITHUB_ENV
- echo "CLUSTER_IMAGE_REGISTRY_INSECURE=false" >> $GITHUB_ENV
- echo "CLUSTER_HAS_OLM=true" >> $GITHUB_ENV
-
- #
- # Avoid configuring the cluster repeatedly
- #
- echo "CLUSTER_OCP3_CONFIGURED=true" >> $GITHUB_ENV
+ echo "::set-output name=cluster-image-registry-pull-host::"
+ echo "::set-output name=cluster-image-registry-pull-host::"
+ echo "::set-output name=cluster-image-registry-insecure::$(echo true)"
+ echo "::set-output name=cluster-has-olm::$(echo false)"
+ echo "::set-output name=cluster-image-namespace::$(echo apache)"
+ /* cluster-catalog-source-namespace intentionally blank due to using straight docker */
+
+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.configure-developer-user.outputs.cluster-kube-admin-user-ctx }}
+ cluster-kube-user-ctx:
+ description: "The context of the kube user"
+ value: ${{ steps.configure-developer-user.outputs.cluster-kube-user-ctx }}
+ cluster-has-olm:
+ description: "Does the cluster have OLM"
+ value: ${{ steps.extract-config.outputs.cluster-has-olm }}
diff --git a/.github/actions/kamel-config-cluster/action.yaml b/.github/actions/kamel-config-cluster/action.yaml
index 7e87850825..90a5ae7d64 100644
--- a/.github/actions/kamel-config-cluster/action.yaml
+++ b/.github/actions/kamel-config-cluster/action.yaml
@@ -24,7 +24,10 @@ inputs:
required: true
default: 'kind'
cluster-config-data:
- description: 'The JSON configuration of the cluster - required for custom cluster type only'
+ description: 'Variables for the cluster configuration - required for custom cluster type only'
+ 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'
@@ -62,6 +65,7 @@ runs:
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
@@ -71,14 +75,45 @@ runs:
echo "Error: Unrecognised cluster request for type of cluster. Should be kind, ocp3 or custom."
exit 1
- - id: image-namespace
+ - id: cluster-config
+ name: Extract the config from the cluster
shell: bash
- env:
- DEFAULT_IMAGE_NAMESPACE: 'apache'
run: |
- if [ -z "${{ env.CLUSTER_IMAGE_NAMESPACE }}" ]; then
- echo "CLUSTER_IMAGE_NAMESPACE=apache" >> $GITHUB_ENV
- fi
+ case ${{ env.CLUSTER_TYPE }} in
+ kind)
+ # Does not require cluster-catalog-source-namespace
+ ./.github/actions/kamel-config-cluster/output-config.sh \
+ -a "${{ steps.execute-kind.outputs.cluster-kube-admin-user-ctx }}" \
+ -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 }}" \
+ -c "${{ steps.execute-custom.outputs.cluster-catalog-source-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 }}"
+ ;;
+ ocp3)
+ # Does not require cluster-catalog-source-namespace
+ ./.github/actions/kamel-config-cluster/output-config.sh \
+ -a "${{ steps.execute-ocp3.outputs.cluster-kube-admin-user-ctx }}" \
+ -n "${{ steps.execute-ocp3.outputs.cluster-image-namespace }}" \
+ -o "${{ steps.execute-ocp3.outputs.cluster-has-olm }}" \
+ -p "${{ steps.execute-ocp3.outputs.cluster-image-registry-push-host }}" \
+ -q "${{ steps.execute-ocp3.outputs.cluster-image-registry-pull-host }}" \
+ -s "${{ steps.execute-ocp3.outputs.cluster-image-registry-insecure }}" \
+ -u "${{ steps.execute-ocp3.outputs.cluster-kube-user-ctx }}"
+ ;;
+ esac
#
# Install opm if required
@@ -100,16 +135,17 @@ runs:
name: Install OLM
shell: bash
run: |
- if [ "${{ env.CLUSTER_HAS_OLM }}" == "true" ]; then
+ if [ "${{ steps.cluster-config.outputs.cluster-has-olm }}" == "true" ]; then
# OLM already installed by default
echo "OLM already available in cluster"
+ echo "::set-output name=cluster-has-olm::${{ steps.cluster-config.outputs.cluster-has-olm }}"
exit 0
fi
if [ "${{ inputs.require-olm }}" != "true" ]; then
# OLM not explicitly requested
echo "OLM not explicity required for testing"
- echo "CLUSTER_HAS_OLM=false" >> $GITHUB_ENV
+ echo "::set-output name=cluster-has-olm::$(echo false)"
exit 0
fi
@@ -123,7 +159,7 @@ runs:
# Need to be admin so switch to the admin context
#
echo "Change to kube admin context"
- kubectl config use-context "${{ env.CLUSTER_KUBE_ADMIN_USER_CTX }}"
+ kubectl config use-context "${{ steps.cluster-config.outputs.cluster-kube-admin-user-ctx }}"
set +e
echo "Check if OLM is already installed"
@@ -144,5 +180,31 @@ runs:
echo "Return to original kube context"
kubectl config use-context "${ctx}"
+ echo "::set-output name=cluster-has-olm::$(echo true)"
echo "Complete"
- echo "CLUSTER_HAS_OLM=true" >> $GITHUB_ENV
+
+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-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-has-olm:
+ description: "Does the cluster have OLM"
+ value: ${{ steps.install-olm.outputs.cluster-has-olm }}
diff --git a/.github/actions/kamel-config-cluster/output-config.sh b/.github/actions/kamel-config-cluster/output-config.sh
new file mode 100755
index 0000000000..99e9d86d10
--- /dev/null
+++ b/.github/actions/kamel-config-cluster/output-config.sh
@@ -0,0 +1,81 @@
+#!/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:c:n:o:p:q:s:u:" opt; do
+ case "${opt}" in
+ a)
+ ADMIN_USER_CTX=${OPTARG}
+ ;;
+ c)
+ CATALOG_SOURCE_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 "::set-output name=cluster-image-registry-push-host::${PUSH_HOST}"
+echo "::set-output name=cluster-image-registry-pull-host::${PULL_HOST}"
+echo "::set-output name=cluster-image-registry-insecure::${INSECURE}"
+echo "::set-output name=cluster-kube-admin-user-ctx::${ADMIN_USER_CTX}"
+echo "::set-output name=cluster-kube-user-ctx::${USER_CTX}"
+
+# Set the image namespace
+echo "::set-output name=cluster-image-namespace::${IMAGE_NAMESPACE}"
+
+# Set the catalog source namespace
+echo "::set-output name=cluster-catalog-source-namespace::${CATALOG_SOURCE_NAMESPACE}"
+
+#
+# Export the flag for olm capability
+#
+echo "::set-output name=cluster-has-olm::${HAS_OLM}"
diff --git a/.github/actions/kamel-prepare-env/action.yml b/.github/actions/kamel-prepare-env/action.yml
index 666ae87f3b..45871e10b1 100644
--- a/.github/actions/kamel-prepare-env/action.yml
+++ b/.github/actions/kamel-prepare-env/action.yml
@@ -103,9 +103,6 @@ runs:
shell: bash
if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
run : |
-
- echo "::add-mask::${{ env.DEBUG_USE_EXISTING_IMAGE }}"
-
#
# Avoid preparing the environment repeatedly
#
diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
index bd77998deb..fd11628116 100644
--- a/.github/workflows/builder.yml
+++ b/.github/workflows/builder.yml
@@ -66,4 +66,5 @@ jobs:
uses: ./.github/actions/e2e-builder
with:
cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
+ cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }}
publisher: ${{ matrix.publisher }}
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index d3cdfd7558..6092fd4873 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -62,6 +62,7 @@ jobs:
uses: ./.github/actions/e2e-knative
with:
cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
+ cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }}
yaks:
runs-on: ubuntu-20.04
@@ -76,3 +77,4 @@ jobs:
uses: ./.github/actions/e2e-knative-yaks
with:
cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
+ cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }}
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index 55ce811170..bcb0650ec0 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -63,3 +63,4 @@ jobs:
uses: ./.github/actions/e2e-kubernetes
with:
cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
+ cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }}
diff --git a/.github/workflows/openshift.yml b/.github/workflows/openshift.yml
index 0470dbb152..dff8a72015 100644
--- a/.github/workflows/openshift.yml
+++ b/.github/workflows/openshift.yml
@@ -63,26 +63,32 @@ jobs:
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env
- - id: configure-platform
+ - id: config-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
cluster-type: 'ocp3'
- - id: build-kamel-binary
- name: Build Kamel Binary
- uses: ./.github/actions/kamel-build-binary
+ - 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 - depends on cluster being tested
+ build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }}
+ # Can be empty and so catalog source will not be created
+ catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
- - name: Install Kamel Cluster Setup
+ - id: install-kamel-cluster-setup
+ name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
with:
- kube-admin-user-ctx: ${{ steps.configure-platform.outputs.kube-admin-user-ctx }}
+ kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
- name: Run IT
run: |
- # Make the Apache Snapshots or Apache Staging repository enabled by default
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
-
# Then run integration tests
make test-integration
make test-builder
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 7967dc0553..fceb8603a6 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -62,3 +62,4 @@ jobs:
uses: ./.github/actions/e2e-upgrade
with:
cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
+ cluster-kube-config-data: ${{ secrets.E2E_KUBE_CONFIG }}
diff --git a/.gitmodules b/.gitmodules
index 237f21a3dd..4643631c43 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -8,7 +8,3 @@
path = .github/actions/action-dotenv-to-setenv
url = https://github.com/c-py/action-dotenv-to-setenv.git
branch = tags/v3
-[submodule ".github/actions/json-to-variables"]
- path = .github/actions/json-to-variables
- url = https://github.com/antifree/json-to-variables.git
- branch = tags/v1.0.1
diff --git a/config/rbac/operator-role.yaml b/config/rbac/operator-role.yaml
index e50508176a..0941d6ee29 100644
--- a/config/rbac/operator-role.yaml
+++ b/config/rbac/operator-role.yaml
@@ -165,24 +165,3 @@ rules:
- patch
- update
- watch
-- apiGroups:
- - operators.coreos.com
- resources:
- - operatorgroups
- - subscriptions
- - installplans
- verbs:
- - create
- - delete
- - update
- - get
- - list
- - watch
-- apiGroups:
- - operators.coreos.com
- resources:
- - clusterserviceversions
- verbs:
- - get
- - list
- - watch
From 9b07e5530c716322e43f9ec19ca832363438c214 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Thu, 9 Dec 2021 14:38:02 +0000
Subject: [PATCH 25/40] Marking tests as problematic
* Flagged to be fixed on OCP4
---
e2e/common/cli/dev_mode_test.go | 12 ++++++++++++
e2e/common/traits/health_test.go | 23 +++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/e2e/common/cli/dev_mode_test.go b/e2e/common/cli/dev_mode_test.go
index 251d83838b..db7fd7309e 100644
--- a/e2e/common/cli/dev_mode_test.go
+++ b/e2e/common/cli/dev_mode_test.go
@@ -38,6 +38,18 @@ import (
)
func TestRunDevMode(t *testing.T) {
+
+ /*
+ * TODO
+ * The changing of the yaml file constant from "string" to "magic" is not being
+ * picked up when deploying on OCP4 and so the test is failing.
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+
WithNewTestNamespace(t, func(ns string) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
diff --git a/e2e/common/traits/health_test.go b/e2e/common/traits/health_test.go
index 353a6e57c0..d17e5a98dc 100644
--- a/e2e/common/traits/health_test.go
+++ b/e2e/common/traits/health_test.go
@@ -25,6 +25,7 @@ package traits
import (
"encoding/json"
"fmt"
+ "os"
"testing"
. "github.com/onsi/gomega"
@@ -35,7 +36,17 @@ import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
)
+/*
+ * TODO
+ * Test has issues on OCP4. See TODO comment in-test for details.
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
func TestHealthTrait(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+
WithNewTestNamespace(t, func(ns string) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())
@@ -74,6 +85,18 @@ func TestHealthTrait(t *testing.T) {
// Check the ready condition has turned falsy
Eventually(IntegrationConditionStatus(ns, "java", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionFalse))
// And it contains details about the runtime state
+
+ //
+ // TODO
+ // Integration has different runtime state reporting on OCP4
+ //
+ // lastProbeTime: null
+ // lastTransitionTime: "2021-12-08T20:12:14Z"
+ // message: 'containers with unready status: [integration]'
+ // reason: ContainersNotReady
+ // status: "False"
+ // type: Ready
+ //
Eventually(IntegrationCondition(ns, "java", v1.IntegrationConditionReady), TestTimeoutMedium).Should(And(
WithTransform(IntegrationConditionReason, Equal(v1.IntegrationConditionRuntimeNotReadyReason)),
WithTransform(IntegrationConditionMessage, HavePrefix(fmt.Sprintf("[Pod %s runtime is not ready: map[consumer:route1:DOWN context:UP", pod.Name))),
From df5d6b91df707f0d9774c4059ea4213ce9a61d4b Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Thu, 9 Dec 2021 20:42:41 +0000
Subject: [PATCH 26/40] Support for adding run filter to integration tests
* Adds specific run variables to each integration test execution to
allow for filtering tests by a given regexp. Callers would need to
ensure a "-run" is prefixed to the value of the env var
---
script/Makefile | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/script/Makefile b/script/Makefile
index 672f5b1c12..461815cbcc 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -194,44 +194,44 @@ test: build
test-integration: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/common -tags=integration && \
- go test -timeout 60m -v ./e2e/common/build -tags=integration && \
- go test -timeout 60m -v ./e2e/common/cli -tags=integration && \
- go test -timeout 60m -v ./e2e/common/config -tags=integration && \
- go test -timeout 60m -v ./e2e/common/languages -tags=integration && \
- go test -timeout 60m -v ./e2e/common/traits -tags=integration
+ go test -timeout 60m -v ./e2e/common -tags=integration $(TEST_INTEGRATION_COMMON_RUN) && \
+ go test -timeout 60m -v ./e2e/common/build -tags=integration $(TEST_INTEGRATION_COMMON_BUILD_RUN) && \
+ go test -timeout 60m -v ./e2e/common/cli -tags=integration $(TEST_INTEGRATION_COMMON_CLI_RUN) && \
+ go test -timeout 60m -v ./e2e/common/config -tags=integration $(TEST_INTEGRATION_COMMON_CONFIG_RUN) && \
+ go test -timeout 60m -v ./e2e/common/languages -tags=integration $(TEST_INTEGRATION_COMMON_LANG_RUN) && \
+ go test -timeout 60m -v ./e2e/common/traits -tags=integration $(TEST_INTEGRATION_COMMON_TRAITS_RUN)
test-knative: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/knative -tags=integration
+ go test -timeout 60m -v ./e2e/knative -tags=integration $(TEST_KNATIVE_RUN)
test-builder: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/builder -tags=integration
+ go test -timeout 60m -v ./e2e/builder -tags=integration $(TEST_BUILDER_RUN)
test-local: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/local -tags=integration
+ go test -timeout 60m -v ./e2e/local -tags=integration $(TEST_LOCAL_RUN)
test-kamel-cli: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/common/cli -tags=integration
+ go test -timeout 60m -v ./e2e/common/cli -tags=integration $(TEST_KAMEL_CLI)
test-kustomize: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/common/kustomize -tags=integration
+ go test -timeout 60m -v ./e2e/common/kustomize -tags=integration $(TEST_KUSTOMIZE_RUN)
test-quarkus-native: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/native -tags=integration
+ go test -timeout 60m -v ./e2e/native -tags=integration $(TEST_QUARKUS_RUN)
test-service-binding: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/service-binding -tags=integration
+ go test -timeout 60m -v ./e2e/service-binding -tags=integration $(TEST_SERVICE_RUN)
test-upgrade: build
STAGING_RUNTIME_REPO="$(STAGING_RUNTIME_REPO)" \
- go test -timeout 60m -v ./e2e/upgrade -tags=integration
+ go test -timeout 60m -v ./e2e/upgrade -tags=integration $(TEST_UPGRADE_RUN)
build-kamel:
# Ensure the binary is statically linked when building on Linux due to ABI changes in newer glibc 2.32, otherwise
From 4b5a521a353c25282783dda4f0cd5b3cbe2c0459 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 10 Dec 2021 12:23:00 +0000
Subject: [PATCH 27/40] Flag metric duration tests as problematic due to random
failures on OCP4
---
e2e/common/operator_metrics_test.go | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/e2e/common/operator_metrics_test.go b/e2e/common/operator_metrics_test.go
index a3f12d1926..e1944ae69d 100644
--- a/e2e/common/operator_metrics_test.go
+++ b/e2e/common/operator_metrics_test.go
@@ -26,6 +26,7 @@ import (
"bytes"
"fmt"
"math"
+ "os"
"testing"
"time"
@@ -171,6 +172,17 @@ func TestMetrics(t *testing.T) {
))
})
+ /*
+ * TODO
+ * The duration_seconds tests keep randomly failing on OCP4 with slightly different duration values
+ * May need to lessen the strict checking parameters
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+
t.Run("reconciliation duration metric", func(t *testing.T) {
RegisterTestingT(t)
Expect(metrics).To(HaveKey("camel_k_reconciliation_duration_seconds"))
From fc2c5e2a3e12f1489355e19d0ea95740f04c3efe Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 14 Jan 2022 14:27:48 +0000
Subject: [PATCH 28/40] Flag tekton test as problematic
* Tries to install kamel using the camel-operator service
account, which on OCP4 makes use of the OLM. This SA does
not have the permissions for the OLM so the test needs to
use a different SA - don't want to extend the operator's
permissions.
---
e2e/common/tekton_test.go | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/e2e/common/tekton_test.go b/e2e/common/tekton_test.go
index 2ceb1c4d35..7b893c5098 100644
--- a/e2e/common/tekton_test.go
+++ b/e2e/common/tekton_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package common
import (
+ "os"
"testing"
. "github.com/onsi/gomega"
@@ -32,7 +33,23 @@ import (
// TestTektonLikeBehavior verifies that the kamel binary can be invoked from within the Camel K image.
// This feature is used in Tekton pipelines.
+
+/*
+ * TODO
+ * Test has issues on OCP4.
+ * Since that cluster installs via OLM, permissions are required for the
+ * service account doing the install to access the OLM, eg. get:subscriptions.
+ *
+ * Need to change the service account used to execute this test as do not
+ * want to extend the permissions of the operator service account
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
func TestTektonLikeBehavior(t *testing.T) {
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+
WithNewTestNamespace(t, func(ns string) {
Expect(CreateOperatorServiceAccount(ns)).To(Succeed())
Expect(CreateOperatorRole(ns)).To(Succeed())
From d0ac54f831490d9fd1e96c42b1ef732e044d3f66 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Wed, 5 Jan 2022 13:49:01 +0000
Subject: [PATCH 29/40] Ensure all kubernetes tests are executed rather than
just fail-first
* Provides coverage of all failing tests not just the tests up to the
failed test.
---
.github/actions/e2e-kubernetes/action.yml | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index 6dfde05fe0..ec8c2c276c 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -85,11 +85,17 @@ runs:
export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
- # Then run integration tests
- make test-integration
- make test-service-binding
- make test-quarkus-native
- make test-kustomize
+ # Then run all integration tests rather than ending on first failure
+ set -e
+ exit_code=0
+ make test-integration || exit_code=1
+ make test-service-binding || exit_code=1
+ make test-quarkus-native || exit_code=1
+ make test-kustomize || exit_code=1
+ set +e
+
+ echo "Tests completed with exit code: ${exit_code}"
+ exit ${exit_code}
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
From dfa245a953f422aa0880e91c016e93bfcc564f85 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Thu, 6 Jan 2022 13:51:18 +0000
Subject: [PATCH 30/40] Extract action bash scripts to their own files
* Allows for easier local unit testing of the functions
---
.github/actions/e2e-kubernetes/action.yml | 40 +---
.github/actions/e2e-kubernetes/exec-tests.sh | 119 ++++++++++++
.github/actions/kamel-build-binary/action.yml | 51 +----
.../kamel-build-binary/build-binary.sh | 111 +++++++++++
.../actions/kamel-build-bundle/action.yaml | 180 ++----------------
.../kamel-build-bundle/build-bundle-image.sh | 114 +++++++++++
.../kamel-build-bundle/build-image-catalog.sh | 90 +++++++++
.../kamel-build-bundle/build-index-image.sh | 173 +++++++++++++++++
.github/actions/kamel-cleanup/action.yaml | 29 +--
.github/actions/kamel-cleanup/cleanup.sh | 72 +++++++
.../kamel-install-cluster-setup/action.yml | 21 +-
.../install-cluster-setup.sh | 68 +++++++
12 files changed, 782 insertions(+), 286 deletions(-)
create mode 100755 .github/actions/e2e-kubernetes/exec-tests.sh
create mode 100755 .github/actions/kamel-build-binary/build-binary.sh
create mode 100755 .github/actions/kamel-build-bundle/build-bundle-image.sh
create mode 100755 .github/actions/kamel-build-bundle/build-image-catalog.sh
create mode 100755 .github/actions/kamel-build-bundle/build-index-image.sh
create mode 100755 .github/actions/kamel-cleanup/cleanup.sh
create mode 100755 .github/actions/kamel-install-cluster-setup/install-cluster-setup.sh
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index ec8c2c276c..2d004dcbef 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -64,38 +64,14 @@ runs:
name: Run IT
shell: bash
run: |
- # Cluster environment
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
-
- #
- # If bundle has been built and installed then use it
- #
- if [ -n "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ steps.config-cluster.outputs.cluster-image-namespace }}
- export KAMEL_INSTALL_OLM_SOURCE=${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
- fi
-
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
- export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
-
- export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
- export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
- export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
-
- # Then run all integration tests rather than ending on first failure
- set -e
- exit_code=0
- make test-integration || exit_code=1
- make test-service-binding || exit_code=1
- make test-quarkus-native || exit_code=1
- make test-kustomize || exit_code=1
- set +e
-
- echo "Tests completed with exit code: ${exit_code}"
- exit ${exit_code}
+ ./.github/actions/e2e-kubernetes/exec-tests.sh \
+ -c "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" \
+ -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 }}" \
+ -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}"
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
diff --git a/.github/actions/e2e-kubernetes/exec-tests.sh b/.github/actions/e2e-kubernetes/exec-tests.sh
new file mode 100755
index 0000000000..b3311a5c4e
--- /dev/null
+++ b/.github/actions/e2e-kubernetes/exec-tests.sh
@@ -0,0 +1,119 @@
+#!/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 kubernetes tests
+#
+####
+
+set -e
+
+while getopts ":c:i:l:n:s:v:x:" opt; do
+ case "${opt}" in
+ c)
+ BUILD_CATALOG_SOURCE=${OPTARG}
+ ;;
+ i)
+ IMAGE_NAMESPACE=${OPTARG}
+ ;;
+ l)
+ REGISTRY_PULL_HOST=${OPTARG}
+ ;;
+ n)
+ IMAGE_NAME=${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}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${IMAGE_NAMESPACE}
+ export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE}
+fi
+
+export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+export KAMEL_INSTALL_REGISTRY=${REGISTRY_PULL_HOST}
+export KAMEL_INSTALL_REGISTRY_INSECURE=${REGISTRY_INSECURE}
+export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
+
+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}
+
+# Then run all integration tests rather than ending on first failure
+set -e
+exit_code=0
+make test-integration || exit_code=1
+make test-service-binding || exit_code=1
+make test-quarkus-native || exit_code=1
+make test-kustomize || exit_code=1
+set +e
+
+echo "Tests completed with exit code: ${exit_code}"
+exit ${exit_code}
diff --git a/.github/actions/kamel-build-binary/action.yml b/.github/actions/kamel-build-binary/action.yml
index 8b87dd68b0..86451fe109 100644
--- a/.github/actions/kamel-build-binary/action.yml
+++ b/.github/actions/kamel-build-binary/action.yml
@@ -40,51 +40,12 @@ runs:
name: Build Kamel Operator
shell: bash
run: |
- if [ -n "${{ inputs.image-registry-push-host }}" ]; then
- #
- # Build with the PUSH host to ensure the correct image:tag
- # for docker to push the image.
- #
- export CUSTOM_IMAGE=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k
- fi
-
- if [ -n "${{ env.DEBUG_USE_EXISTING_IMAGE }}" ] && [ -n "${CUSTOM_IMAGE}" ]; then
- echo "Fetching Kamel from existing build"
-
- docker pull ${{ env.DEBUG_USE_EXISTING_IMAGE }}
- id=$(docker create ${{ env.DEBUG_USE_EXISTING_IMAGE }})
- docker cp $id:/usr/local/bin/kamel .
-
- docker tag ${{ env.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 package-artifacts images"
- if [ -n "${{ inputs.make-rules }}" ]; then
- RULES="${{ inputs.make-rules }}"
- fi
-
- if [ -n "${{ inputs.image-registry-push-host }}" ]; then
- RULES="${RULES} images-push"
- fi
-
- make ${RULES}
- fi
-
- echo "Moving kamel binary to /usr/local/bin"
- sudo mv ./kamel /usr/local/bin
- 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="${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k"
- BUILD_BINARY_LOCAL_IMAGE_VERSION="$(make get-version)"
- echo "::set-output name=build-binary-local-image-name::${BUILD_BINARY_LOCAL_IMAGE_NAME}"
- echo "::set-output name=build-binary-local-image-version::${BUILD_BINARY_LOCAL_IMAGE_VERSION}"
+ ./.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:
diff --git a/.github/actions/kamel-build-binary/build-binary.sh b/.github/actions/kamel-build-binary/build-binary.sh
new file mode 100755
index 0000000000..76ebd2be6b
--- /dev/null
+++ b/.github/actions/kamel-build-binary/build-binary.sh
@@ -0,0 +1,111 @@
+#!/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
+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 package-artifacts images"
+ if [ -n "${MAKE_RULES}" ]; then
+ RULES=" ${MAKE_RULES} "
+ fi
+
+ if [ -n "${REGISTRY_PUSH_HOST}" ]; then
+ RULES="${RULES} images-push"
+ fi
+
+ make ${RULES}
+fi
+
+echo "Moving kamel binary to /usr/local/bin"
+sudo mv ./kamel /usr/local/bin
+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 "::set-output name=build-binary-local-image-name::${BUILD_BINARY_LOCAL_IMAGE_NAME}"
+echo "Setting build-binary-local-image-name-version to ${BUILD_BINARY_LOCAL_IMAGE_VERSION}"
+echo "::set-output name=build-binary-local-image-version::${BUILD_BINARY_LOCAL_IMAGE_VERSION}"
diff --git a/.github/actions/kamel-build-bundle/action.yaml b/.github/actions/kamel-build-bundle/action.yaml
index 2a6f65f967..b52ccf88e4 100644
--- a/.github/actions/kamel-build-bundle/action.yaml
+++ b/.github/actions/kamel-build-bundle/action.yaml
@@ -47,59 +47,12 @@ runs:
name: Build Operator bundle
shell: bash
run: |
- 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 "${{ inputs.local-image-name }}" ]; then
- echo "Error: local-image-name not defined"
- exit 1
- fi
-
- if [ -z "${{ inputs.local-image-version }}" ]; then
- echo "Error: local-image-version not defined"
- exit 1
- fi
-
- if [ -z "${{ inputs.image-registry-push-host }}" ]; then
- echo "Error: image-registry-push-host not defined"
- exit 1
- fi
-
- if [ -z "${{ inputs.image-registry-pull-host }}" ]; then
- echo "Error: image-registry-pull-host not defined"
- exit 1
- fi
-
- #
- # Build with the PUSH host to ensure the correct image:tag
- # for docker to push the image.
- #
- export LOCAL_IMAGE_BUNDLE=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}
- export CUSTOM_IMAGE=${{ inputs.local-image-name }}
-
- export PREV_XY_CHANNEL=stable-$(make get-last-released-version | grep -Po "\d.\d")
- echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
- export NEW_XY_CHANNEL=stable-$(make get-version | grep -Po "\d.\d")
- echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV
-
- make bundle-build \
- BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} \
- DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" \
- CHANNELS="${NEW_XY_CHANNEL}"
-
- docker push ${LOCAL_IMAGE_BUNDLE}
-
- #
- # Use the PULL host to ensure the correct image:tag
- # is passed into the tests for the deployment to pull from
- #
- BUILD_BUNDLE_LOCAL_IMAGE="${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }}"
- echo "::set-output name=build-bundle-local-image::${BUILD_BUNDLE_LOCAL_IMAGE}"
-
+ ./.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
@@ -116,121 +69,22 @@ runs:
name: Create New Index Image
shell: bash
run: |
- export LOCAL_IIB=${{ inputs.image-registry-push-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}
- if ! command -v opm &> /dev/null
- then
- echo "opm could not be found. Has it not been installed?"
- exit 1
- fi
-
- # Shorten the vars
- PUSH_REGISTRY=${{ inputs.image-registry-push-host }}
- PULL_REGISTRY=${{ inputs.image-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 -e 's/.*:\([0-9]\+\).*/\1/')
- 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
- sudo sed -i "s/\(localhost.*\)/\1 ${PULL_HOST}/g" /etc/hosts
-
- #
- # Bring up the registry:2 instance if not already started
- #
- reg=$(docker ps -q -f name=triage-registry)
- if [ -z "${reg}" ]; then
- docker run -d -p ${PULL_PORT}:5000 --name triage-registry registry:2
- fi
-
- #
- # Tag the bundle image
- #
- docker tag \
- ${PUSH_REGISTRY}/${{ inputs.image-namespace }}/camel-k-bundle:${{ inputs.local-image-version }} \
- ${{ steps.build-bundle-image.outputs.build-bundle-local-image }}
-
- # Push the bundle image to the registry
- #
- docker push ${{ steps.build-bundle-image.outputs.build-bundle-local-image }}
- fi
-
- #
- # Construct an index image containing the newly built bundle image
- # Bug:
- # https://github.com/operator-framework/operator-registry/issues/870
- # Workaround:
- # image catalog layers contain root owned files so fails with `permission denied` error.
- # Running with sudo fixes this error (alternative is to switch to podman)
- #
- sudo opm index add \
- -c docker --skip-tls \
- --bundles ${{ steps.build-bundle-image.outputs.build-bundle-local-image }} \
- --from-index quay.io/operatorhubio/catalog:latest \
- --tag ${LOCAL_IIB}
-
- docker push ${LOCAL_IIB}
- BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX="${{ inputs.image-registry-pull-host }}/${{ inputs.image-namespace }}/camel-k-iib:${{ inputs.local-image-version }}"
- echo "::set-output name=build-bundle-image-bundle-index::${BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX}"
+ ./.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 }}"
- id: build-image-catalog
name: Create a new catalog to host the index image
shell: bash
run: |
-
- if [ -z "${{ inputs.catalog-source-namespace }}" ]; then
- echo "No catalog source namespace defined ... skipping catalog source creation"
- exit 0
- fi
-
- kubectl get ns ${{ inputs.catalog-source-namespace }} &> /dev/null
- if [ $? != 0 ]; then
- echo "Error: Catalog source cannot be created as namespace ${{ inputs.catalog-source-namespace }} does not exist."
- exit 1
- fi
-
- export BUILD_CATALOG_SOURCE="camel-k-test-source"
- echo "::set-output name=build-bundle-catalog-source-name::${BUILD_CATALOG_SOURCE}"
-
- cat < /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
+
+#
+# Build with the PUSH host to ensure the correct image:tag
+# for docker to push the image.
+#
+export LOCAL_IMAGE_BUNDLE=${REGISTRY_PUSH_HOST}/${IMAGE_NAMESPACE}/camel-k-bundle:${IMAGE_VERSION}
+export CUSTOM_IMAGE=${IMAGE_NAME}
+
+export PREV_XY_CHANNEL="stable-$(make get-last-released-version | grep -Po '\d.\d')"
+echo "PREV_XY_CHANNEL=${PREV_XY_CHANNEL}" >> $GITHUB_ENV
+export NEW_XY_CHANNEL=stable-$(make get-version | grep -Po "\d.\d")
+echo "NEW_XY_CHANNEL=${NEW_XY_CHANNEL}" >> $GITHUB_ENV
+
+make bundle-build \
+ BUNDLE_IMAGE_NAME=${LOCAL_IMAGE_BUNDLE} \
+ DEFAULT_CHANNEL="${NEW_XY_CHANNEL}" \
+ CHANNELS="${NEW_XY_CHANNEL}"
+
+docker push ${LOCAL_IMAGE_BUNDLE}
+
+#
+# Use the PULL host to ensure the correct image:tag
+# is passed into the tests for the deployment to pull from
+#
+BUILD_BUNDLE_LOCAL_IMAGE="${REGISTRY_PULL_HOST}/${IMAGE_NAMESPACE}/camel-k-bundle:${IMAGE_VERSION}"
+echo "Setting build-bundle-local-image to ${BUILD_BUNDLE_LOCAL_IMAGE}"
+echo "::set-output name=build-bundle-local-image::${BUILD_BUNDLE_LOCAL_IMAGE}"
diff --git a/.github/actions/kamel-build-bundle/build-image-catalog.sh b/.github/actions/kamel-build-bundle/build-image-catalog.sh
new file mode 100755
index 0000000000..bde06339f5
--- /dev/null
+++ b/.github/actions/kamel-build-bundle/build-image-catalog.sh
@@ -0,0 +1,90 @@
+#!/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 ":c:i:x:" opt; do
+ case "${opt}" in
+ 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 "${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
+
+export BUILD_CATALOG_SOURCE="camel-k-test-source"
+echo "Setting build-bundle-catalog-source-name to ${BUILD_CATALOG_SOURCE}"
+echo "::set-output name=build-bundle-catalog-source-name::${BUILD_CATALOG_SOURCE}"
+
+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 -e 's/.*:\([0-9]\+\).*/\1/')
+ 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
+ sudo sed -i "s/\(localhost.*\)/\1 ${PULL_HOST}/g" /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
+ #
+ docker tag \
+ ${PUSH_REGISTRY}/${IMAGE_NAMESPACE}/camel-k-bundle:${IMAGE_VERSION} \
+ ${BUNDLE_IMAGE}
+
+ # Push the bundle image to the registry
+ #
+ docker push ${BUNDLE_IMAGE}
+fi
+
+#
+# Construct an index image containing the newly built bundle image
+# Bug:
+# https://github.com/operator-framework/operator-registry/issues/870
+# Workaround:
+# image catalog layers contain root owned files so fails with `permission denied` error.
+# Running with sudo fixes this error (alternative is to switch to podman)
+#
+sudo opm index add \
+ -c docker --skip-tls \
+ --bundles ${BUNDLE_IMAGE} \
+ --from-index quay.io/operatorhubio/catalog:latest \
+ --tag ${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 "::set-output name=build-bundle-image-bundle-index::${BUILD_BUNDLE_LOCAL_IMAGE_BUNDLE_INDEX}"
diff --git a/.github/actions/kamel-cleanup/action.yaml b/.github/actions/kamel-cleanup/action.yaml
index aadc8a4a10..2f970a5908 100644
--- a/.github/actions/kamel-cleanup/action.yaml
+++ b/.github/actions/kamel-cleanup/action.yaml
@@ -31,30 +31,5 @@ runs:
shell: bash
if: ${{ always() }}
run: |
- set +e
- if command -v kamel &> /dev/null
- then
- kamel uninstall --olm=false --all
- fi
-
- # Ensure the CRDs are removed
- kubectl get crds | grep camel | awk '{print $1}' | xargs kubectl delete crd &> /dev/null
- set -e
-
- - id: remove-kamel-catalog-source
- name: Remove Catalog Source
- shell: bash
- if: ${{ always() }}
- run: |
- if [ -z "${{ inputs.build-bundle-catalog-source-name }}" ]; then
- # Catalog source never defined so nothing to do
- exit 0
- fi
-
- set +e
- CATALOG_NS=$(kubectl get catalogsource --all-namespaces | grep ${{ inputs.build-bundle-catalog-source-name }} | awk {'print $1'})
- for ns in ${CATALOG_NS}
- do
- kubectl delete CatalogSource ${{ inputs.build-bundle-catalog-source-name }} -n ${ns}
- done
- set -e
+ ./.github/actions/kamel-cleanup/cleanup.sh \
+ -c "${{ inputs.build-bundle-catalog-source-name }}"
diff --git a/.github/actions/kamel-cleanup/cleanup.sh b/.github/actions/kamel-cleanup/cleanup.sh
new file mode 100755
index 0000000000..03875dcf1d
--- /dev/null
+++ b/.github/actions/kamel-cleanup/cleanup.sh
@@ -0,0 +1,72 @@
+#!/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.
+# ---------------------------------------------------------------------------
+
+####
+#
+# Perform a cleanup of the test suite
+#
+####
+
+set -e
+
+while getopts ":c:" opt; do
+ case "${opt}" in
+ c)
+ BUILD_CATALOG_SOURCE=${OPTARG}
+ ;;
+ :)
+ echo "ERROR: Option -$OPTARG requires an argument"
+ exit 1
+ ;;
+ \?)
+ echo "ERROR: Invalid option -$OPTARG"
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+#
+# Remove installed kamel
+#
+set +e
+if command -v kamel &> /dev/null
+then
+ kamel uninstall --olm=false --all
+fi
+
+# Ensure the CRDs are removed
+kubectl get crds | grep camel | awk '{print $1}' | xargs kubectl delete crd &> /dev/null
+set -e
+
+#
+# Remove Catalog Source
+#
+if [ -z "${BUILD_CATALOG_SOURCE}" ]; then
+ # Catalog source never defined so nothing to do
+ exit 0
+fi
+
+set +e
+CATALOG_NS=$(kubectl get catalogsource --all-namespaces | grep ${BUILD_CATALOG_SOURCE} | awk {'print $1'})
+for ns in ${CATALOG_NS}
+do
+ kubectl delete CatalogSource ${BUILD_CATALOG_SOURCE} -n ${ns}
+done
+set -e
diff --git a/.github/actions/kamel-install-cluster-setup/action.yml b/.github/actions/kamel-install-cluster-setup/action.yml
index a0f17ae33c..4cc48fdbea 100644
--- a/.github/actions/kamel-install-cluster-setup/action.yml
+++ b/.github/actions/kamel-install-cluster-setup/action.yml
@@ -30,25 +30,8 @@ runs:
name: Install Camel-K Cluster Resources
shell: bash
run: |
- #
- # Get current context
- #
- ctx=$(kubectl config current-context)
-
- #
- # Need to be admin so switch to the admin context
- #
- kubectl config use-context "${{ inputs.kube-admin-user-ctx }}"
-
- #
- # Ensure built binary CRDs are always installed by turning off olm
- #
- kamel install --cluster-setup --olm=false
-
- #
- # Change back to original context
- #
- kubectl config use-context "${ctx}"
+ ./.github/actions/kamel-install-cluster-setup/install-cluster-setup.sh \
+ -a "${{ inputs.kube-admin-user-ctx }}"
- id: post-execution
shell: bash
diff --git a/.github/actions/kamel-install-cluster-setup/install-cluster-setup.sh b/.github/actions/kamel-install-cluster-setup/install-cluster-setup.sh
new file mode 100755
index 0000000000..36a706be55
--- /dev/null
+++ b/.github/actions/kamel-install-cluster-setup/install-cluster-setup.sh
@@ -0,0 +1,68 @@
+#!/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.
+# ---------------------------------------------------------------------------
+
+####
+#
+# Install the kamel setup using the admin context
+#
+####
+
+set -e
+
+while getopts ":a:" opt; do
+ case "${opt}" in
+ a)
+ KUBE_ADMIN_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_ADMIN_CTX}" ]; then
+ echo "Error: kube-admin-user-ctx not defined"
+ exit 1
+fi
+
+#
+# Get current context
+#
+ctx=$(kubectl config current-context)
+
+#
+# Need to be admin so switch to the admin context
+#
+kubectl config use-context "${KUBE_ADMIN_CTX}"
+
+#
+# Ensure built binary CRDs are always installed by turning off olm
+#
+kamel install --cluster-setup --olm=false
+
+#
+# Change back to original context
+#
+kubectl config use-context "${ctx}"
From 585527834f2b05328eb4376428e8679a9658d2e9 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 7 Jan 2022 19:29:44 +0000
Subject: [PATCH 31/40] Create pre-flight action and adds to cleanup action
* Pre-flight
* Adds action to execute a pre-flight test to ensure the kamel operator
is the correct version as that built by the workflow
* Cleanup
* Adds function to clean up any image streams left around by pushing
images to exposed cluster registries
---
.github/actions/e2e-kubernetes/action.yml | 12 ++
.github/actions/kamel-cleanup/action.yaml | 6 +-
.github/actions/kamel-cleanup/cleanup.sh | 19 +-
.../actions/kamel-preflight-test/action.yml | 55 ++++++
.../kamel-preflight-test/preflight-test.sh | 180 ++++++++++++++++++
5 files changed, 270 insertions(+), 2 deletions(-)
create mode 100644 .github/actions/kamel-preflight-test/action.yml
create mode 100755 .github/actions/kamel-preflight-test/preflight-test.sh
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index 2d004dcbef..ad5f6f57f6 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -60,6 +60,17 @@ runs:
with:
kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
+ - id: preflight-test
+ name: Preflight Check Test
+ uses: ./.github/actions/kamel-preflight-test
+ with:
+ build-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+ image-registry-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ image-name: ${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ image-registry-insecure: ${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
+ image-version: ${{ steps.build-kamel.outputs.build-binary-local-image-version }}
+
- id: run-it
name: Run IT
shell: bash
@@ -78,3 +89,4 @@ runs:
if: ${{ always() }}
with:
build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
diff --git a/.github/actions/kamel-cleanup/action.yaml b/.github/actions/kamel-cleanup/action.yaml
index 2f970a5908..cace15a076 100644
--- a/.github/actions/kamel-cleanup/action.yaml
+++ b/.github/actions/kamel-cleanup/action.yaml
@@ -22,6 +22,9 @@ inputs:
build-bundle-catalog-source:
description: "Name of the catalog source for the build bundle image"
required: true
+ image-namespace:
+ description: "Installed location of the images if resident on the cluster (only applies to clusters with partnered registries)"
+ required: false
runs:
using: "composite"
@@ -32,4 +35,5 @@ runs:
if: ${{ always() }}
run: |
./.github/actions/kamel-cleanup/cleanup.sh \
- -c "${{ inputs.build-bundle-catalog-source-name }}"
+ -c "${{ inputs.build-bundle-catalog-source }}" \
+ -i "${{ inputs.image-namespace }}"
diff --git a/.github/actions/kamel-cleanup/cleanup.sh b/.github/actions/kamel-cleanup/cleanup.sh
index 03875dcf1d..3a5b4aacf9 100755
--- a/.github/actions/kamel-cleanup/cleanup.sh
+++ b/.github/actions/kamel-cleanup/cleanup.sh
@@ -25,11 +25,14 @@
set -e
-while getopts ":c:" opt; do
+while getopts ":c:i:" opt; do
case "${opt}" in
c)
BUILD_CATALOG_SOURCE=${OPTARG}
;;
+ i)
+ IMAGE_NAMESPACE=${OPTARG}
+ ;;
:)
echo "ERROR: Option -$OPTARG requires an argument"
exit 1
@@ -55,6 +58,19 @@ fi
kubectl get crds | grep camel | awk '{print $1}' | xargs kubectl delete crd &> /dev/null
set -e
+if [ -n "${IMAGE_NAMESPACE}" ]; then
+ imgstreams="camel-k camel-k-bundle camel-k-iib"
+ set +e
+ for cis in ${imgstreams}
+ do
+ if kubectl get is ${cis} -n ${IMAGE_NAMESPACE} &> /dev/null
+ then
+ kubectl delete is ${cis} -n ${IMAGE_NAMESPACE}
+ fi
+ done
+ set -e
+fi
+
#
# Remove Catalog Source
#
@@ -63,6 +79,7 @@ if [ -z "${BUILD_CATALOG_SOURCE}" ]; then
exit 0
fi
+
set +e
CATALOG_NS=$(kubectl get catalogsource --all-namespaces | grep ${BUILD_CATALOG_SOURCE} | awk {'print $1'})
for ns in ${CATALOG_NS}
diff --git a/.github/actions/kamel-preflight-test/action.yml b/.github/actions/kamel-preflight-test/action.yml
new file mode 100644
index 0000000000..5cf1041ecd
--- /dev/null
+++ b/.github/actions/kamel-preflight-test/action.yml
@@ -0,0 +1,55 @@
+# ---------------------------------------------------------------------------
+# 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-preflight-test
+description: 'Does a preflight-test to check the operator can be installed correctly'
+
+inputs:
+ build-catalog-source:
+ description: "The name of the bundle catalog (only installed in the cluster if OLM is used)"
+ required: false
+ image-namespace:
+ description: 'Namespace in which the image is stored'
+ required: true
+ image-registry-host:
+ description: 'Location of image registry host'
+ required: true
+ image-name:
+ description: 'Reference of the camel-k image'
+ required: true
+ image-registry-insecure:
+ description: "Whether the registry is insecure"
+ required: true
+ image-version:
+ description: "Reference of the camel-k image version"
+ required: true
+
+runs:
+ using: "composite"
+
+ steps:
+ - id: preflight-test
+ name: Execute Preflight Test
+ shell: bash
+ run: |
+ ./.github/actions/kamel-preflight-test/preflight-test.sh \
+ -c "${{ inputs.build-catalog-source }}" \
+ -i "${{ inputs.image-namespace }}" \
+ -l "${{ inputs.image-registry-host }}" \
+ -n "${{ inputs.image-name }}" \
+ -s "${{ inputs.image-registry-insecure }}" \
+ -v "${{ inputs.image-version }}"
diff --git a/.github/actions/kamel-preflight-test/preflight-test.sh b/.github/actions/kamel-preflight-test/preflight-test.sh
new file mode 100755
index 0000000000..4061d306b1
--- /dev/null
+++ b/.github/actions/kamel-preflight-test/preflight-test.sh
@@ -0,0 +1,180 @@
+#!/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 kubernetes tests
+#
+####
+
+set -e
+
+while getopts ":c:i:l:n:s:v:" opt; do
+ case "${opt}" in
+ c)
+ BUILD_CATALOG_SOURCE=${OPTARG}
+ ;;
+ i)
+ IMAGE_NAMESPACE=${OPTARG}
+ ;;
+ l)
+ REGISTRY_PULL_HOST=${OPTARG}
+ ;;
+ n)
+ IMAGE_NAME=${OPTARG}
+ ;;
+ s)
+ REGISTRY_INSECURE=${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))
+
+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
+
+#
+# Create the preflight test namespace
+#
+NAMESPACE="preflight"
+set +e
+if kubectl get ns ${NAMESPACE} &> /dev/null
+then
+ kubectl delete ns ${NAMESPACE}
+fi
+set -e
+
+kubectl create namespace ${NAMESPACE}
+if [ $? != 0 ]; then
+ echo "Error: failed to create the ${NAMESPACE} namespace"
+ exit 1
+fi
+
+#trap "kubectl delete ns ${NAMESPACE} &> /dev/null" EXIT
+
+# Cluster environment
+export CUSTOM_IMAGE=${IMAGE_NAME}
+export CUSTOM_VERSION=${IMAGE_VERSION}
+
+#
+# If bundle has been built and installed then use it
+#
+has_olm="false"
+if [ -n "${BUILD_CATALOG_SOURCE}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${IMAGE_NAMESPACE}
+ export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE}
+ has_olm="true"
+fi
+
+export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+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 determine the policy
+export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
+
+#
+# Install the operator
+#
+kamel install -n ${NAMESPACE} --olm=${has_olm}
+if [ $? != 0 ]; then
+ echo "Error: kamel install returned an error."
+ exit 1
+fi
+
+sleep 3
+
+#
+# Wait for the operator to be running
+#
+timeout=180
+i=1
+command="kubectl get pods -n ${NAMESPACE} 2> /dev/null | grep camel-k | grep Running &> /dev/null"
+
+until eval "${command}"
+do
+ ((i++))
+ if [ "${i}" -gt "${timeout}" ]; then
+ echo "kamel operator not successfully installed, aborting due to ${timeout}s timeout"
+ exit 1
+ fi
+
+ sleep 1
+done
+
+echo "Camel-K operator up and running"
+
+camel_operator=$(kubectl get pods -n ${NAMESPACE} | grep camel-k | awk '{print $1}')
+camel_op_version=$(kubectl logs ${camel_operator} -n ${NAMESPACE} | sed -n 's/.*"Camel K Operator Version: \(.*\)"}/\1/p')
+camel_op_commit=$(kubectl logs ${camel_operator} -n ${NAMESPACE} | sed -n 's/.*"Camel K Git Commit: \(.*\)"}/\1/p')
+
+src_commit=$(git rev-parse HEAD)
+
+#
+# Test whether the versions are the same
+#
+if [ "${camel_op_version}" != "${IMAGE_VERSION}" ]; then
+ echo "Preflight Test: Failure - Installed operator version (${camel_op_version} does not match expected version (${IMAGE_VERSION})"
+ exit 1
+fi
+
+#
+# Test whether the commit ids are the same
+#
+if [ "${camel_op_commit}" != "${src_commit}" ]; then
+ echo "Preflight Test: Failure - Installed operator commit id (${camel_op_commit}) does not match expected commit id (${src_commit})"
+ exit 1
+fi
+
+echo "Preflight Test: Success"
From 22fb0cc7eba06c59b5d9b0cbe34252e02d7282a6 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 7 Jan 2022 23:28:06 +0000
Subject: [PATCH 32/40] Fix to avoid caching out-of-date images on clusters in
e2e testing
* Ensures that the ImagePullPolicy is set to Always in the bundle csv to
avoid target clusters retaining out-of-date cached camel-k images
---
.github/actions/e2e-kubernetes/exec-tests.sh | 5 +++++
.../kamel-build-bundle/build-bundle-image.sh | 13 +++++++++++++
.../actions/kamel-preflight-test/preflight-test.sh | 3 ++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/.github/actions/e2e-kubernetes/exec-tests.sh b/.github/actions/e2e-kubernetes/exec-tests.sh
index b3311a5c4e..b20cf6bcea 100755
--- a/.github/actions/e2e-kubernetes/exec-tests.sh
+++ b/.github/actions/e2e-kubernetes/exec-tests.sh
@@ -102,6 +102,11 @@ 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}
diff --git a/.github/actions/kamel-build-bundle/build-bundle-image.sh b/.github/actions/kamel-build-bundle/build-bundle-image.sh
index 4844499719..ff5aef7b11 100755
--- a/.github/actions/kamel-build-bundle/build-bundle-image.sh
+++ b/.github/actions/kamel-build-bundle/build-bundle-image.sh
@@ -86,6 +86,19 @@ if [ -z "${REGISTRY_PULL_HOST}" ]; then
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 config/manager > /dev/null
+kustomize edit add patch --path patch-image-pull-policy-always.yaml --kind Deployment
+popd
+
#
# Build with the PUSH host to ensure the correct image:tag
# for docker to push the image.
diff --git a/.github/actions/kamel-preflight-test/preflight-test.sh b/.github/actions/kamel-preflight-test/preflight-test.sh
index 4061d306b1..bacae0bceb 100755
--- a/.github/actions/kamel-preflight-test/preflight-test.sh
+++ b/.github/actions/kamel-preflight-test/preflight-test.sh
@@ -121,7 +121,8 @@ 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 determine the policy
+# since, for OLM, the csv determines the policy.
+# (see kamel-build-bundle/build-bundle-image.sh)
export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
#
From 0625625392813d8e1f9646441078faac31984b7a Mon Sep 17 00:00:00 2001
From: Christoph Deppisch
Date: Tue, 11 Jan 2022 16:18:00 +0100
Subject: [PATCH 33/40] fix: Fix YAKS Knative apache-kamelet-catalog test
Make sure to wait for the integration platform to be running before starting the test integration
---
.github/workflows/knative.yml | 2 +-
e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index 6092fd4873..d007c59663 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -73,7 +73,7 @@ jobs:
persist-credentials: false
submodules: recursive
- - name: Execute KNative YAKS Tests
+ - name: Execute Knative YAKS Tests
uses: ./.github/actions/e2e-knative-yaks
with:
cluster-config-data: ${{ secrets.E2E_CLUSTER_CONFIG }}
diff --git a/e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml b/e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml
index ab0c02e724..62e94bc56e 100644
--- a/e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml
+++ b/e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml
@@ -21,6 +21,6 @@ config:
pre:
- name: installation
run: |
- kamel install -n $YAKS_NAMESPACE
+ kamel install -w -n $YAKS_NAMESPACE
kamel run logger.groovy -w -n $YAKS_NAMESPACE
From d62e880f1717dd338f009f030b2f1c6bc18f68d5 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 11 Jan 2022 17:43:29 +0000
Subject: [PATCH 34/40] Configure workflows to be optionally executed manually
* Allows for easier debugging and quicker problem isolating.
---
.github/workflows/build.yml | 2 ++
.github/workflows/builder.yml | 2 ++
.github/workflows/knative.yml | 2 ++
.github/workflows/kubernetes.yml | 2 ++
.github/workflows/local.yml | 2 ++
.github/workflows/openshift.yml | 2 ++
.github/workflows/upgrade.yml | 2 ++
7 files changed, 14 insertions(+)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e5c5569e1a..217b404c5c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -42,6 +42,8 @@ on:
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
+ workflow_dispatch:
+ inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
index fd11628116..de177a6ede 100644
--- a/.github/workflows/builder.yml
+++ b/.github/workflows/builder.yml
@@ -42,6 +42,8 @@ on:
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
+ workflow_dispatch:
+ inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index d007c59663..717f1bc9d8 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -42,6 +42,8 @@ on:
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
+ workflow_dispatch:
+ inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index bcb0650ec0..db6d8f4414 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -42,6 +42,8 @@ on:
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
+ workflow_dispatch:
+ inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
diff --git a/.github/workflows/local.yml b/.github/workflows/local.yml
index df38900679..392238f283 100644
--- a/.github/workflows/local.yml
+++ b/.github/workflows/local.yml
@@ -42,6 +42,8 @@ on:
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
+ workflow_dispatch:
+ inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
diff --git a/.github/workflows/openshift.yml b/.github/workflows/openshift.yml
index dff8a72015..ac8ab2c780 100644
--- a/.github/workflows/openshift.yml
+++ b/.github/workflows/openshift.yml
@@ -42,6 +42,8 @@ on:
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
+ workflow_dispatch:
+ inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index fceb8603a6..5b62587d11 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -42,6 +42,8 @@ on:
- 'KEYS'
- 'LICENSE'
- 'NOTICE'
+ workflow_dispatch:
+ inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
From ff88f0303fcb5750e4c13ea3159f1cceb35f0422 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Tue, 11 Jan 2022 18:08:48 +0000
Subject: [PATCH 35/40] Break out remaining e2e actions into their own bash
scripts
* Allows for better control and checking of parameters
* Better debugging for scripts to be tested locally
---
.github/actions/e2e-builder/action.yml | 30 ++--
.github/actions/e2e-builder/exec-tests.sh | 115 +++++++++++++++
.github/actions/e2e-knative-yaks/action.yml | 48 +++----
.../actions/e2e-knative-yaks/exec-tests.sh | 118 ++++++++++++++++
.github/actions/e2e-knative/action.yml | 34 ++---
.github/actions/e2e-knative/exec-tests.sh | 117 ++++++++++++++++
.github/actions/e2e-upgrade/action.yml | 33 ++---
.github/actions/e2e-upgrade/exec-tests.sh | 124 ++++++++++++++++
.github/actions/kamel-cleanup/action.yaml | 3 +-
.../actions/kamel-cleanup/cleanup-knative.sh | 69 +++++++++
.github/actions/kamel-cleanup/cleanup.sh | 41 ++++--
.../actions/kamel-install-knative/action.yml | 39 +-----
.../kamel-install-knative/install-knative.sh | 132 ++++++++++++++++++
13 files changed, 755 insertions(+), 148 deletions(-)
create mode 100755 .github/actions/e2e-builder/exec-tests.sh
create mode 100755 .github/actions/e2e-knative-yaks/exec-tests.sh
create mode 100755 .github/actions/e2e-knative/exec-tests.sh
create mode 100755 .github/actions/e2e-upgrade/exec-tests.sh
create mode 100755 .github/actions/kamel-cleanup/cleanup-knative.sh
create mode 100755 .github/actions/kamel-install-knative/install-knative.sh
diff --git a/.github/actions/e2e-builder/action.yml b/.github/actions/e2e-builder/action.yml
index a4e814bc29..d46cc7174c 100644
--- a/.github/actions/e2e-builder/action.yml
+++ b/.github/actions/e2e-builder/action.yml
@@ -69,30 +69,18 @@ runs:
env:
KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ inputs.publisher }}
run: |
- # Cluster environment
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
-
- #
- # If bundle has been built and installed then use it
- #
- if [ -n "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ steps.config-cluster.outputs.cluster-image-namespace }}
- export KAMEL_INSTALL_OLM_SOURCE=${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
- fi
-
- export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
- export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
- export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
- export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
- export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
-
- # Then run integration tests
- make test-builder
+ ./.github/actions/e2e-builder/exec-tests.sh \
+ -c "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" \
+ -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 }}" \
+ -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}"
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
with:
build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
diff --git a/.github/actions/e2e-builder/exec-tests.sh b/.github/actions/e2e-builder/exec-tests.sh
new file mode 100755
index 0000000000..2a20c4bcb3
--- /dev/null
+++ b/.github/actions/e2e-builder/exec-tests.sh
@@ -0,0 +1,115 @@
+#!/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 builder tests
+#
+####
+
+set -e
+
+while getopts ":c:i:l:n:s:v:x:" opt; do
+ case "${opt}" in
+ c)
+ BUILD_CATALOG_SOURCE=${OPTARG}
+ ;;
+ i)
+ IMAGE_NAMESPACE=${OPTARG}
+ ;;
+ l)
+ REGISTRY_PULL_HOST=${OPTARG}
+ ;;
+ n)
+ IMAGE_NAME=${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}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${IMAGE_NAMESPACE}
+ export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE}
+fi
+
+export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+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}
+
+# Then run integration tests
+make test-builder
diff --git a/.github/actions/e2e-knative-yaks/action.yml b/.github/actions/e2e-knative-yaks/action.yml
index df367aed29..541cd7c3f1 100644
--- a/.github/actions/e2e-knative-yaks/action.yml
+++ b/.github/actions/e2e-knative-yaks/action.yml
@@ -66,41 +66,33 @@ runs:
with:
kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
+ - id: preflight-test
+ name: Preflight Check Test
+ uses: ./.github/actions/kamel-preflight-test
+ with:
+ build-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+ image-registry-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ image-name: ${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ image-registry-insecure: ${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
+ image-version: ${{ steps.build-kamel.outputs.build-binary-local-image-version }}
+
- id: run-it
name: Run IT
shell: bash
run: |
- # Cluster environment
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
-
- #
- # If bundle has been built and installed then use it
- #
- if [ -n "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ steps.config-cluster.outputs.cluster-image-namespace }}
- export KAMEL_INSTALL_OLM_SOURCE=${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
- fi
-
- export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
- export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
- export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
- export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
-
- # Test options
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
- export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
-
- # Install Yaks globally
- yaks install
-
- # Then run integration tests
- yaks test e2e/yaks/common
+ ./.github/actions/e2e-knative-yaks/exec-tests.sh \
+ -c "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" \
+ -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 }}" \
+ -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}"
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
with:
build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
diff --git a/.github/actions/e2e-knative-yaks/exec-tests.sh b/.github/actions/e2e-knative-yaks/exec-tests.sh
new file mode 100755
index 0000000000..428018a51a
--- /dev/null
+++ b/.github/actions/e2e-knative-yaks/exec-tests.sh
@@ -0,0 +1,118 @@
+#!/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-yaks tests
+#
+####
+
+set -e
+
+while getopts ":c:i:l:n:s:v:x:" opt; do
+ case "${opt}" in
+ c)
+ BUILD_CATALOG_SOURCE=${OPTARG}
+ ;;
+ i)
+ IMAGE_NAMESPACE=${OPTARG}
+ ;;
+ l)
+ REGISTRY_PULL_HOST=${OPTARG}
+ ;;
+ n)
+ IMAGE_NAME=${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}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${IMAGE_NAMESPACE}
+ export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE}
+fi
+
+export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+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}
+
+# Install Yaks globally
+yaks install
+
+# Then run integration tests
+yaks test e2e/yaks/common
diff --git a/.github/actions/e2e-knative/action.yml b/.github/actions/e2e-knative/action.yml
index ce3658ad5c..54f35f0568 100644
--- a/.github/actions/e2e-knative/action.yml
+++ b/.github/actions/e2e-knative/action.yml
@@ -67,34 +67,18 @@ runs:
name: Run IT
shell: bash
run: |
- # Cluster environment
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
-
- #
- # If bundle has been built and installed then use it
- #
- if [ -n "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" ]; then
- export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${{ steps.config-cluster.outputs.cluster-image-namespace }}
- export KAMEL_INSTALL_OLM_SOURCE=${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
- fi
-
- export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
- export KAMEL_INSTALL_OPERATOR_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION}
- export CAMEL_K_TEST_IMAGE_NAME=${CUSTOM_IMAGE}
- export CAMEL_K_TEST_IMAGE_VERSION=${CUSTOM_VERSION}
-
- # Test options
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
- export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
-
- # Then run integration tests
- make test-knative
+ ./.github/actions/e2e-knative/exec-tests.sh \
+ -c "${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}" \
+ -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 }}" \
+ -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}"
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
with:
build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
diff --git a/.github/actions/e2e-knative/exec-tests.sh b/.github/actions/e2e-knative/exec-tests.sh
new file mode 100755
index 0000000000..0053807ea5
--- /dev/null
+++ b/.github/actions/e2e-knative/exec-tests.sh
@@ -0,0 +1,117 @@
+#!/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 ":c:i:l:n:s:v:x:" opt; do
+ case "${opt}" in
+ c)
+ BUILD_CATALOG_SOURCE=${OPTARG}
+ ;;
+ i)
+ IMAGE_NAMESPACE=${OPTARG}
+ ;;
+ l)
+ REGISTRY_PULL_HOST=${OPTARG}
+ ;;
+ n)
+ IMAGE_NAME=${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}" ]; then
+ export KAMEL_INSTALL_OLM_SOURCE_NAMESPACE=${IMAGE_NAMESPACE}
+ export KAMEL_INSTALL_OLM_SOURCE=${BUILD_CATALOG_SOURCE}
+fi
+
+export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
+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 KAMEL_INSTALL_OPERATOR_ENV_VARS=KAMEL_INSTALL_DEFAULT_KAMELETS=false
+
+# Then run integration tests
+make test-knative
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index b968392b54..7b3b2bf798 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -84,32 +84,19 @@ runs:
- name: Run IT
shell: bash
run: |
- # Use the last released Kamel CLI
- export RELEASED_KAMEL_BIN=${{ steps.released-kamel-cli.outputs.released-kamel-binary }}
-
- echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)"
-
- # Configure install options
- export CUSTOM_IMAGE=${{ steps.build-kamel.outputs.build-binary-local-image-name }}
- export CUSTOM_VERSION=${{ steps.build-kamel.outputs.build-binary-local-image-version }}
- export KAMEL_INSTALL_MAVEN_REPOSITORIES=$(make get-staging-repo)
- export KAMEL_INSTALL_REGISTRY=${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
- export KAMEL_INSTALL_REGISTRY_INSECURE=${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
-
- # Despite building a bundle we don't want it installed immediately so no OLM_INDEX_BUNDLE var
-
- # Configure test options
- export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest
- export CAMEL_K_NEW_IIB=${{ steps.build-kamel.outputs.build-bundle-image-bundle-index }}
- 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=${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}
-
- # Then run integration tests
- make test-upgrade
+ # Note different parameters due to alternative installation
+ ./.github/actions/e2e-upgrade/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 }}" \
+ -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 }}"
- name: Cleanup
uses: ./.github/actions/kamel-cleanup
if: ${{ always() }}
with:
build-bundle-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
diff --git a/.github/actions/e2e-upgrade/exec-tests.sh b/.github/actions/e2e-upgrade/exec-tests.sh
new file mode 100755
index 0000000000..78835f3397
--- /dev/null
+++ b/.github/actions/e2e-upgrade/exec-tests.sh
@@ -0,0 +1,124 @@
+#!/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: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}
+ ;;
+ 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_MAVEN_REPOSITORIES=$(make get-staging-repo)
+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_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
+make test-upgrade
diff --git a/.github/actions/kamel-cleanup/action.yaml b/.github/actions/kamel-cleanup/action.yaml
index cace15a076..0d6d2e1288 100644
--- a/.github/actions/kamel-cleanup/action.yaml
+++ b/.github/actions/kamel-cleanup/action.yaml
@@ -36,4 +36,5 @@ runs:
run: |
./.github/actions/kamel-cleanup/cleanup.sh \
-c "${{ inputs.build-bundle-catalog-source }}" \
- -i "${{ inputs.image-namespace }}"
+ -i "${{ inputs.image-namespace }}" \
+ -x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}"
diff --git a/.github/actions/kamel-cleanup/cleanup-knative.sh b/.github/actions/kamel-cleanup/cleanup-knative.sh
new file mode 100755
index 0000000000..9b50296fc9
--- /dev/null
+++ b/.github/actions/kamel-cleanup/cleanup-knative.sh
@@ -0,0 +1,69 @@
+#!/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.
+# ---------------------------------------------------------------------------
+
+####
+#
+# Perform a cleanup of knative installation
+#
+####
+set +e
+
+cleanup_resources() {
+ local kind="${1}"
+ local needle="${2}"
+
+ # Stops "Resource not found message" and exit code to 0
+ local result=$(kubectl --ignore-not-found=true get ${kind} | grep ${needle})
+ if [ $? == 0 ]; then
+ names=$(echo "${result}" | awk '{print $1}')
+ for r in ${names}
+ do
+ # Timeout after 10 minutes
+ kubectl delete --now --timeout=600s ${kind} ${r} 1> /dev/null
+ done
+ fi
+
+ echo "Done"
+}
+
+# Remove any namespaces
+echo -n "Removing testing knative namespaces ... "
+cleanup_resources ns 'knative-eventing\|knative-serving\|kourier-system'
+
+# Mutating webhooks
+echo -n "Removing testing knative mutating webhooks ... "
+cleanup_resources MutatingWebhookConfiguration 'knative.dev'
+
+# Validating webhooks
+echo -n "Removing testing knative validating webhooks ... "
+cleanup_resources ValidatingWebhookConfiguration 'knative.dev'
+
+# Cluster Role Bindings
+echo -n "Removing testing knative cluster role bindings ... "
+cleanup_resources clusterrolebindings 'kourier\|knative\|imc'
+
+# Cluster Roles
+echo -n "Removing testing knative cluster roles ... "
+cleanup_resources clusterroles 'knative\|imc'
+
+# CRDS
+echo -n "Removing testing knative CRDs ... "
+cleanup_resources crds 'knative.dev'
+
+set -e
diff --git a/.github/actions/kamel-cleanup/cleanup.sh b/.github/actions/kamel-cleanup/cleanup.sh
index 3a5b4aacf9..47e48e76dc 100755
--- a/.github/actions/kamel-cleanup/cleanup.sh
+++ b/.github/actions/kamel-cleanup/cleanup.sh
@@ -25,7 +25,7 @@
set -e
-while getopts ":c:i:" opt; do
+while getopts ":c:i:x:" opt; do
case "${opt}" in
c)
BUILD_CATALOG_SOURCE=${OPTARG}
@@ -33,6 +33,9 @@ while getopts ":c:i:" opt; do
i)
IMAGE_NAMESPACE=${OPTARG}
;;
+ x)
+ SAVE_NAMESPACES=${OPTARG}
+ ;;
:)
echo "ERROR: Option -$OPTARG requires an argument"
exit 1
@@ -45,6 +48,12 @@ while getopts ":c:i:" opt; do
done
shift $((OPTIND-1))
+
+if [ "${SAVE_NAMESPACES}" == "true" ]; then
+ echo "Skipping cleanup since SAVE_NAMESPACES has been set to true"
+ exit 0
+fi
+
#
# Remove installed kamel
#
@@ -59,6 +68,7 @@ kubectl get crds | grep camel | awk '{print $1}' | xargs kubectl delete crd &> /
set -e
if [ -n "${IMAGE_NAMESPACE}" ]; then
+ echo -n "Removing compiled image streams ... "
imgstreams="camel-k camel-k-bundle camel-k-iib"
set +e
for cis in ${imgstreams}
@@ -69,21 +79,28 @@ if [ -n "${IMAGE_NAMESPACE}" ]; then
fi
done
set -e
+ echo "Done"
fi
#
# Remove Catalog Source
#
-if [ -z "${BUILD_CATALOG_SOURCE}" ]; then
- # Catalog source never defined so nothing to do
- exit 0
-fi
+if [ -n "${BUILD_CATALOG_SOURCE}" ]; then
+ set +e
+ echo -n "Removing testing catalogsource ... "
+ kubectl get catalogsource --all-namespaces | \
+ grep ${BUILD_CATALOG_SOURCE} | awk {'print $1'} | \
+ xargs kubectl delete CatalogSource &> /dev/null
+ if [ $? == 0 ]; then
+ echo "Done"
+ else
+ echo
+ fi
+ set -e
+fi
-set +e
-CATALOG_NS=$(kubectl get catalogsource --all-namespaces | grep ${BUILD_CATALOG_SOURCE} | awk {'print $1'})
-for ns in ${CATALOG_NS}
-do
- kubectl delete CatalogSource ${BUILD_CATALOG_SOURCE} -n ${ns}
-done
-set -e
+#
+# Remove KNative resources
+#
+./.github/actions/kamel-cleanup/cleanup-knative.sh
diff --git a/.github/actions/kamel-install-knative/action.yml b/.github/actions/kamel-install-knative/action.yml
index 4b33123607..40f647d1ef 100644
--- a/.github/actions/kamel-install-knative/action.yml
+++ b/.github/actions/kamel-install-knative/action.yml
@@ -23,41 +23,4 @@ runs:
- name: Install Knative
shell: bash
run: |
- # Prerequisites
- sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
-
- export SERVING_VERSION=knative-v1.1.0
- export EVENTING_VERSION=knative-v1.1.0
- export KOURIER_VERSION=knative-v1.1.0
-
- # Serving
- kubectl apply --filename https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-crds.yaml
- curl -L -s https://github.com/knative/serving/releases/download/$SERVING_VERSION/serving-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
-
- # Kourier
- kubectl apply --filename https://github.com/knative-sandbox/net-kourier/releases/download/$KOURIER_VERSION/kourier.yaml
- kubectl patch configmap/config-network \
- --namespace knative-serving \
- --type merge \
- --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
-
- # Eventing
- kubectl apply --filename https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-crds.yaml
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-core.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
-
- # Eventing channels
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/in-memory-channel.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
-
- # Eventing broker
- curl -L -s https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/mt-channel-broker.yaml | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - | kubectl apply -f -
-
- # Eventing sugar controller for injection
- kubectl apply -f https://github.com/knative/eventing/releases/download/$EVENTING_VERSION/eventing-sugar-controller.yaml
-
- # Wait for installation completed
- echo "Waiting for all pods to be ready in kourier-system"
- kubectl wait --for=condition=Ready pod --all -n kourier-system --timeout=60s
- echo "Waiting for all pods to be ready in knative-serving"
- kubectl wait --for=condition=Ready pod --all -n knative-serving --timeout=60s
- echo "Waiting for all pods to be ready in knative-eventing"
- kubectl wait --for=condition=Ready pod --all -n knative-eventing --timeout=60s
+ ./.github/actions/kamel-install-knative/install-knative.sh
diff --git a/.github/actions/kamel-install-knative/install-knative.sh b/.github/actions/kamel-install-knative/install-knative.sh
new file mode 100755
index 0000000000..8491612487
--- /dev/null
+++ b/.github/actions/kamel-install-knative/install-knative.sh
@@ -0,0 +1,132 @@
+#!/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.
+# ---------------------------------------------------------------------------
+
+####
+#
+# Install the knative setup
+#
+####
+
+set -e
+
+# Prerequisites
+sudo wget https://github.com/mikefarah/yq/releases/download/v4.9.6/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq
+
+set +e
+
+export SERVING_VERSION=knative-v1.1.0
+export EVENTING_VERSION=knative-v1.1.0
+export KOURIER_VERSION=knative-v1.1.0
+
+apply() {
+ local file="${1:-}"
+ if [ -z "${file}" ]; then
+ echo "Error: Cannot apply. No file."
+ exit 1
+ fi
+
+ kubectl apply --filename ${file}
+ if [ $? != 0 ]; then
+ sleep 5
+ echo "Re-applying ${file} ..."
+ kubectl apply --filename ${file}
+ if [ $? != 0 ]; then
+ echo "Error: Application of resource failed."
+ exit 1
+ fi
+ fi
+}
+
+SERVING_CRDS="https://github.com/knative/serving/releases/download/${SERVING_VERSION}/serving-crds.yaml"
+SERVING_CORE="https://github.com/knative/serving/releases/download/${SERVING_VERSION}/serving-core.yaml"
+KOURIER="https://github.com/knative-sandbox/net-kourier/releases/download/${KOURIER_VERSION}/kourier.yaml"
+EVENTING_CRDS="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/eventing-crds.yaml"
+EVENTING_CORE="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/eventing-core.yaml"
+IN_MEMORY_CHANNEL="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/in-memory-channel.yaml"
+CHANNEL_BROKER="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/mt-channel-broker.yaml"
+SUGAR_CONTROLLER="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/eventing-sugar-controller.yaml"
+
+# Serving
+apply "${SERVING_CRDS}"
+
+YAML=$(mktemp serving-core-XXX.yaml)
+curl -L -s ${SERVING_CORE} | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - > ${YAML}
+if [ -s ${YAML} ]; then
+ apply ${YAML}
+ echo "Waiting for pods to be ready in knative-serving (dependency for kourier)"
+ kubectl wait --for=condition=Ready pod --all -n knative-serving --timeout=60s
+else
+ echo "Error: Failed to correctly download ${SERVING_CORE}"
+ exit 1
+fi
+
+# Kourier
+apply "${KOURIER}"
+
+kubectl patch configmap/config-network \
+ --namespace knative-serving \
+ --type merge \
+ --patch '{"data":{"ingress.class":"kourier.ingress.networking.knative.dev"}}'
+if [ $? != 0 ]; then
+ echo "Error: Failed to patch configmap"
+ exit 1
+fi
+
+# Eventing
+apply "${EVENTING_CRDS}"
+
+YAML=$(mktemp eventing-XXX.yaml)
+curl -L -s ${EVENTING_CORE} | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - > ${YAML}
+if [ -s ${YAML} ]; then
+ apply ${YAML}
+else
+ echo "Error: Failed to correctly download ${SERVING_CORE}"
+ exit 1
+fi
+
+# Eventing channels
+YAML=$(mktemp in-memory-XXX.yaml)
+curl -L -s ${IN_MEMORY_CHANNEL} | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - > ${YAML}
+if [ -s ${YAML} ]; then
+ apply ${YAML}
+else
+ echo "Error: Failed to correctly download ${SERVING_CORE}"
+ exit 1
+fi
+
+# Eventing broker
+YAML=$(mktemp channel-broker-XXX.yaml)
+curl -L -s ${CHANNEL_BROKER} | head -n -1 | yq e 'del(.spec.template.spec.containers[].resources)' - > ${YAML}
+if [ -s ${YAML} ]; then
+ apply ${YAML}
+else
+ echo "Error: Failed to correctly download ${SERVING_CORE}"
+ exit 1
+fi
+
+# Eventing sugar controller for injection
+apply ${SUGAR_CONTROLLER}
+
+# Wait for installation completed
+echo "Waiting for all pods to be ready in kourier-system"
+kubectl wait --for=condition=Ready pod --all -n kourier-system --timeout=60s
+echo "Waiting for all pods to be ready in knative-serving"
+kubectl wait --for=condition=Ready pod --all -n knative-serving --timeout=60s
+echo "Waiting for all pods to be ready in knative-eventing"
+kubectl wait --for=condition=Ready pod --all -n knative-eventing --timeout=60s
From 193b835687ecf13e99f194da5283124c447c2ca4 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Fri, 14 Jan 2022 13:18:32 +0000
Subject: [PATCH 36/40] Adds action for reporting the number of tests reported
as problematic
* Useful for when running scheduled night-time test suites and ignoring
problematic tests
* Action that scans the requisite e2e directory to report those tests still
marked with the PROBLEMATIC flag.
---
.github/actions/e2e-builder/action.yml | 17 ++++
.github/actions/e2e-knative-yaks/action.yml | 6 ++
.github/actions/e2e-knative/action.yml | 17 ++++
.github/actions/e2e-kubernetes/action.yml | 6 ++
.github/actions/e2e-local/action.yml | 6 ++
.github/actions/e2e-upgrade/action.yml | 6 ++
.../kamel-report-problematic/action.yml | 35 ++++++++
.../report-problematic.sh | 84 +++++++++++++++++++
8 files changed, 177 insertions(+)
create mode 100644 .github/actions/kamel-report-problematic/action.yml
create mode 100755 .github/actions/kamel-report-problematic/report-problematic.sh
diff --git a/.github/actions/e2e-builder/action.yml b/.github/actions/e2e-builder/action.yml
index d46cc7174c..c08d04518e 100644
--- a/.github/actions/e2e-builder/action.yml
+++ b/.github/actions/e2e-builder/action.yml
@@ -63,6 +63,23 @@ runs:
with:
kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
+ - id: preflight-test
+ name: Preflight Check Test
+ uses: ./.github/actions/kamel-preflight-test
+ with:
+ build-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+ image-registry-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ image-name: ${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ image-registry-insecure: ${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
+ image-version: ${{ steps.build-kamel.outputs.build-binary-local-image-version }}
+
+ - id: report-problematic
+ name: List Tests Marked As Problematic
+ uses: ./.github/actions/kamel-report-problematic
+ with:
+ test-suite: builder
+
- id: run-it
name: Run IT
shell: bash
diff --git a/.github/actions/e2e-knative-yaks/action.yml b/.github/actions/e2e-knative-yaks/action.yml
index 541cd7c3f1..265974775d 100644
--- a/.github/actions/e2e-knative-yaks/action.yml
+++ b/.github/actions/e2e-knative-yaks/action.yml
@@ -77,6 +77,12 @@ runs:
image-registry-insecure: ${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
image-version: ${{ steps.build-kamel.outputs.build-binary-local-image-version }}
+ - id: report-problematic
+ name: List Tests Marked As Problematic
+ uses: ./.github/actions/kamel-report-problematic
+ with:
+ test-suite: yaks/common
+
- id: run-it
name: Run IT
shell: bash
diff --git a/.github/actions/e2e-knative/action.yml b/.github/actions/e2e-knative/action.yml
index 54f35f0568..4689d82dc4 100644
--- a/.github/actions/e2e-knative/action.yml
+++ b/.github/actions/e2e-knative/action.yml
@@ -63,6 +63,23 @@ runs:
with:
kube-admin-user-ctx: ${{ steps.config-cluster.outputs.cluster-kube-admin-user-ctx }}
+ - id: preflight-test
+ name: Preflight Check Test
+ uses: ./.github/actions/kamel-preflight-test
+ with:
+ build-catalog-source: ${{ steps.build-kamel.outputs.build-bundle-catalog-source-name }}
+ image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }}
+ image-registry-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }}
+ image-name: ${{ steps.build-kamel.outputs.build-binary-local-image-name }}
+ image-registry-insecure: ${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
+ image-version: ${{ steps.build-kamel.outputs.build-binary-local-image-version }}
+
+ - id: report-problematic
+ name: List Tests Marked As Problematic
+ uses: ./.github/actions/kamel-report-problematic
+ with:
+ test-suite: knative
+
- id: run-it
name: Run IT
shell: bash
diff --git a/.github/actions/e2e-kubernetes/action.yml b/.github/actions/e2e-kubernetes/action.yml
index ad5f6f57f6..4b60301fee 100644
--- a/.github/actions/e2e-kubernetes/action.yml
+++ b/.github/actions/e2e-kubernetes/action.yml
@@ -71,6 +71,12 @@ runs:
image-registry-insecure: ${{steps.config-cluster.outputs.cluster-image-registry-insecure }}
image-version: ${{ steps.build-kamel.outputs.build-binary-local-image-version }}
+ - id: report-problematic
+ name: List Tests Marked As Problematic
+ uses: ./.github/actions/kamel-report-problematic
+ with:
+ test-suite: common
+
- id: run-it
name: Run IT
shell: bash
diff --git a/.github/actions/e2e-local/action.yml b/.github/actions/e2e-local/action.yml
index 47a9d27896..a2dccccc5a 100644
--- a/.github/actions/e2e-local/action.yml
+++ b/.github/actions/e2e-local/action.yml
@@ -32,6 +32,12 @@ runs:
with:
make-rules: 'build-kamel'
+ - id: report-problematic
+ name: List Tests Marked As Problematic
+ uses: ./.github/actions/kamel-report-problematic
+ with:
+ test-suite: local
+
- id: run-it
name: Run IT
shell: bash
diff --git a/.github/actions/e2e-upgrade/action.yml b/.github/actions/e2e-upgrade/action.yml
index 7b3b2bf798..93f4495e51 100644
--- a/.github/actions/e2e-upgrade/action.yml
+++ b/.github/actions/e2e-upgrade/action.yml
@@ -81,6 +81,12 @@ runs:
# Can be empty and so catalog source will not be created
catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }}
+ - id: report-problematic
+ name: List Tests Marked As Problematic
+ uses: ./.github/actions/kamel-report-problematic
+ with:
+ test-suite: upgrade
+
- name: Run IT
shell: bash
run: |
diff --git a/.github/actions/kamel-report-problematic/action.yml b/.github/actions/kamel-report-problematic/action.yml
new file mode 100644
index 0000000000..c981858aba
--- /dev/null
+++ b/.github/actions/kamel-report-problematic/action.yml
@@ -0,0 +1,35 @@
+# ---------------------------------------------------------------------------
+# 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-report-problematic
+description: 'Reports the number of tests labelled as problematic in test suite'
+
+inputs:
+ test-suite:
+ description: "The test suite to be analysed"
+ required: true
+
+runs:
+ using: "composite"
+ steps:
+ - id: report-problematic
+ name: Report Tests Marked As Problematic
+ shell: bash
+ if: ${{ always() }}
+ run: |
+ ./.github/actions/kamel-report-problematic/report-problematic.sh \
+ -t "${{ inputs.test-suite }}"
diff --git a/.github/actions/kamel-report-problematic/report-problematic.sh b/.github/actions/kamel-report-problematic/report-problematic.sh
new file mode 100755
index 0000000000..a745c38f3b
--- /dev/null
+++ b/.github/actions/kamel-report-problematic/report-problematic.sh
@@ -0,0 +1,84 @@
+#!/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.
+# ---------------------------------------------------------------------------
+
+####
+#
+# Find all test that are labelled as problematic
+#
+####
+
+set -e
+
+while getopts ":t:" opt; do
+ case "${opt}" in
+ t)
+ TEST_SUITE=${OPTARG}
+ ;;
+ :)
+ echo "ERROR: Option -$OPTARG requires an argument"
+ exit 1
+ ;;
+ \?)
+ echo "ERROR: Invalid option -$OPTARG"
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ -z "${TEST_SUITE}" ]; then
+ echo "Error: ${0} -t "
+ exit 1
+fi
+
+TEST_DIR="./e2e/${TEST_SUITE}"
+
+if [ ! -d "${TEST_DIR}" ]; then
+ echo "No e2e directory available ... exiting"
+ exit 0
+fi
+
+PROBLEMATIC=()
+while IFS= read -r -d '' f
+do
+
+ func=""
+ while IFS= read -r line
+ do
+ if [[ "${line}" =~ ^" * " ]]; then
+ continue
+ elif [[ "${line}" =~ ^func* ]]; then
+ func=$(echo "${line}" | sed -n "s/func \([a-zA-Z0-9]\+\).*/\1/p")
+ elif [[ "${line}" =~ CAMEL_K_TEST_SKIP_PROBLEMATIC ]]; then
+ PROBLEMATIC[${#PROBLEMATIC[*]}]="${f}::${func}"
+ fi
+ done < ${f}
+
+done < <(find "${TEST_DIR}" -name "*.go" -print0)
+
+if [ ${#PROBLEMATIC[*]} -gt 0 ]; then
+ echo "=== Problematic Tests (${#PROBLEMATIC[*]}) ==="
+ for prob in "${PROBLEMATIC[@]}"
+ do
+ echo " ${prob}"
+ done
+ echo "==="
+else
+ echo "=== No Tests marked as Problematic ==="
+fi
From b04e7cc650c0f68a3779d40a8998fe4891fb8f1f Mon Sep 17 00:00:00 2001
From: Christoph Deppisch
Date: Fri, 14 Jan 2022 15:58:30 +0100
Subject: [PATCH 37/40] fix: Fix apache-kamelet-catalog E2E test
Explicitly wait for timer-source Kamelet to be ready before starting the test integration
---
e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml b/e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml
index 62e94bc56e..bbac09350b 100644
--- a/e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml
+++ b/e2e/yaks/common/apache-kamelet-catalog/yaks-config.yaml
@@ -23,4 +23,6 @@ pre:
run: |
kamel install -w -n $YAKS_NAMESPACE
+ kubectl wait kamelets.camel.apache.org/timer-source --for=condition=Ready --timeout=120s -n $YAKS_NAMESPACE
+
kamel run logger.groovy -w -n $YAKS_NAMESPACE
From 1a7944b1f0c553781132c17bb246da947a696909 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Thu, 27 Jan 2022 10:47:51 +0000
Subject: [PATCH 38/40] Make upgrade tests more reliable
* Await the integration is up and running again after rebuild
before checking its version
* Slow down the kamel installation requests as errors are
being returned concerning CRDs not being the latest version
---
e2e/upgrade/cli_upgrade_test.go | 4 ++--
e2e/upgrade/olm_upgrade_test.go | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/e2e/upgrade/cli_upgrade_test.go b/e2e/upgrade/cli_upgrade_test.go
index 65415bb3f5..f8f3eeee67 100644
--- a/e2e/upgrade/cli_upgrade_test.go
+++ b/e2e/upgrade/cli_upgrade_test.go
@@ -50,8 +50,8 @@ func TestOperatorUpgrade(t *testing.T) {
// Set KAMEL_BIN only for this test - don't override the ENV variable for all tests
Expect(os.Setenv("KAMEL_BIN", kamel)).To(Succeed())
- Expect(Kamel("install", "--olm=false", "--cluster-setup", "--force").Execute()).To(Succeed())
- Expect(Kamel("install", "--olm=false", "-n", ns).Execute()).To(Succeed())
+ // Should both install the CRDs and kamel in the given namespace
+ Expect(Kamel("install", "--olm=false", "--force", "-n", ns).Execute()).To(Succeed())
// Check the operator pod is running
Eventually(OperatorPodPhase(ns), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
diff --git a/e2e/upgrade/olm_upgrade_test.go b/e2e/upgrade/olm_upgrade_test.go
index 6f6cde3452..a2ff240212 100644
--- a/e2e/upgrade/olm_upgrade_test.go
+++ b/e2e/upgrade/olm_upgrade_test.go
@@ -168,6 +168,10 @@ func TestOLMAutomaticUpgrade(t *testing.T) {
// Rebuild the Integration
Expect(Kamel("rebuild", name, "-n", ns).Execute()).To(Succeed())
+ // Check the Integration runs correctly
+ Eventually(IntegrationPodPhase(ns, name), TestTimeoutMedium).Should(Equal(corev1.PodRunning))
+ Eventually(IntegrationConditionStatus(ns, name, v1.IntegrationConditionReady), TestTimeoutMedium).Should(Equal(corev1.ConditionTrue))
+
// Check the Integration version has been upgraded
Eventually(IntegrationVersion(ns, name)).Should(ContainSubstring(newIPVersionPrefix))
From 958ff458e05c28a117be00464af1d3e62c8ec980 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Wed, 26 Jan 2022 10:16:14 +0000
Subject: [PATCH 39/40] Only show problematic report when skip is turned on
* If skip-problematic is not set then insert a brief log
entry instead
* Adds ability to skip-problematic and other inputs to
manual executions of upstream test workflows
---
.../report-problematic.sh | 20 +++--
.github/workflows/builder.yml | 20 +++++
.github/workflows/knative.yml | 20 +++++
.github/workflows/kubernetes.yml | 23 ++++++
.../workflows/manual-exec-process-inputs.sh | 77 +++++++++++++++++++
.github/workflows/upgrade.yml | 20 +++++
6 files changed, 172 insertions(+), 8 deletions(-)
create mode 100755 .github/workflows/manual-exec-process-inputs.sh
diff --git a/.github/actions/kamel-report-problematic/report-problematic.sh b/.github/actions/kamel-report-problematic/report-problematic.sh
index a745c38f3b..53f8837996 100755
--- a/.github/actions/kamel-report-problematic/report-problematic.sh
+++ b/.github/actions/kamel-report-problematic/report-problematic.sh
@@ -72,13 +72,17 @@ do
done < <(find "${TEST_DIR}" -name "*.go" -print0)
-if [ ${#PROBLEMATIC[*]} -gt 0 ]; then
- echo "=== Problematic Tests (${#PROBLEMATIC[*]}) ==="
- for prob in "${PROBLEMATIC[@]}"
- do
- echo " ${prob}"
- done
- echo "==="
+if [ "${CAMEL_K_TEST_SKIP_PROBLEMATIC}" == "true" ]; then
+ if [ ${#PROBLEMATIC[*]} -gt 0 ]; then
+ echo "=== Problematic Tests (${#PROBLEMATIC[*]}) ==="
+ for prob in "${PROBLEMATIC[@]}"
+ do
+ echo " ${prob}"
+ done
+ echo "==="
+ else
+ echo "=== No Tests marked as Problematic ==="
+ fi
else
- echo "=== No Tests marked as Problematic ==="
+ echo "=== All tests to be executed, including those marked as problematic (${#PROBLEMATIC[*]}) ==="
fi
diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml
index de177a6ede..1c9e5f8b34 100644
--- a/.github/workflows/builder.yml
+++ b/.github/workflows/builder.yml
@@ -44,6 +44,18 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ pre-built-kamel-image:
+ description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
+ required: false
+ skip-problematic:
+ description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)'
+ required: false
+ default: false
+ test-filters:
+ description: |
+ Filter the tests in this test suite by assigning the test pattern to TEST_KNATIVE_RUN,
+ eg. TEST_KNATIVE_RUN=TestBasic will only run tests prefixed with 'TestBasic'
+ required: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -64,6 +76,14 @@ jobs:
persist-credentials: false
submodules: recursive
+ - name: Convert input parameters to env vars
+ shell: bash
+ run: |
+ ./.github/workflows/manual-exec-process-inputs.sh \
+ -i "${{ github.event.inputs.pre-built-kamel-image }}" \
+ -p "${{ github.event.inputs.skip-problematic }}" \
+ -t "${{ github.event.inputs.test-filters }}"
+
- name: Execute Builder Tests
uses: ./.github/actions/e2e-builder
with:
diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml
index 717f1bc9d8..0c3c5c5a50 100644
--- a/.github/workflows/knative.yml
+++ b/.github/workflows/knative.yml
@@ -44,6 +44,18 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ pre-built-kamel-image:
+ description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
+ required: false
+ skip-problematic:
+ description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)'
+ required: false
+ default: false
+ test-filters:
+ description: |
+ Filter the tests in this test suite by assigning the test pattern to TEST_KNATIVE_RUN,
+ eg. TEST_KNATIVE_RUN=TestBasic will only run tests prefixed with 'TestBasic'
+ required: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -60,6 +72,14 @@ jobs:
persist-credentials: false
submodules: recursive
+ - name: Convert input parameters to env vars
+ shell: bash
+ run: |
+ ./.github/workflows/manual-exec-process-inputs.sh \
+ -i "${{ github.event.inputs.pre-built-kamel-image }}" \
+ -p "${{ github.event.inputs.skip-problematic }}" \
+ -t "${{ github.event.inputs.test-filters }}"
+
- name: Execute KNative Tests
uses: ./.github/actions/e2e-knative
with:
diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml
index db6d8f4414..b309a2a372 100644
--- a/.github/workflows/kubernetes.yml
+++ b/.github/workflows/kubernetes.yml
@@ -44,6 +44,21 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ pre-built-kamel-image:
+ description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
+ required: false
+ skip-problematic:
+ description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)'
+ required: false
+ default: false
+ test-filters:
+ description: |
+ List of comma-separated key/value pairs to filter the tests in this test suite:
+ TEST_INTEGRATION_COMMON_RUN, TEST_INTEGRATION_COMMON_BUILD_RUN, TEST_INTEGRATION_COMMON_CLI_RUN
+ TEST_INTEGRATION_COMMON_CONFIG_RUN, TEST_INTEGRATION_COMMON_LANG_RUN, TEST_INTEGRATION_COMMON_TRAITS_RUN
+ TEST_SERVICE_RUN, TEST_QUARKUS_RUN, TEST_KUSTOMIZE_RUN
+ eg. TEST_KUSTOMIZE_RUN=TestBasic will only run tests prefixed with 'TestBasic'
+ required: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -61,6 +76,14 @@ jobs:
persist-credentials: false
submodules: recursive
+ - name: Convert input parameters to env vars
+ shell: bash
+ run: |
+ ./.github/workflows/manual-exec-process-inputs.sh \
+ -i "${{ github.event.inputs.pre-built-kamel-image }}" \
+ -p "${{ github.event.inputs.skip-problematic }}" \
+ -t "${{ github.event.inputs.test-filters }}"
+
- name: Execute Tests
uses: ./.github/actions/e2e-kubernetes
with:
diff --git a/.github/workflows/manual-exec-process-inputs.sh b/.github/workflows/manual-exec-process-inputs.sh
new file mode 100755
index 0000000000..186e268402
--- /dev/null
+++ b/.github/workflows/manual-exec-process-inputs.sh
@@ -0,0 +1,77 @@
+#!/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.
+# ---------------------------------------------------------------------------
+
+set -e
+
+#
+# Used to unit testing this script
+#
+if [ -z "$GITHUB_ENV" ]; then
+ GITHUB_ENV="/tmp/GITHUB_ENV"
+ rm -f "${GITHUB_ENV}"
+fi
+
+while getopts ":i:p:t:" opt; do
+ case "${opt}" in
+ i)
+ PRE_BUILT_IMAGE=${OPTARG}
+ ;;
+ p)
+ SKIP_PROBLEMATIC=${OPTARG}
+ ;;
+ t)
+ TEST_FILTERS=${OPTARG}
+ ;;
+ :)
+ echo "ERROR: Option -$OPTARG requires an argument"
+ exit 1
+ ;;
+ \?)
+ echo "ERROR: Invalid option -$OPTARG"
+ exit 1
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ -n "${PRE_BUILT_IMAGE}" ]; then
+ echo "DEBUG_USE_EXISTING_IMAGE=${PRE_BUILT_IMAGE}" >> $GITHUB_ENV
+fi
+
+#
+# Avoid problematic tests only if parameter set to true
+#
+if [ "${SKIP_PROBLEMATIC}" == "true" ]; then
+ echo "CAMEL_K_TEST_SKIP_PROBLEMATIC=true" >> $GITHUB_ENV
+fi
+
+#
+# Adds -run args to filter tests in test suites
+#
+if [ -n "${TEST_FILTERS}" ]; then
+ filters=($(echo ${TEST_FILTERS} | tr "," "\n"))
+
+ #Print the split string
+ for filter in "${filters[@]}"
+ do
+ pair=($(echo ${filter} | tr "=" " "))
+ echo "Adding run filter for ${pair[0]} tests"
+ echo "${pair[0]}=-run ${pair[1]}" >> $GITHUB_ENV
+ done
+fi
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index 5b62587d11..ce1dffaa96 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -44,6 +44,18 @@ on:
- 'NOTICE'
workflow_dispatch:
inputs:
+ pre-built-kamel-image:
+ description: 'Kamel image url for skipping building of kamel stages. Used for debugging'
+ required: false
+ skip-problematic:
+ description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)'
+ required: false
+ default: false
+ test-filters:
+ description: |
+ Filter the tests in this test suite by assigning the test pattern to TEST_UPGRADE_RUN,
+ eg. TEST_UPGRADE_RUN=TestBasic will only run tests prefixed with 'TestBasic'
+ required: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
@@ -60,6 +72,14 @@ jobs:
persist-credentials: false
submodules: recursive
+ - name: Convert input parameters to env vars
+ shell: bash
+ run: |
+ ./.github/workflows/manual-exec-process-inputs.sh \
+ -i "${{ github.event.inputs.pre-built-kamel-image }}" \
+ -p "${{ github.event.inputs.skip-problematic }}" \
+ -t "${{ github.event.inputs.test-filters }}"
+
- name: Execute Upgrade Tests
uses: ./.github/actions/e2e-upgrade
with:
From d4c3641ab5426cc8d5fc3b56cdb523cc5b9774ce Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Thu, 27 Jan 2022 10:44:32 +0000
Subject: [PATCH 40/40] Marking MasterTrait test as problematic
---
e2e/common/traits/master_test.go | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/e2e/common/traits/master_test.go b/e2e/common/traits/master_test.go
index 23696a5001..08de2e2317 100644
--- a/e2e/common/traits/master_test.go
+++ b/e2e/common/traits/master_test.go
@@ -23,6 +23,7 @@ limitations under the License.
package traits
import (
+ "os"
"testing"
"time"
@@ -34,6 +35,18 @@ import (
)
func TestMasterTrait(t *testing.T) {
+ /*
+ * TODO
+ * The test just keeps randomly failing, either on kind or OCP4 clusters.
+ * The integration times out before spinning up or tests for the Magicstring
+ * fail.
+ *
+ * Adding CAMEL_K_TEST_SKIP_PROBLEMATIC env var for the moment.
+ */
+ if os.Getenv("CAMEL_K_TEST_SKIP_PROBLEMATIC") == "true" {
+ t.Skip("WARNING: Test marked as problematic ... skipping")
+ }
+
WithNewTestNamespace(t, func(ns string) {
Expect(Kamel("install", "-n", ns).Execute()).To(Succeed())