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 d534dbd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/k8s-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,12 @@ 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 -- \
-s -m 20 \
--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 +150,17 @@ 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 -- \
-s -m 20 \
--header "Host: $DD_HOSTNAME" http://$DJANGO_IP/api/v2/api-token-auth/ \
--data-raw "username=admin&password=$ADMIN_PASS" \
-o /dev/null \
-w "%{http_code}\n")
echo $CR
if [[ $CR -ne 200 ]]; then
echo "ERROR: login is not possible; got HTTP code $CR"
Expand Down

0 comments on commit d534dbd

Please sign in to comment.