Skip to content

Commit 3c9be42

Browse files
fix: harden macOS runner install script
1 parent afc97bb commit 3c9be42

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

modules/runners/templates/install-runner-osx.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# shellcheck shell=bash
22

3+
set -euo pipefail
4+
35
## install the runner (macOS)
46

5-
s3_location=${S3_LOCATION_RUNNER_DISTRIBUTION}
6-
architecture=${RUNNER_ARCHITECTURE}
7+
s3_location=${S3_LOCATION_RUNNER_DISTRIBUTION:-}
8+
architecture=${RUNNER_ARCHITECTURE:-}
9+
runner_tarball_url=${RUNNER_TARBALL_URL:-}
10+
user_name=${user_name:-ec2-user}
711

8-
if [ -z "$RUNNER_TARBALL_URL" ] && [ -z "$s3_location" ]; then
12+
if [ -z "$runner_tarball_url" ] && [ -z "$s3_location" ]; then
913
echo "Neither RUNNER_TARBALL_URL or s3_location are set"
1014
exit 1
1115
fi
@@ -19,9 +23,9 @@ echo "Creating actions-runner directory for the GH Action installation"
1923
sudo mkdir -p /opt/actions-runner
2024
cd /opt/actions-runner || exit 1
2125

22-
if [[ -n "$RUNNER_TARBALL_URL" ]]; then
23-
echo "Downloading the GH Action runner from $RUNNER_TARBALL_URL to $file_name"
24-
curl -s -o "$file_name" -L "$RUNNER_TARBALL_URL"
26+
if [[ -n "$runner_tarball_url" ]]; then
27+
echo "Downloading the GH Action runner from $runner_tarball_url to $file_name"
28+
curl -s -o "$file_name" -L "$runner_tarball_url"
2529
else
2630
echo "Retrieving REGION from AWS API"
2731
token="$(curl -s -f -X PUT "http://169.254.169.254/latest/api/token" \

0 commit comments

Comments
 (0)