From 528d6df87921286c94e5e442e9f91f349e41eb4a Mon Sep 17 00:00:00 2001 From: Harikrishna Date: Thu, 3 Jun 2021 17:21:09 +0530 Subject: [PATCH] chore: generate random file to store output for stencil-push script --- stencil-push.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stencil-push.sh b/stencil-push.sh index 589b04e2..8a492e2d 100755 --- a/stencil-push.sh +++ b/stencil-push.sh @@ -57,14 +57,15 @@ curl -sS -w "\n" -u $STENCIL_USERNAME:$STENCIL_PASSWORD -X PUT --fail "https://$ ACTION="Upload proto descriptor to stencil service with version number: $project_version" log_info $ACTION -http_response=$(curl -s -o /tmp/stencil_out.txt -w "%{http_code}" -u $STENCIL_USERNAME:$STENCIL_PASSWORD -X POST "https://$STENCIL_HOSTNAME/v1/descriptors" -F "file=@$file_path" -F "version=$project_version" -F "name=$proto_repo" -F "latest=true" -H "Content-Type: multipart/form-data") +response_filename="/tmp/stencil_out_$( cat /dev/urandom | base64 | tr -cd 'a-f0-9' | head -c 16 ).txt" +http_response=$(curl -s -o $response_filename -w "%{http_code}" -u $STENCIL_USERNAME:$STENCIL_PASSWORD -X POST "https://$STENCIL_HOSTNAME/v1/descriptors" -F "file=@$file_path" -F "version=$project_version" -F "name=$proto_repo" -F "latest=true" -H "Content-Type: multipart/form-data") if [ $? != 0 ]; then log_error "curl request failed" exit 1 elif [[ $http_response =~ ^[4-5][0-9][0-9]$ ]]; then log_error "status_code:" $http_response - log_error $(cat /tmp/stencil_out.txt) - rm /tmp/stencil_out.txt + log_error $(cat $response_filename) + rm $response_filename exit 1 fi trap - EXIT