Skip to content

Commit 222933c

Browse files
authored
Merge pull request #2 from circleci-jkzilla/jkg/142219
invalid json body
2 parents 8eaac6e + bd05789 commit 222933c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.circleci/env-script.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set +a
1010
printenv
1111

1212
response=$(curl -X POST --url 'https://circleci.com/api/v2/context' \
13-
-H 'Circle-Token: $CIRCLE_TOKEN' \
13+
-H 'Circle-Token: f7aa3b819623c1cc786dd39bb9e09742c47fea3c' \
1414
-H 'content-type: application/json' \
1515
-d '{"name":"php-context2","owner":{"id":"5d18d3c7-f8c4-4c5f-a691-b730e67047d3","type":"organization"}}' --write-out '%{http_code}' --silent --output /dev/null servername)
1616
context_id=${ response | jq -r '.id' }
@@ -20,16 +20,13 @@ env | while IFS= read -r line; do
2020
name=${line%%=*}
2121
echo "V: $value"
2222
echo "N: $name"
23-
if [[ "$response" -ne 200 ]] ; then
24-
echo "API returned $status_code"
25-
else
23+
# "message" : "Invalid JSON body." nov 27
2624
curl --request PUT \
27-
--url https://circleci.com/api/v2/context/%7Bcontext-id%7D/environment-variable/POSTGRES_USER \
28-
--header 'authorization: Basic REPLACE_BASIC_AUTH' \
29-
--header 'content-type: application/json' \
30-
--data '{"value":"some-secret-value"}'
31-
fi
32-
don
25+
--url https://circleci.com/api/v2/context/%7B$context_id%7D/environment-variable/$name \
26+
-H 'Circle-Token: f7aa3b819623c1cc786dd39bb9e09742c47fea3c' \
27+
-H 'content-type: application/json' \
28+
--data '{"value":$value}'
29+
done
3330

3431
# Create new context for PHP application environment variables
3532

0 commit comments

Comments
 (0)