Skip to content
Snippets Groups Projects
Commit 85647be3 authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

Merge branch '51-recreate-job-errors' into 'master'

Resolve "Recreate job errors"

Closes #51

See merge request openappstack/single-sign-on!29
parents 9321c03c 3364f7a4
No related branches found
No related tags found
1 merge request!29Resolve "Recreate job errors"
Pipeline #4676 failed with stages
in 1 minute and 11 seconds
......@@ -52,30 +52,40 @@ spec:
args:
- >
curl http://{{ $.Release.Name }}-hydra-admin:4445/health/ready \
--silent \\
--write-out "\nCheck Hydra health: HTTP %{http_code}" \
| tail -1 | grep 200 && echo "Hydra is ready to accept requests." &&
curl http://{{ $.Release.Name }}-hydra-admin:4445/clients/$CLIENT_NAME \
--silent \
--write-out "\nRequesting oauth client $CLIENT_NAME: HTTP %{http_code}\n" \
| tail -1 \
| grep 404 &&
curl --header "Content-Type: application/json" \
--request POST \
--data "{\"client_id\": \"$CLIENT_ID\",
\"client_name\": \"$CLIENT_NAME\",
\"client_secret\": \"$CLIENT_SECRET\",
\"client_uri\": \"$CLIENT_URI\",
\"logo_uri\": \"$CLIENT_LOGO_URI\",
\"redirect_uris\": [\"$REDIRECT_URI\"],
\"scope\": \"$SCOPES\",
\"grant_types\": [$GRANT_TYPES\"\"],
\"response_types\": [$RESPONSE_TYPES\"\"],
\"token_endpoint_auth_method\": \"client_secret_post\"}" \
http://{{ $.Release.Name }}-hydra-admin:4445/clients \
--write-out "\nCheck Hydra health: HTTP %{http_code}" \
| tail -1 | grep 200; \
if [ $? -eq 0 ]; then \
echo "Hydra is ready to accept requests."; \
curl http://{{ $.Release.Name }}-hydra-admin:4445/clients/$CLIENT_NAME \
--silent \
--write-out "\nCreating oauth client $CLIENT_ID: HTTP(%{http_code})\n" \
--write-out "\nRequesting oauth client $CLIENT_NAME: HTTP %{http_code}\n" \
| tail -1 \
| grep 201 &&
echo "Successfully created $CLIENT_ID"
| grep 404; \
if [ $? -eq 0 ]; then \
echo "Client doesn't exist. (Re)creating client..."; \
curl --header "Content-Type: application/json" \
--request POST \
--data "{\"client_id\": \"$CLIENT_ID\",
\"client_name\": \"$CLIENT_NAME\",
\"client_secret\": \"$CLIENT_SECRET\",
\"client_uri\": \"$CLIENT_URI\",
\"logo_uri\": \"$CLIENT_LOGO_URI\",
\"redirect_uris\": [\"$REDIRECT_URI\"],
\"scope\": \"$SCOPES\",
\"grant_types\": [$GRANT_TYPES\"\"],
\"response_types\": [$RESPONSE_TYPES\"\"],
\"token_endpoint_auth_method\": \"client_secret_post\"}" \
http://{{ $.Release.Name }}-hydra-admin:4445/clients \
--silent \
--write-out "\nCreating oauth client $CLIENT_ID: HTTP(%{http_code})\n" \
| tail -1 \
| grep 201; \
if [ $? -eq 0 ]; then echo "Successfully created $CLIENT_ID"; exit 0; \
else echo "Client creation failed"; exit 1; \
fi; \
else echo "Client already exists"; exit 0; \
fi; \
else echo "Hydra API not available"; exit 1; \
fi;
{{- end }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment