Skip to content

Merge pull request #1778 from OWASP/renovate/asciidoctor.maven.plugin… #6134

Merge pull request #1778 from OWASP/renovate/asciidoctor.maven.plugin…

Merge pull request #1778 from OWASP/renovate/asciidoctor.maven.plugin… #6134

# This is a basic workflow to help you get started with Actions
name: Test minikube script (k8s)
# Controls when the workflow will run
on:
push:
branches:
- master
pull_request:
branches: [master]
workflow_dispatch:
permissions:
contents: read
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test-minikube:
name: Test with minikube
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Start minikube
uses: medyagh/setup-minikube@master
with:
minikube-version: 1.33.1
driver: docker
kubernetes-version: v1.30.0
- name: test script
run: |
kubectl apply -f k8s/workspace-psa.yml
echo "Setting up the bitnami sealed secret controler"
kubectl apply -f https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.27.0/controller.yaml
kubectl apply -f k8s/sealed-secret-controller.yaml
kubectl apply -f k8s/main.key
kubectl delete pod -n kube-system -l name=sealed-secrets-controller
kubectl create -f k8s/sealed-challenge48.json
echo "finishing up the sealed secret controler part"
kubectl apply -f k8s/secrets-config.yml
kubectl apply -f k8s/secrets-secret.yml
kubectl apply -f k8s/challenge33.yml
kubectl apply -f k8s/secret-challenge-deployment.yml
golivecounter=0
while [[ $(kubectl get pods -l app=secret-challenge -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]];
do
echo "waiting for secret-challenge" && sleep 2
((golivecounter+=1))
if [ $((golivecounter % 10)) -eq 0 ]; then
kubectl describe deployment secret-challenge
else
echo "waiting for secret-challenge, step $golivecounter"s
fi
if [ $((golivecounter % 15)) -eq 0 ]; then
kubectl describe pod -l app=secret-challenge
else
echo "waiting for secret-challenge, step $golivecounter"
fi
done
kubectl logs -l app=secret-challenge -f >> pod.log &
kubectl expose deployment secret-challenge --type=LoadBalancer --port=8080
kubectl port-forward \
$(kubectl get pod -l app=secret-challenge -o jsonpath="{.items[0].metadata.name}") \
8080:8080 \
&
echo "Do minikube delete to stop minikube from running and cleanup to start fresh again"
echo "wait 20 seconds so we can check if vault-k8s-container works"
sleep 20
if curl http://localhost:8080/spoil/challenge-5 -s | grep -q spoiler-answer
then
echo "spoil-challenge-5 works"
else
echo "error in spoil-challenge-5"
fi
if curl http://localhost:8080/spoil/challenge-6 -s | grep -q spoiler-answer
then
echo "spoil-challenge-6 works"
else
echo "error in spoil-challenge-6"
fi
if curl http://localhost:8080/spoil/challenge-7 -s | grep -q spoiler-answer
then
echo "spoil-challenge-7 works"
else
echo "error in spoil-challenge-7"
fi
if curl http://localhost:8080/spoil/challenge-33 -s | grep -q spoiler-answer
then
echo "spoil-challenge-33 works"
else
echo "error in spoil-challenge-33"
fi
echo "logs from pod to make sure:"
cat pod.log