Skip to content

Commit

Permalink
fix: explicit set region for downloading runner distribution from S3 (#…
Browse files Browse the repository at this point in the history
…1204)

Agents stall when running in af-south-1 unless the region is set explicitly: 
```
aws s3 cp s3://default-dist-xxxxx1245/actions-runner-linux.tar.gz .
download failed: s3://default-dist-xxxxx1245/actions-runner-linux.tar.gz to ./actions-runner-linux.tar.gz An error occurred (IllegalLocationConstraintException) when calling the GetObject operation: The af-south-1 location constraint is incompatible for the region specific endpoint this request was sent to.


[root@ip-10-165-0-77 bin]# aws s3 cp s3://default-dist-xxxxx1245/actions-runner-linux.tar.gz . --region af-south-1
download: s3://default-dist-xxxxx1245/actions-runner-linux.tar.gz to ./actions-runner-linux.tar.gz
```
  • Loading branch information
mcameron authored Sep 30, 2021
1 parent e72227b commit 439fb1b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/runners/templates/install-config-runner.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
cd /home/$USER_NAME
mkdir actions-runner && cd actions-runner

aws s3 cp ${s3_location_runner_distribution} actions-runner.tar.gz
REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)

aws s3 cp ${s3_location_runner_distribution} actions-runner.tar.gz --region $REGION
tar xzf ./actions-runner.tar.gz
rm -rf actions-runner.tar.gz

${arm_patch}

INSTANCE_ID=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)


echo wait for configuration
while [[ $(aws ssm get-parameters --names ${environment}-$INSTANCE_ID --with-decryption --region $REGION | jq -r ".Parameters | .[0] | .Value") == null ]]; do
Expand Down

0 comments on commit 439fb1b

Please sign in to comment.