Skip to content

Commit

Permalink
chore: rework integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Apr 19, 2024
1 parent 27f312c commit d101810
Show file tree
Hide file tree
Showing 17 changed files with 406 additions and 104 deletions.
80 changes: 12 additions & 68 deletions .github/actions/deploy-keptn-on-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ inputs:
required: false
description: "Name of the kind cluster"
default: "test-cluster"
scheduling-gates:
required: false
description: "Use scheduling gates instead of scheduler"
default: "gates_off"
allowed-namespaces:
required: false
description: "Decides whether to allow only certain namespaces"
default: "allowed_ns_off"
values_file:
required: true
description: "Values file used for Keptn installation configuration"
cert-manager-io-enabled:
required: false
description: "Decides whether to use cert-manager.io"
Expand Down Expand Up @@ -63,50 +58,7 @@ runs:
echo "Importing image: $image"
kind load image-archive $image/$image -n ${{ inputs.cluster-name }}
done
- name: Install Keptn with helm
if: inputs.cert-manager-io-enabled == 'cert_manager_io_off'
env:
RELEASE_REGISTRY: "localhost:5000/keptn"
shell: bash
run: |
echo "Installing Keptn using helm"
helm version
helm repo add keptn "https://charts.lifecycle.keptn.sh"
helm repo update
for chart_dir in ./lifecycle-operator/chart \
./metrics-operator/chart \
./keptn-cert-manager/chart \
./chart; do
cd "$chart_dir"
echo "updating charts for" $chart_dir
helm dependency update
helm dependency build
cd - # Return to the previous directory
done
cd .github/actions/deploy-keptn-on-cluster
if [ "${{ inputs.allowed-namespaces }}" == "allowed_ns_on" ]; then
echo " allowedNamespaces: [allowed-ns-test]" >> values.yaml
fi
if [ "${{ inputs.scheduling-gates }}" == "gates_on" ]; then
echo " schedulingGatesEnabled: true" >> values.yaml
fi
export TAG=${{ inputs.runtime_tag }}
envsubst < values.yaml > tmp.yaml
echo "installing with values.yaml file:"
cat tmp.yaml
helm install -n keptn-system --create-namespace keptn ../../../chart \
--values ./tmp.yaml \
--debug --wait --timeout 1m
- name: Install cert-manager.io
if: inputs.cert-manager-io-enabled == 'cert_manager_io_on'
env:
Expand All @@ -118,8 +70,10 @@ runs:
kubectl wait --for=condition=Available deployment/cert-manager-webhook -n cert-manager --timeout=120s
kubectl wait --for=condition=ready pod -l app=webhook -n cert-manager --timeout=60s
- name: Install Keptn using cert-manager.io with helm
if: inputs.cert-manager-io-enabled == 'cert_manager_io_on'
kubectl create ns keptn-system
kubectl apply -f values/certificate.yaml
- name: Install Keptn with helm
env:
RELEASE_REGISTRY: "localhost:5000/keptn"
shell: bash
Expand All @@ -132,6 +86,7 @@ runs:
for chart_dir in ./lifecycle-operator/chart \
./metrics-operator/chart \
./keptn-cert-manager/chart \
./chart; do
cd "$chart_dir"
echo "updating charts for" $chart_dir
Expand All @@ -142,23 +97,12 @@ runs:
cd .github/actions/deploy-keptn-on-cluster
if [ "${{ inputs.allowed-namespaces }}" == "allowed_ns_on" ]; then
echo " allowedNamespaces: [allowed-ns-test]" >> values-cert-manager-io.yaml
fi
if [ "${{ inputs.scheduling-gates }}" == "gates_on" ]; then
echo " schedulingGatesEnabled: true" >> values-cert-manager-io.yaml
fi
export TAG=${{ inputs.runtime_tag }}
envsubst < values-cert-manager-io.yaml > tmp.yaml
envsubst < values/${{ inputs.values_file }} > tmp.yaml
echo "installing with values-cert-manager-io.yaml file:"
echo "installing with values.yaml file:"
cat tmp.yaml
kubectl create ns keptn-system
kubectl apply -f certificate.yaml
helm install -n keptn-system keptn ../../../chart \
helm install -n keptn-system --create-namespace keptn ../../../chart \
--values ./tmp.yaml \
--debug --wait --timeout 1m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
global:
imageRegistry: "localhost:5000"

certManager:
imagePullPolicy: Never
image:
tag: $TAG

metricsOperator:
enabled: false

lifecycleOperator:
lifecycleOperator:
imagePullPolicy: Never
image:
tag: $TAG
env:
functionRunnerImage: localhost:5000/keptn/deno-runtime:$TAG
pythonRunnerImage: localhost:5000/keptn/python-runtime:$TAG
scheduler:
imagePullPolicy: Never
image:
tag: $TAG
allowedNamespaces: [allowed-ns-test]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
global:
imageRegistry: "localhost:5000"

certManager:
imagePullPolicy: Never
image:
tag: $TAG

metricsOperator:
enabled: false

lifecycleOperator:
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
global:
imageRegistry: "localhost:5000"

