Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit bd6c0ee

Browse files
alexcodelfthxCode
authored andcommitted
feat: show curl error info for workflow steps
1 parent 43902b6 commit bd6c0ee

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/workflow/step/service_step.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ if [ "{{workflow.parameters.tlsVerify}}" == "true" ]; then
3535
fi
3636
3737
# check resource exist.
38-
status=$(curl -s -w "%{http_code}" -o /dev/null "$commonPath/resources/$resourceName" -X "GET" -H "Authorization: Bearer $token" $tlsVerify)
38+
status=$(curl -sS -w "%{http_code}" -o /dev/null "$commonPath/resources/$resourceName" -X "GET" -H "Authorization: Bearer $token" $tlsVerify)
3939
# if status >= 200 and status < 300
4040
if [ "$status" -ge 200 ] && [ "$status" -lt 300 ]; then
4141
jobType="upgrade"
4242
fi
4343
4444
# If jobType create resource.
4545
if [ "$jobType" == "create" ]; then
46-
response=$(curl -s "$commonPath/resources" -X "POST" -H "content-type: application/json" -H "Authorization: Bearer $token" -d '{{inputs.parameters.attributes}}' $tlsVerify)
46+
response=$(curl -sS "$commonPath/resources" -X "POST" -H "content-type: application/json" -H "Authorization: Bearer $token" -d '{{inputs.parameters.attributes}}' $tlsVerify)
4747
name=$(echo $response | jq -r '.name')
4848
4949
if [ "$name" == "null" ]; then
@@ -54,7 +54,7 @@ fi
5454
5555
# If jobType upgrade resource.
5656
if [ "$jobType" == "upgrade" ]; then
57-
status=$(curl -s -w "%{http_code}" -o /dev/null "$commonPath/resources/$resourceName/upgrade" -X "PUT" -H "content-type: application/json" -H "Authorization: Bearer $token" -d '{{inputs.parameters.attributes}}' $tlsVerify)
57+
status=$(curl -sS -w "%{http_code}" -o /dev/null "$commonPath/resources/$resourceName/upgrade" -X "PUT" -H "content-type: application/json" -H "Authorization: Bearer $token" -d '{{inputs.parameters.attributes}}' $tlsVerify)
5858
5959
# if not status >= 200 and status < 300
6060
if [ "$status" -lt 200 ] || [ "$status" -ge 300 ]; then
@@ -64,17 +64,17 @@ if [ "$jobType" == "upgrade" ]; then
6464
fi
6565
6666
# Get latest revision id
67-
revisionResponse=$(curl -s "$commonPath/resources/$resourceName/revisions?page=1&perPage=1&sort=-createTime" -X GET -H "Authorization: Bearer $token" $tlsVerify)
67+
revisionResponse=$(curl -sS "$commonPath/resources/$resourceName/revisions?page=1&perPage=1&sort=-createTime" -X GET -H "Authorization: Bearer $token" $tlsVerify)
6868
revisionID=$(echo $revisionResponse | jq -r '.items[0].id')
6969
7070
# Watch service logs until the service finished.
71-
curl -o - -s "$commonPath/resources/$resourceName/revisions/$revisionID/log?jobType=apply&watch=true" -X GET -H "Authorization: Bearer $token" $tlsVerify --compressed
71+
curl -o - -sS "$commonPath/resources/$resourceName/revisions/$revisionID/log?jobType=apply&watch=true" -X GET -H "Authorization: Bearer $token" $tlsVerify --compressed
7272
7373
# Check revision status. wait until revision status is ready.
7474
timeout=30
7575
factor=1
7676
while true; do
77-
statusResponse=$(curl -s "$commonPath/resources/$resourceName/revisions/$revisionID" -X GET -H "Authorization: Bearer $token" $tlsVerify)
77+
statusResponse=$(curl -sS "$commonPath/resources/$resourceName/revisions/$revisionID" -X GET -H "Authorization: Bearer $token" $tlsVerify)
7878
statusSummary=$(echo $statusResponse | jq -r '.status.summaryStatus')
7979
8080
if [ "$statusSummary" == "Succeeded" ]; then

0 commit comments

Comments
 (0)