Skip to content

Commit 4cce4cd

Browse files
committed
fix: remove progress and control codes from log output
This commit removes some not very useful output from the `/var/log/user-data.log` output that looks like this: ``` 1 file(s) remaining ^MCompleted 6.2 MiB/214.5 MiB (22.3 MiB/s) with 1 file(s) remaining ^MCompleted 6.5 MiB/214.5 MiB (23.1 MiB/s) with 1 file(s) remaining ^MCompleted 6.8 MiB/214.5 MiB (23.9 MiB/s) with 1 file(s) remaining ``` This goes on for potentially several screens worth of log output. It also similar progress bar output from the IMDS token fetching, and as a bonus side effect, prevents the token itself from being persisted to the logs. Finally, quotes are added around some of the values returned by curl to prevent bash from splitting it if there's whitespace in the return value and subsequent unintentional behaviour.
1 parent 6d3af4c commit 4cce4cd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/runners/templates/install-runner.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ mkdir -p actions-runner && cd actions-runner
2525

2626
if [[ -n "$RUNNER_TARBALL_URL" ]]; then
2727
echo "Downloading the GH Action runner from $RUNNER_TARBALL_URL to $file_name"
28-
curl -o $file_name -L "$RUNNER_TARBALL_URL"
28+
curl -s -o $file_name -L "$RUNNER_TARBALL_URL"
2929
else
3030
echo "Retrieving TOKEN from AWS API"
31-
token=$(curl -f -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 180")
31+
token="$(curl -s -f -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 180")"
3232

33-
region=$(curl -f -H "X-aws-ec2-metadata-token: $token" -v http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)
33+
region="$(curl -s -f -H "X-aws-ec2-metadata-token: $token" http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region)"
3434
echo "Retrieved REGION from AWS API ($region)"
3535

3636
echo "Downloading the GH Action runner from s3 bucket $s3_location"
37-
aws s3 cp "$s3_location" "$file_name" --region "$region"
37+
aws s3 cp "$s3_location" "$file_name" --region "$region" --no-progress
3838
fi
3939

4040
echo "Un-tar action runner"

0 commit comments

Comments
 (0)