Skip to content

Commit

Permalink
feat: Enterprise installation workflow (#6109)
Browse files Browse the repository at this point in the history
* workflow - enterprise installation test - WIP

* enterprise installation workflow - all of the dependencies, auth, etc, testkube init demo stuck because of  option not working

* enterprise installation workflow - expect file

* enterprise installation workflow - expect file updated

* enterprise installation workflow - expect file updated

* enterprise installation workflow - expect file updated with regex to match full text, and not just single words

* enterprise installation workflow - expect file - timeout disabled

* enterprise installation workflow - expect file - comments fixed

* enterprise installation workflow - expect file - switched back to standard match

* enterprise installation workflow - expect file - return key removed from choices

* enterprise installation workflow - expect file - return key removed from choices

* enterprise installation workflow - expect file - cleanup

* enterprise installation workflow - cleanup

* enterprise installation workflow - cleanup

* enterprise installation workflow - cron trigger
  • Loading branch information
tkonieczny authored Jan 11, 2025
1 parent a5a5555 commit fb6c7d4
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/testkube/enterprise-installation-expect-file.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/expect -f

set timeout -1 ;# disable the default 10s timeout

spawn {*}$env(TESTKUBE_INIT_COMMAND)
# Confirm credentials are copied
expect "Do you want to continue?"
send "y" ;# No return key on choices in Testkube CLI!
# Don't open the dashboard
expect "Do you want to open the dashboard?"
send "n"
expect eof
67 changes: 67 additions & 0 deletions test/testkube/enterprise-installation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: enterprise-installation-test
labels:
core-tests: installation
spec:
system:
pureByDefault: true
events:
- cronjob:
cron: "20 */4 * * *" # every 4 hours
content:
files:
- path: /root/edge-cluster-sa-key.json
contentFrom:
secretKeyRef:
name: sa-key
key: json-sa-key
git:
uri: https://github.com/kubeshop/testkube
revision: enterprise-installation-workflow
paths:
- test/testkube/enterprise-installation-expect-file.exp # expect file to finalize installation (user choices required): TKC-3026
container:
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:latest # contains gcloud, gke-gcloud-auth-plugin and kubectl
workingDir: /data/repo/test/testkube
steps:
- name: Install Helm
shell: |
# Install helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm version
- name: Install Testkube CLI (and Expect)
shell: |
wget -qO - https://repo.testkube.io/key.pub | apt-key add -
echo "deb https://repo.testkube.io/linux linux main" | tee -a /etc/apt/sources.list
apt-get update && apt-get install -y testkube expect
- name: gcloud auth
run:
env:
- name: SA_NAME
valueFrom:
secretKeyRef:
name: enterprise-installation-test-sa-name
key: sa-name
shell: |
gcloud auth activate-service-account {{ env.SA_NAME }} --key-file=/root/edge-cluster-sa-key.json
gcloud container clusters get-credentials testkube-cloud-edge --region us-east1 --project testkube-328312
- name: Cleanup before installation
shell: kubectl delete namespace testkube-enterprise-installation-test --ignore-not-found
- name: Test
run:
env:
- name: LICENSE_KEY
valueFrom:
secretKeyRef:
name: testkube-enterprise-installation-test-license-key
key: key
- name: TESTKUBE_INIT_COMMAND
value: "testkube init demo --namespace testkube-enterprise-installation-test --no-confirm --license {{ env.LICENSE_KEY }} --helm-set testkube-agent.testkube-api.multinamespace.enabled=true --helm-set testkube-agent.testkube-operator.enabled=false --helm-set dex.rbac.createClusterScoped=false"
shell: |
helm version
helm list -n testkube-enterprise-installation-test
echo $TESTKUBE_INIT_COMMAND
chmod +x enterprise-installation-expect-file.exp
expect enterprise-installation-expect-file.exp

0 comments on commit fb6c7d4

Please sign in to comment.