File tree Expand file tree Collapse file tree
ansible/roles/operator-pipeline/templates/openshift/tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,10 +28,22 @@ spec:
2828 # DO NOT use `set -x` to avoid exposing the OAuth token
2929 set -e
3030
31- curl -X POST \
31+ response=$( curl -s -w "\n%{http_code}" -X POST \
3232 -H "Authorization: Bearer $QUAY_OAUTH_TOKEN" \
3333 -H "Content-Type:application/json" \
3434 -d "{\"visibility\": \"$(params.visibility)\"}" \
35- "https://quay.io/api/v1/repository/$(params.repository)/changevisibility"
35+ "https://quay.io/api/v1/repository/$(params.repository)/changevisibility")
3636
37- echo "Repository visibility set to '$(params.visibility)'."
37+ http_code=$(echo "$response" | tail -n1)
38+ response_body=$(echo "$response" | head -n -1)
39+
40+ echo "Response body: $response_body"
41+ echo "HTTP status code: $http_code"
42+
43+ # Account for 200 and 201, since quay's docs mention 201, but in testing 200 is returned
44+ if [ "$http_code" != "200" || "$http_code" != "201"]; then
45+ echo "Error: Expected HTTP 2xx but got $http_code"
46+ exit 1
47+ fi
48+
49+ echo "Repository visibility successfully changed."
You can’t perform that action at this time.
0 commit comments