Skip to content

Commit

Permalink
Make it more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed Feb 4, 2025
1 parent 9d319e1 commit 04df7c1
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/k8s-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,15 @@ jobs:
RETRY=0
while :
do
DJANGO_IP=$(kubectl get svc defectdojo-django -o jsonpath='{.spec.clusterIP}')
OUT=$(kubectl run curl --quiet=true --image=curlimages/curl:7.73.0 \
--overrides='{ "apiVersion": "v1" }' \
--restart=Never -i --rm -- -s -m 20 -I --header "Host: $DD_HOSTNAME" http://`kubectl get service defectdojo-django -o json \
| jq -r '.spec.clusterIP'`/login?next=/)
--restart=Never -i --rm -- \
--silent \
--max-time 20 \
--head \
--header "Host: $DD_HOSTNAME" \
http://$DJANGO_IP/login?next=/)
echo $OUT
CR=`echo $OUT | egrep "^HTTP" | cut -d' ' -f2`
echo $CR
Expand All @@ -148,12 +153,19 @@ jobs:
break
fi
done
ADMIN_PASS=$(kubectl get secret/defectdojo -o json | jq -r '.data.DD_ADMIN_PASSWORD' | base64 -d)
ADMIN_PASS=$(kubectl get secret/defectdojo -o jsonpath='{.data.DD_ADMIN_PASSWORD}' | base64 -d)
echo "Simple API check"
DJANGO_IP=$(kubectl get svc defectdojo-django -o jsonpath='{.spec.clusterIP}')
CR=$(kubectl run curl --quiet=true --image=curlimages/curl:7.73.0 \
--overrides='{ "apiVersion": "v1" }' \
--restart=Never -i --rm -- -s -m 20 --header "Host: $DD_HOSTNAME" http://`kubectl get service defectdojo-django -o json \
| jq -r '.spec.clusterIP'`/api/v2/api-token-auth/ --data-raw "username=admin&password=$ADMIN_PASS" -o /dev/null -w "%{http_code}\n")
--restart=Never -i --rm -- \
--silent \
--max-time 20 \
--header "Host: $DD_HOSTNAME" \
--data-raw "username=admin&password=$ADMIN_PASS" \
--output /dev/null \
--write-out "%{http_code}\n" \
http://$DJANGO_IP/api/v2/api-token-auth/)
echo $CR
if [[ $CR -ne 200 ]]; then
echo "ERROR: login is not possible; got HTTP code $CR"
Expand Down

0 comments on commit 04df7c1

Please sign in to comment.