Skip to content

Commit e99089e

Browse files
feat: introduce e2e tests for helm charts (#3730)
This PR introduced the QA end to end test suite. This allows us to run more thorough tests on each PR
1 parent b8fcfec commit e99089e

File tree

37 files changed

+4271
-464
lines changed

37 files changed

+4271
-464
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: cluster-auth
2+
description: Generate GH token and log in to GKE/ROSA or decrypt kubeconfig
3+
inputs:
4+
platform: { required: true, description: gke | rosa | custom }
5+
auth-data: { required: false, description: base64-encrypted kubeconfig }
6+
7+
outputs:
8+
token:
9+
description: GitHub token
10+
value: ${{ steps.generate-github-token.outputs.token }}
11+
12+
env:
13+
GH_APP_ID: {}
14+
GH_APP_KEY: {}
15+
GKE_CLUSTER_NAME: {}
16+
GKE_CLUSTER_LOC: {}
17+
GKE_WIP: {}
18+
GKE_SA: {}
19+
ROSA_URL: {}
20+
ROSA_USER: {}
21+
ROSA_PASS: {}
22+
CLUSTER_NAME: {}
23+
24+
runs:
25+
using: "composite"
26+
steps:
27+
- name: Generate GitHub token
28+
uses: tibdex/github-app-token@v2
29+
id: generate-github-token
30+
with:
31+
app_id: ${{ env.GH_APP_ID }}
32+
private_key: ${{ env.GH_APP_KEY }}
33+
34+
- name: Authenticate to GKE
35+
if: inputs.platform == 'gke' && inputs.auth-data == ''
36+
uses: ./.github/actions/gke-login
37+
with:
38+
cluster-name: ${{ env.GKE_CLUSTER_NAME }}
39+
cluster-location: ${{ env.GKE_CLUSTER_LOC }}
40+
workload-identity-provider: ${{ env.GKE_WIP }}
41+
service-account: ${{ env.GKE_SA }}
42+
43+
- name: Authenticate to OpenShift
44+
if: inputs.platform == 'rosa' && inputs.auth-data == ''
45+
uses: redhat-actions/oc-login@v1
46+
with:
47+
openshift_server_url: ${{ env.ROSA_URL }}
48+
openshift_username: ${{ env.ROSA_USER }}
49+
openshift_password: ${{ env.ROSA_PASS }}
50+
51+
- name: Set up Teleport
52+
if: inputs.platform == 'eks'
53+
uses: teleport-actions/setup@v1
54+
with:
55+
version: 17.2.2
56+
57+
- name: Authenticate with Teleport
58+
if: inputs.platform == 'eks' && inputs.auth-data == ''
59+
uses: teleport-actions/auth-k8s@v2
60+
with:
61+
proxy: camunda.teleport.sh:443
62+
token: ${{ env.TOKEN }}
63+
kubernetes-cluster: ${{ env.CLUSTER_NAME }}
64+
65+
- name: Authenticate via var
66+
if: inputs.auth-data != ''
67+
shell: bash
68+
run: |
69+
mkdir -p "$HOME/.kube"
70+
echo "${{ inputs.auth-data }}" | base64 -d > enc.cfg
71+
openssl enc -aes-256-cbc -d -in enc.cfg -out "$HOME/.kube/config" \
72+
-pass pass:"${{ steps.generate-github-token.outputs.token }}" -pbkdf2
73+
rm enc.cfg
74+
chmod 600 "$HOME/.kube/config"

.github/actions/failed-pods-info/action.yml

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,13 @@ description: In case of failure, get Pods details like name, logs, and descripti
44
runs:
55
using: composite
66
steps:
7-
- name: Gather diagnostics for failed Pods
8-
if: failure()
7+
- name: Get failed Pods info
98
shell: bash
9+
# TODO: Better way to collect logs and store them as artifacts in GitHub Actions.
1010
run: |
11-
set -euo pipefail
12-
ARTIFACT_DIR="$RUNNER_TEMP/failed-pods"
13-
mkdir -p "$ARTIFACT_DIR"
14-
IFS=$'\n'
15-
16-
for pod in $(kubectl -n "$TEST_NAMESPACE" get pods \
17-
--field-selector=status.phase!=Succeeded \
18-
-o jsonpath='{range .items[?(@.status.containerStatuses[?(@.ready==false)])]}{.metadata.name}{"\n"}{end}'); do
19-
echo "⇢ Collecting diagnostics for $pod"
20-
pod_dir="$ARTIFACT_DIR/$pod"; mkdir -p "$pod_dir"
21-
22-
kubectl -n "$TEST_NAMESPACE" describe pod "$pod" > "$pod_dir/describe.txt"
23-
kubectl -n "$TEST_NAMESPACE" get pod "$pod" -o yaml > "$pod_dir/pod.yaml"
24-
kubectl -n "$TEST_NAMESPACE" get events \
25-
--field-selector involvedObject.name="$pod" \
26-
--sort-by=.metadata.creationTimestamp > "$pod_dir/events.txt"
27-
28-
node=$(kubectl -n "$TEST_NAMESPACE" get pod "$pod" -o jsonpath='{.spec.nodeName}')
29-
kubectl describe node "$node" > "$pod_dir/node.txt" || true
30-
31-
for c in $(kubectl -n "$TEST_NAMESPACE" get pod "$pod" -o jsonpath='{.spec.containers[*].name}'); do
32-
kubectl -n "$TEST_NAMESPACE" logs "$pod" -c "$c" --timestamps > "$pod_dir/$c.log" || true
33-
kubectl -n "$TEST_NAMESPACE" logs "$pod" -c "$c" --previous --timestamps > "$pod_dir/$c.previous.log" || true
34-
done
35-
kubectl -n "$TEST_NAMESPACE" top pod "$pod" --containers > "$pod_dir/top.txt" || true
11+
kubectl -n $TEST_NAMESPACE get po
12+
kubectl -n $TEST_NAMESPACE get po | grep -v "Completed" | awk '/0\//{print $1}' | while read pod_name; do
13+
echo -e "\n###Failed Pod: ${pod_name}###\n";
14+
kubectl -n $TEST_NAMESPACE describe po ${pod_name};
15+
kubectl -n $TEST_NAMESPACE logs ${pod_name};
3616
done
37-
- name: Upload diagnostics
38-
if: failure()
39-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
40-
with:
41-
name: failed-pods
42-
path: ${{ runner.temp }}/failed-pods

.github/actions/generate-chart-matrix/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ runs:
7272
write_matrix_entry() {
7373
local camunda_version="$1"
7474
local chart_dir="$2"
75+
echo "⭐ Generating matrix for $camunda_version and chart $chart_dir"
7576
if [ -f "$chart_dir/test/ci-test-config.yaml" ]; then
7677
readarray prScenarios < <(yq e -o=j -I=0 '.integration.case.pr.scenario.[]' $chart_dir/test/ci-test-config.yaml)
7778
for prScenario in "${prScenarios[@]}"; do
@@ -82,6 +83,7 @@ runs:
8283
echo " - version: ${camunda_version}" >> matrix_versions.txt
8384
echo " case: pr" >> matrix_versions.txt
8485
echo " scenario: $(echo "$prScenario" | yq e '.name' -)" >> matrix_versions.txt
86+
echo " shortname: $(echo "$prScenario" | yq e '.shortname' -)" >> matrix_versions.txt
8587
echo " auth: $(echo "$prScenario" | yq e '.auth' -)" >> matrix_versions.txt
8688
echo " exclude: $(echo "$prScenario" | yq e '.exclude | join("|")' -)" >> matrix_versions.txt
8789
done
@@ -92,7 +94,13 @@ runs:
9294
echo "Checking for manual-trigger"
9395
touch matrix_versions.txt
9496
echo "matrix:" > matrix_versions.txt
95-
if [[ "${{ inputs.manual-trigger }}" != "none" && "${{ inputs.manual-trigger }}" != "" ]]; then
97+
if [[ "${{ inputs.manual-trigger }}" == "all" ]]; then
98+
echo "Requested to build all"
99+
for camunda_version in ${{ steps.get-chart-versions.outputs.active }}; do
100+
chart_dir="charts/camunda-platform-${camunda_version}"
101+
write_matrix_entry "$camunda_version" "$chart_dir"
102+
done
103+
elif [[ "${{ inputs.manual-trigger }}" != "none" && "${{ inputs.manual-trigger }}" != "" ]]; then
96104
echo "Manual trigger detected: ${{ inputs.manual-trigger }}"
97105
chart_dir="charts/camunda-platform-${{ inputs.manual-trigger }}"
98106
if [ -d "$chart_dir" ]; then

.github/actions/workflow-vars/action.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
setup-flow:
55
description: The chart setup flow either "install" or "upgrade".
66
default: "install"
7+
ingress-hostname-base:
8+
description: The base of the Ingress hostname.
9+
required: true
710
platform:
811
description: The deployment cloud platform like GKE or ROSA.
912
deployment-ttl:
@@ -14,6 +17,7 @@ inputs:
1417
description: The fixed string in the identifier of the deployment it could be PR number or another specified name.
1518
chart-dir:
1619
description: A reference for the Camunda Helm chart directory which allows to test unreleased chagnes from Git repo.
20+
required: true
1721
chart-upgrade-version:
1822
description: The Helm chart released version to upgrade from.
1923
required: false
@@ -68,6 +72,12 @@ runs:
6872
echo "GITHUB_WORKFLOW_JOB_ID=$GITHUB_WORKFLOW_JOB_ID" | tee -a $GITHUB_ENV
6973
echo "GITHUB_WORKFLOW_RUN_ID=${{ github.run_id }}" | tee -a $GITHUB_ENV
7074
75+
# Identifier
76+
local_identifier=${{ inputs.identifier-base }}
77+
if [[ -z "${{ inputs.identifier-base }}" ]]; then
78+
local_identifier="no-id-use-ran-$(uuidgen | head -c 6)"
79+
fi
80+
7181
# Namespace.
7282
TRIGGER_KEY=$(is_pr && echo "pr" || echo "id")
7383
TEST_NAMESPACE="$NAMESPACE_PREFIX-$(echo ${TRIGGER_KEY}-${{ inputs.identifier-base }} | sed 's/\./-/g')"
@@ -77,10 +87,9 @@ runs:
7787
fi
7888
7989
if [[ "${{ inputs.setup-flow }}" == 'upgrade' ]]; then
80-
TEST_NAMESPACE="${TEST_NAMESPACE}-upgrade"
90+
TEST_NAMESPACE="${TEST_NAMESPACE}-upg"
8191
fi
82-
83-
echo "TEST_NAMESPACE=$(printf '%s' "${TEST_NAMESPACE%-}" | head -c 63)" | tee -a $GITHUB_ENV
92+
echo "TEST_NAMESPACE=$(printf '%s' "$TEST_NAMESPACE" | head -c 63 | sed 's/-$//')" | tee -a "$GITHUB_ENV"
8493
8594
# Get alpha chart dir.
8695
TEST_CAMUNDA_HELM_DIR_ALPHA="$(basename $(ls -d1 charts/camunda-platform-8.* | sort -V | tail -n1))"
@@ -89,14 +98,13 @@ runs:
8998
echo "Output vars:"
9099
91100
# Deployment identifier.
92-
TEST_IDENTIFIER="$(echo ${{ inputs.platform }}-${{ inputs.identifier-base }} | sed 's/\./-/g')"
101+
TEST_IDENTIFIER="$(echo ${{ inputs.platform }}-${local_identifier} | sed 's/\./-/g')"
93102
if [[ "${{ inputs.setup-flow }}" == 'upgrade' ]]; then
94103
TEST_IDENTIFIER="${TEST_IDENTIFIER}-upgrade"
95104
fi
96105
echo "identifier=${TEST_IDENTIFIER}" | tee -a $GITHUB_OUTPUT
97106
98107
# Ingress hostname.
99-
100108
if [[ "${{ inputs.platform }}" == 'eks' ]]; then
101109
export INGRESS_HOSTNAME_BASE=${NAMESPACE_PREFIX}.aws.camunda.cloud
102110
else

.github/config/test-integration-matrix.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ matrix:
2323
password: DISTRO_CI_OPENSHIFT_CLUSTER_PASSWORD
2424
if: $INPUTS_PLATFORMS_ROSA
2525
scenario:
26-
- name: Chart Setup
27-
desc: Setup chart in production-like setup with Ingress and TLS.
26+
- name: Chart Install
27+
desc: Install chart in production-like setup with Ingress and TLS.
2828
flow: install
2929
if: $INPUTS_FLOWS_INSTALL
3030
- name: Chart Upgrade

.github/workflows/test-chart-version-template.yaml

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,86 @@ on:
2020
description: Scenario
2121
required: true
2222
type: string
23+
shortname:
24+
description: Shortname for the scenario within the identifier
25+
required: true
26+
type: string
2327
auth:
24-
description: Scenario
28+
description: Auth
2529
required: true
2630
type: string
2731
exclude:
28-
description: Scenario
29-
required: true
32+
description: Exclude
33+
required: false
34+
default: ""
35+
type: string
36+
run-all-e2e-tests:
37+
description: "Run all E2E tests (playwright)"
38+
required: false
39+
default: false
40+
type: boolean
41+
platforms:
42+
description: The deployment cloud platform
43+
default: gke
44+
required: false
3045
type: string
46+
flows:
47+
description: The flows to run
48+
default: "install,upgrade"
49+
type: string
50+
required: false
51+
e2e-enabled:
52+
required: false
53+
default: true
54+
type: boolean
3155

3256
concurrency:
33-
group: ${{ github.workflow }}-${{ inputs.pr-number }}-${{ inputs.scenario }}-${{ inputs.camunda-version }}-${{ inputs.auth }}-${{ inputs.exclude }}
57+
group: ${{ github.workflow }}-${{ inputs.pr-number }}-${{ inputs.shortname }}-${{ inputs.camunda-version }}-${{ inputs.auth }}-${{ inputs.exclude }}-${{ inputs.platforms }}
3458
cancel-in-progress: true
3559

3660
permissions:
3761
contents: read
3862

3963
jobs:
64+
parse-platforms:
65+
name: Parse platforms
66+
runs-on: ubuntu-latest
67+
env:
68+
SCENARIOS_LIST: ${{ inputs.scenarios }}
69+
outputs:
70+
platforms: ${{ steps.make-json-array.outputs.platforms }}
71+
steps:
72+
- name: Convert string to JSON array and set as output
73+
id: make-json-array
74+
run: |
75+
platforms="${{ inputs.platforms }}"
76+
echo "platforms=$(jq -cn --arg p "$platforms" '$p | split(",")')" >> "$GITHUB_OUTPUT"
77+
echo "platforms=$platforms"
78+
4079
integration:
41-
name: Camunda ${{ inputs.camunda-version }} - Integration Test
80+
name: ${{ matrix.platform }} - ITs
81+
needs: [parse-platforms]
4282
permissions:
4383
contents: read
4484
id-token: write
4585
deployments: write
4686
secrets: inherit
87+
strategy:
88+
matrix:
89+
platform: ${{ fromJson(needs.parse-platforms.outputs.platforms) }}
4790
uses: ./.github/workflows/test-integration-template.yaml
4891
with:
49-
identifier: "${{ github.event.pull_request.number }}-intg-${{ inputs.camunda-version }}"
92+
identifier: "${{ github.event.pull_request.number }}-intg-${{ inputs.camunda-version }}-${{ matrix.platform }}"
5093
deployment-ttl: "${{ contains(github.event.pull_request.labels.*.name, 'test-persistent') && '1w' || '' }}"
51-
flows: "install,upgrade"
94+
flows: ${{ inputs.flows }}
5295
camunda-helm-dir: "camunda-platform-${{ inputs.camunda-version }}"
5396
camunda-helm-git-ref: "${{ github.event.pull_request.head.sha }}"
5497
caller-git-ref: "${{ github.event.pull_request.head.sha }}"
5598
test-case: ${{inputs.case}}
5699
scenario: ${{inputs.scenario}}
100+
e2e-enabled: ${{ inputs.e2e-enabled }}
101+
shortname: ${{inputs.shortname}}
57102
auth: ${{inputs.auth}}
58103
exclude: ${{inputs.exclude}}
104+
platforms: ${{ matrix.platform }}
105+
run-all-e2e-tests: ${{ inputs.run-all-e2e-tests }}

0 commit comments

Comments
 (0)