@@ -108,39 +108,39 @@ jobs:
108
108
echo "INFO: status:"
109
109
kubectl get pods
110
110
echo "INFO: logs:"
111
- kubectl logs --selector=$3 --all-containers=true
111
+ kubectl logs --selector=$3 --all-containers=true
112
112
exit 1
113
113
fi
114
114
return ${?}
115
115
}
116
116
echo "Waiting for init job..."
117
- to_complete "condition=Complete" job "defectdojo.org/component=initializer"
117
+ to_complete "condition=Complete" job "defectdojo.org/component=initializer"
118
118
echo "Waiting for celery pods..."
119
- to_complete "condition=ready" pod "defectdojo.org/component=celery"
119
+ to_complete "condition=ready" pod "defectdojo.org/component=celery"
120
120
echo "Waiting for django pod..."
121
- to_complete "condition=ready" pod "defectdojo.org/component=django"
121
+ to_complete "condition=ready" pod "defectdojo.org/component=django"
122
122
echo "Pods up and ready to rumbole"
123
123
kubectl get pods
124
124
RETRY=0
125
125
while :
126
126
do
127
127
DJANGO_IP=$(kubectl get svc defectdojo-django -o jsonpath='{.spec.clusterIP}')
128
- OUT=$(kubectl run curl --quiet=true --image=curlimages/curl:7.73.0 \
128
+ OUT=$(kubectl run curl --quiet=true --image=curlimages/curl:7.73.0 \
129
129
--overrides='{ "apiVersion": "v1" }' \
130
130
--restart=Never -i --rm -- \
131
131
--silent \
132
132
--max-time 20 \
133
133
--head \
134
134
--header "Host: $DD_HOSTNAME" \
135
- http://$DJANGO_IP/login?next=/)
135
+ " http://${ DJANGO_IP} /login?next=/" )
136
136
echo $OUT
137
- CR=` echo $OUT | egrep "^HTTP" | cut -d' ' -f2`
137
+ CR=$( echo $OUT | egrep "^HTTP" | cut -d' ' -f2)
138
138
echo $CR
139
139
if [[ $CR -ne 200 ]]; then
140
140
echo $RETRY
141
141
if [[ $RETRY -gt 2 ]]; then
142
142
kubectl get pods
143
- echo ` kubectl logs --tail=30 -l defectdojo.org/component=django -c uwsgi`
143
+ echo $( kubectl logs --tail=30 -l defectdojo.org/component=django -c uwsgi)
144
144
echo "ERROR: cannot display login screen; got HTTP code $CR"
145
145
exit 1
146
146
else
@@ -156,7 +156,7 @@ jobs:
156
156
ADMIN_PASS=$(kubectl get secret/defectdojo -o jsonpath='{.data.DD_ADMIN_PASSWORD}' | base64 -d)
157
157
echo "Simple API check"
158
158
DJANGO_IP=$(kubectl get svc defectdojo-django -o jsonpath='{.spec.clusterIP}')
159
- CR=$(kubectl run curl --quiet=true --image=curlimages/curl:7.73.0 \
159
+ CR=$(kubectl run curl --quiet=true --image=curlimages/curl:7.73.0 \
160
160
--overrides='{ "apiVersion": "v1" }' \
161
161
--restart=Never -i --rm -- \
162
162
--silent \
@@ -165,7 +165,7 @@ jobs:
165
165
--data-raw "username=admin&password=$ADMIN_PASS" \
166
166
--output /dev/null \
167
167
--write-out "%{http_code}\n" \
168
- http://$DJANGO_IP/api/v2/api-token-auth/)
168
+ " http://${ DJANGO_IP} /api/v2/api-token-auth/" )
169
169
echo $CR
170
170
if [[ $CR -ne 200 ]]; then
171
171
echo "ERROR: login is not possible; got HTTP code $CR"
@@ -174,8 +174,8 @@ jobs:
174
174
echo "Result received"
175
175
fi
176
176
echo "Final Check of components"
177
- errors=` kubectl get pods | grep Error | awk '{print $1}'`
178
- if [[ ! -z $errors ]]; then
177
+ errors=$( kubectl get pods | grep Error | awk '{print $1}')
178
+ if [[ ! -z $errors ]]; then
179
179
echo "Few pods with errors"
180
180
for line in $errors; do
181
181
echo "Dumping log from $line"
0 commit comments