-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): split upgrade from install
- Loading branch information
Showing
7 changed files
with
327 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# --------------------------------------------------------------------------- | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# --------------------------------------------------------------------------- | ||
|
||
name: e2e-install-olm | ||
description: 'End-to-End tests for OLM installation and upgrade procedure' | ||
|
||
inputs: | ||
cluster-config-data: | ||
description: 'The configuration of the underlying cluster (if cluster-type is custom)' | ||
required: false | ||
cluster-kube-config-data: | ||
description: 'Base16 encoded kube config - required for custom cluster type only' | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
- id: prepare-env | ||
name: Prepare Test Environment | ||
uses: ./.github/actions/kamel-prepare-env | ||
|
||
- id: config-cluster | ||
name: Configure Cluster | ||
uses: ./.github/actions/kamel-config-cluster | ||
with: | ||
cluster-config-data: ${{ inputs.cluster-config-data }} | ||
cluster-kube-config-data: ${{ inputs.cluster-kube-config-data }} | ||
require-olm: true | ||
|
||
# | ||
# Try and ensure the cluster is in a vanilla state before | ||
# starting in on an installation | ||
# | ||
- id: pre-clean-cluster | ||
name: Pre Clean Cluster | ||
uses: ./.github/actions/kamel-cleanup | ||
if: ${{ always() }} | ||
with: | ||
catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }} | ||
catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }} | ||
image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }} | ||
global-operator-namespace: ${{ steps.config-cluster.outputs.cluster-global-operator-namespace }} | ||
|
||
- id: released-kamel-cli | ||
name: Get Released Kamel CLI | ||
shell: bash | ||
run: | | ||
export KAMEL_VERSION=$(make get-last-released-version) | ||
curl -L https://github.com/apache/camel-k/releases/download/v${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-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 in same script as it was defined | ||
# | ||
export RELEASED_KAMEL_BINARY=/tmp/kamel-${KAMEL_VERSION} | ||
mv /tmp/kamel ${RELEASED_KAMEL_BINARY} | ||
if [ $? == 0 ]; then | ||
echo "Info: Kamel version installed: $(${RELEASED_KAMEL_BINARY} version)" | ||
echo "released-kamel-binary=${RELEASED_KAMEL_BINARY}" >> $GITHUB_OUTPUT | ||
else | ||
echo "Error: Failed to install kamel binary ${KAMEL_VERSION}" | ||
exit 1 | ||
fi | ||
- id: build-kamel | ||
name: Build Kamel | ||
uses: ./.github/actions/kamel-build | ||
with: | ||
image-registry-push-host: ${{ steps.config-cluster.outputs.cluster-image-registry-push-host }} | ||
image-registry-pull-host: ${{ steps.config-cluster.outputs.cluster-image-registry-pull-host }} | ||
image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }} | ||
# Builds the bundle if an OLM is available. | ||
# Since configure-cluster requires OLM then this should be true | ||
build-bundle: ${{ steps.config-cluster.outputs.cluster-has-olm }} | ||
# Both can be empty and so catalog source will not be created | ||
catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }} | ||
catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }} | ||
|
||
- id: report-problematic | ||
name: List Tests Marked As Problematic | ||
uses: ./.github/actions/kamel-report-problematic | ||
with: | ||
test-suite: namespace/upgrade | ||
|
||
- name: Run IT | ||
shell: bash | ||
run: | | ||
# Note different parameters due to alternative installation | ||
./.github/actions/e2e-install-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 }}" \ | ||
-q "${{ env.CAMEL_K_LOG_LEVEL }}" \ | ||
-s "${{ steps.config-cluster.outputs.cluster-image-registry-insecure }}" \ | ||
-v "${{ steps.build-kamel.outputs.build-binary-local-image-version }}" \ | ||
-x "${{ env.CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE }}" | ||
- name: Cleanup | ||
uses: ./.github/actions/kamel-cleanup | ||
if: ${{ always() }} | ||
with: | ||
catalog-source-name: ${{ steps.config-cluster.outputs.cluster-catalog-source-name }} | ||
catalog-source-namespace: ${{ steps.config-cluster.outputs.cluster-catalog-source-namespace }} | ||
image-namespace: ${{ steps.config-cluster.outputs.cluster-image-namespace }} | ||
global-operator-namespace: ${{ steps.config-cluster.outputs.cluster-global-operator-namespace }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
#!/bin/bash | ||
|
||
# --------------------------------------------------------------------------- | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# --------------------------------------------------------------------------- | ||
|
||
#### | ||
# | ||
# Execute the upgrade tests | ||
# | ||
#### | ||
|
||
set -e | ||
|
||
while getopts ":b:d:l:n:q:s:v:x:" opt; do | ||
case "${opt}" in | ||
b) | ||
KAMEL_BINARY=${OPTARG} | ||
;; | ||
d) | ||
BUNDLE_INDEX_IMAGE=${OPTARG} | ||
;; | ||
l) | ||
REGISTRY_PULL_HOST=${OPTARG} | ||
;; | ||
n) | ||
IMAGE_NAME=${OPTARG} | ||
;; | ||
q) | ||
LOG_LEVEL=${OPTARG} | ||
;; | ||
s) | ||
REGISTRY_INSECURE=${OPTARG} | ||
;; | ||
v) | ||
IMAGE_VERSION=${OPTARG} | ||
;; | ||
x) | ||
SAVE_FAILED_TEST_NS=${OPTARG} | ||
;; | ||
:) | ||
echo "ERROR: Option -$OPTARG requires an argument" | ||
exit 1 | ||
;; | ||
\?) | ||
echo "ERROR: Invalid option -$OPTARG" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
if [ -z "${IMAGE_NAME}" ]; then | ||
echo "Error: local-image-name not defined" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${IMAGE_VERSION}" ]; then | ||
echo "Error: local-image-version not defined" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${KAMEL_BINARY}" ]; then | ||
echo "Error: kamel-binary not defined" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${BUNDLE_INDEX_IMAGE}" ]; then | ||
echo "Error: bundle-index-image not defined" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${REGISTRY_PULL_HOST}" ]; then | ||
echo "Error: image-registry-pull-host not defined" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${REGISTRY_INSECURE}" ]; then | ||
echo "Error: image-registry-insecure not defined" | ||
exit 1 | ||
fi | ||
|
||
# Use the last released Kamel CLI | ||
export RELEASED_KAMEL_BIN=${KAMEL_BINARY} | ||
|
||
echo "Kamel version: $(${RELEASED_KAMEL_BIN} version)" | ||
|
||
# Cluster environment | ||
export CUSTOM_IMAGE=${IMAGE_NAME} | ||
export CUSTOM_VERSION=${IMAGE_VERSION} | ||
|
||
# Configure install options | ||
export KAMEL_INSTALL_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_TEST_LOG_LEVEL="${LOG_LEVEL}" | ||
if [ "${LOG_LEVEL}" == "debug" ]; then | ||
export CAMEL_K_TEST_MAVEN_CLI_OPTIONS="-X ${CAMEL_K_TEST_MAVEN_CLI_OPTIONS}" | ||
fi | ||
export CAMEL_K_PREV_IIB=quay.io/operatorhubio/catalog:latest | ||
export CAMEL_K_NEW_IIB=${BUNDLE_INDEX_IMAGE} | ||
export CAMEL_K_PREV_UPGRADE_CHANNEL=${PREV_XY_CHANNEL} | ||
export CAMEL_K_NEW_UPGRADE_CHANNEL=${NEW_XY_CHANNEL} | ||
export KAMEL_K_TEST_RELEASE_VERSION=$(make get-last-released-version) | ||
export KAMEL_K_TEST_OPERATOR_CURRENT_IMAGE=${CUSTOM_IMAGE}:${CUSTOM_VERSION} | ||
export CAMEL_K_TEST_SAVE_FAILED_TEST_NAMESPACE=${SAVE_FAILED_TEST_NS} | ||
|
||
# Then run integration tests | ||
DO_TEST_PREBUILD=false GOTESTFMT="-json 2>&1 | gotestfmt" make test-install-upgrade |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# --------------------------------------------------------------------------- | ||
# 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. | ||
# --------------------------------------------------------------------------- | ||
|
||
- from: | ||
uri: "timer:yaml" | ||
parameters: | ||
period: "5000" | ||
steps: | ||
- set-header: | ||
name: "m" | ||
constant: "string!" | ||
- set-body: | ||
simple: "Magic${header.m}" | ||
- to: "log:info" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.