Sometimes I struggle at the most stupid places.. But how can I issue a multiline curl from gitlab ci's yaml file? I tried the following:
curl --request POST \
--header 'Content-Type: application/json' \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--data "{ \
\"name\": \"$CI_PROJECT_NAME\", \
}" \
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/releases"
Which yields:
An error has occurred and reported in the system's low-level error handler.
Now I think this is more bash specific, so I tried to use single quotes:
curl --request POST \
--header 'Content-Type: application/json' \
--header 'JOB-TOKEN: $CI_JOB_TOKEN' \
--data '{
"name": "$CI_PROJECT_NAME"
}' \
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/releases"
That works (well it gives me a server response that is) but bash will now take the variables literally, so $CI_JOB_TOKEN is not replaced, also not $CI_PROJECT_NAME.
How can I get this to work?
try following