Skip to content

Commit

Permalink
Error checking for runner registration
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGiga committed Feb 6, 2024
1 parent 85013f9 commit a6e8d55
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions template/gitlab-runner.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ then
# fetch gitlab token from SSM
gitlab_token=$(aws ssm get-parameter --name "${secure_parameter_store_gitlab_token_name}" --with-decryption --region "${secure_parameter_store_region}" | jq -r ".Parameter | .Value")

token=$(curl ${curl_cacert} --request POST -L "${runners_gitlab_url}/api/v4/user/runners" \
response = $(curl ${curl_cacert} --request POST -L "${runners_gitlab_url}/api/v4/user/runners" \
--header "private-token: $gitlab_token" \
--form "tag_list=${gitlab_runner_tag_list}" \
--form "description=${gitlab_runner_description}" \
Expand All @@ -58,8 +58,16 @@ then
--form "maximum_timeout=${gitlab_runner_maximum_timeout}" \
--form "runner_type=${gitlab_runner_type}_type" \
$runner_type_param \
--form "access_level=${gitlab_runner_access_level}" \
| jq -r '.token')
--form "access_level=${gitlab_runner_access_level}")

token = $(echo response | jq -r '.token')
if [[ "$token" == null ]]
message = $(echo response | jq -r '.message // .error_description')
if [[ "$message" != null ]]
echo "ERROR: API call returned $message".
exit 1
fi
fi
else
gitlab_runner_registration_token=${gitlab_runner_registration_token}

Expand Down

0 comments on commit a6e8d55

Please sign in to comment.