Skip to content

Commit 9b7c465

Browse files
authored
fix: repair errors in startup shell script (#1087)
## Description The startup shell script of the Agent instance was broken due to missing tests (to be addressed in #1088 ). Fixed the script and validated it with shellchecker. - `if` needs `then` - no spaces in `=` assignments - use `$` to get the value of a variable ## Verification - module deployed in the test environment. Runners were spawn, jobs processed. - Cloudwatch logs checked for errors, none found
1 parent df39014 commit 9b7c465

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

template/gitlab-runner.tftpl

+5-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ then
4949
# fetch gitlab token from SSM
5050
gitlab_token=$(aws ssm get-parameter --name "${secure_parameter_store_gitlab_token_name}" --with-decryption --region "${secure_parameter_store_region}" | jq -r ".Parameter | .Value")
5151

52-
response = $(curl ${curl_cacert} --request POST -L "${runners_gitlab_url}/api/v4/user/runners" \
52+
response=$(curl ${curl_cacert} --request POST -L "${runners_gitlab_url}/api/v4/user/runners" \
5353
--header "private-token: $gitlab_token" \
5454
--form "tag_list=${gitlab_runner_tag_list}" \
5555
--form "description=${gitlab_runner_description}" \
@@ -60,10 +60,12 @@ then
6060
$runner_type_param \
6161
--form "access_level=${gitlab_runner_access_level}")
6262

63-
token = $(echo response | jq -r '.token')
63+
token=$(echo $response | jq -r '.token')
6464
if [[ "$token" == null ]]
65-
message = $(echo response | jq -r '.message // .error_description')
65+
then
66+
message=$(echo $response | jq -r '.message // .error_description')
6667
if [[ "$message" != null ]]
68+
then
6769
echo "ERROR: Couldn't register the Runner. GitLab API call returned $message".
6870
exit 1
6971
fi

0 commit comments

Comments
 (0)