Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2E development allowing injection of secrets denoting testing on custom clusters #2711

Merged
merged 40 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
a5b5f9a
Refactors e2e testing to allow for platform delegation
phantomjinx Jan 14, 2022
94fcbe1
Fixes failure in OLM upgrade e2e tests
phantomjinx Nov 17, 2021
bb15852
Moves install of opm to prepare-env action
phantomjinx Dec 13, 2021
e0c5c0d
When tests fail and project is dumped, clear up afterwards
phantomjinx Nov 5, 2021
01a1be7
Converts the upgrade workflow into a composite action
phantomjinx Nov 16, 2021
ca451ac
Converts json-to-variables to private action using submodule
phantomjinx Nov 16, 2021
6b71749
Converts kubernetes workflow to a composite action
phantomjinx Dec 13, 2021
7e0637c
Migrate if to full workflow & refactor action outputs
phantomjinx Nov 23, 2021
b48b921
Adds the creation of a catalog source to tests
phantomjinx Nov 23, 2021
58562b6
camel-k-operator service-account needs to access OLM
phantomjinx Nov 23, 2021
506101e
Adds a cleanup action for post workflow clearing up of the cluster
phantomjinx Nov 23, 2021
aa02db4
Adds ability to skip build by downloading existing binary build image
phantomjinx Nov 24, 2021
24870a1
Mask potentially sensitive values in the log
phantomjinx Nov 24, 2021
30bb37b
Converts remaining e2e tests to actions
phantomjinx Nov 24, 2021
7d1e54f
Fix for building bundle failure
phantomjinx Nov 25, 2021
8659a28
Cleanup using kamel uninstall
phantomjinx Nov 26, 2021
1cff9e2
Adds support for retaining test projects that failed
phantomjinx Nov 26, 2021
46a5b16
Fix: Renaming of operator to camel-k requires modifying default opera…
phantomjinx Nov 26, 2021
48dbb21
Extends test timeout for builder tests
phantomjinx Nov 29, 2021
ef587f3
Extends test timeout for kubernetes tests
phantomjinx Nov 30, 2021
7604913
Adds support for marking tests as problematic
phantomjinx Nov 30, 2021
8ed8b35
Fix: Retrieve IMAGE_NAME value from deployment yaml rather than constant
phantomjinx Dec 2, 2021
40e2032
Increases test timeout for building, installing ...
phantomjinx Dec 8, 2021
040459b
Remove any credential leakage in the log output
phantomjinx Dec 6, 2021
9b07e55
Marking tests as problematic
phantomjinx Dec 9, 2021
df5d6b9
Support for adding run filter to integration tests
phantomjinx Dec 9, 2021
4b5a521
Flag metric duration tests as problematic due to random failures on OCP4
phantomjinx Dec 10, 2021
fc2c5e2
Flag tekton test as problematic
phantomjinx Jan 14, 2022
d0ac54f
Ensure all kubernetes tests are executed rather than just fail-first
phantomjinx Jan 5, 2022
dfa245a
Extract action bash scripts to their own files
phantomjinx Jan 6, 2022
5855278
Create pre-flight action and adds to cleanup action
phantomjinx Jan 7, 2022
22fb0cc
Fix to avoid caching out-of-date images on clusters in e2e testing
phantomjinx Jan 7, 2022
0625625
fix: Fix YAKS Knative apache-kamelet-catalog test
christophd Jan 11, 2022
d62e880
Configure workflows to be optionally executed manually
phantomjinx Jan 11, 2022
ff88f03
Break out remaining e2e actions into their own bash scripts
phantomjinx Jan 11, 2022
193b835
Adds action for reporting the number of tests reported as problematic
phantomjinx Jan 14, 2022
b04e7cc
fix: Fix apache-kamelet-catalog E2E test
christophd Jan 14, 2022
1a7944b
Make upgrade tests more reliable
phantomjinx Jan 27, 2022
958ff45
Only show problematic report when skip is turned on
phantomjinx Jan 26, 2022
d4c3641
Marking MasterTrait test as problematic
phantomjinx Jan 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TEST_CLUSTER=kind
1 change: 1 addition & 0 deletions .github/actions/action-dotenv-to-setenv
40 changes: 40 additions & 0 deletions .github/actions/e2e-build/action.yml
Original file line number Diff line number Diff line change
@@ -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
103 changes: 103 additions & 0 deletions .github/actions/e2e-builder/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# ---------------------------------------------------------------------------
# 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
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

runs:
using: "composite"

steps:
- id: prepare-env
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env

- id: config-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
cluster-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: ${{ 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 }}

- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
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
env:
KAMEL_INSTALL_BUILD_PUBLISH_STRATEGY: ${{ inputs.publisher }}
run: |
./.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 }}
115 changes: 115 additions & 0 deletions .github/actions/e2e-builder/exec-tests.sh
Original file line number Diff line number Diff line change
@@ -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
104 changes: 104 additions & 0 deletions .github/actions/e2e-knative-yaks/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# ---------------------------------------------------------------------------
# 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
cluster-kube-config-data:
description: 'Base16 encoded kube config - required for custom cluster type only'
required: false

runs:
using: "composite"

steps:
- id: prepare-env
name: Prepare Test Environment
uses: ./.github/actions/kamel-prepare-env

- id: config-cluster
name: Configure Platform
uses: ./.github/actions/kamel-config-cluster
with:
cluster-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

- 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: ${{ 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 }}

- id: install-kamel-cluster-setup
name: Install Kamel Cluster Setup
uses: ./.github/actions/kamel-install-cluster-setup
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: yaks/common

- id: run-it
name: Run IT
shell: bash
run: |
./.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 }}
Loading