certManager:
imagePullPolicy: Never
image:
tag: $TAG

metricsOperator:
imagePullPolicy: Never
image:
tag: $TAG

lifecycleOperator:
promotionTasksEnabled: true
lifecycleOperator:
imagePullPolicy: Never
image:
tag: $TAG
env:
functionRunnerImage: localhost:5000/keptn/deno-runtime:$TAG
pythonRunnerImage: localhost:5000/keptn/python-runtime:$TAG
scheduler:
imagePullPolicy: Never
image:
tag: $TAG
schedulingGatesEnabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ lifecycleOperator:
imagePullPolicy: Never
image:
tag: $TAG
schedulingGatesEnabled: false
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ certManager:
imagePullPolicy: Never
image:
tag: $TAG

metricsOperator:
imagePullPolicy: Never
image:
Expand All @@ -23,3 +24,4 @@ lifecycleOperator:
imagePullPolicy: Never
image:
tag: $TAG
schedulingGatesEnabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
global:
imageRegistry: "localhost:5000"

certManager:
imagePullPolicy: Never
image:
tag: $TAG

metricsOperator:
enabled: false

lifecycleOperator:
lifecycleOperator:
imagePullPolicy: Never
image:
tag: $TAG
env:
functionRunnerImage: localhost:5000/keptn/deno-runtime:$TAG
pythonRunnerImage: localhost:5000/keptn/python-runtime:$TAG
scheduler:
imagePullPolicy: Never
image:
tag: $TAG
schedulingGatesEnabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
global:
imageRegistry: "localhost:5000"

certManager:
imagePullPolicy: Never
image:
tag: $TAG

metricsOperator:
imagePullPolicy: Never
image:
tag: $TAG

lifecycleOperator:
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
global:
imageRegistry: "localhost:5000"
certManagerEnabled: false
caInjectionAnnotations:
cert-manager.io/inject-ca-from: keptn-system/keptn-certs

metricsOperator:
imagePullPolicy: Never
image:
tag: $TAG

lifecycleOperator:
enabled: false
45 changes: 43 additions & 2 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,56 @@ jobs:
strategy:
matrix:
scheduling-gates: [gates_on, gates_off]
allowed-namespaces: [allowed_ns_on, allowed_ns_off]
cert-manager-io-enabled: [cert_manager_io_on, cert_manager_io_off]
exclude:
- scheduling-gates: gates_on
cert-manager-io-enabled: cert_manager_io_on
with:
runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }}
scheduling-gates: ${{ matrix.scheduling-gates }}
allowed-namespaces: ${{ matrix.allowed-namespaces }}
cert-manager-io-enabled: ${{ matrix.cert-manager-io-enabled }}
uses: ./.github/workflows/integration-test.yml

integration_tests_allowed_namespaces:
name: Integration Tests Allowed Namespaces
needs:
- prepare_ci_run
- build_image
with:
runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }}
uses: ./.github/workflows/integration-test-allowed-namespaces.yml

integration_tests_lifecycle:
name: Integration Tests Lifecycle
needs:
- prepare_ci_run
- build_image
with:
runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }}
uses: ./.github/workflows/integration-test-lifecycle.yml

integration_tests_metrics:
name: Integration Tests Metrics
needs:
- prepare_ci_run
- build_image
strategy:
matrix:
cert-manager-io-enabled: [cert_manager_io_on, cert_manager_io_off]
with:
runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }}
cert-manager-io-enabled: ${{ matrix.cert-manager-io-enabled }}
uses: ./.github/workflows/integration-test-metrics.yml

integration_tests_cert_manager:
name: Integration Tests Cert Manager
needs:
- prepare_ci_run
- build_image
with:
runtime_tag: dev-${{ needs.prepare_ci_run.outputs.DATETIME }}
uses: ./.github/workflows/integration-test-cert-manager.yml

load-tests:
name: Load Tests
needs: [prepare_ci_run, build_image]
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/integration-test-allowed-namespaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Integration-Test-Allowed-Namespaces
on:
workflow_call:
inputs:
runtime_tag:
description: "Tag for the deno and python runner images"
type: "string"
required: true

# Declare default permissions as read only.
permissions: read-all

env:
GO_VERSION: "~1.21"
defaults:
run:
shell: bash

jobs:
run-integration-test-allowed-namespaces:
name: Run Chainsaw Tests
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup cluster
uses: ./.github/actions/deploy-keptn-on-cluster
with:
runtime_tag: ${{ inputs.runtime_tag }}
values_file: values-integration-allowed-namespaces.yaml

- name: Install Chainsaw
uses: kyverno/action-install-chainsaw@995cddaee7702e849270b84fa44cdcebe7462da8 # v0.1.9

- name: Run Integration Tests Allowed Namespaces
working-directory: .
run: make integration-test-allowed-namespaces

- name: Create reports
if: failure()
working-directory: ./.github/scripts
run: ./create-reports-full.sh

- name: Upload cluster logs
if: failure()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4
with:
name: logs-integration-tests-allowed-namespaces
path: .github/scripts/logs
Loading

0 comments on commit d101810

Please sign in to comment.