Skip to content

Commit e578a77

Browse files
andodetravwojdyla
authored andcommitted
Manually install at
Newer Ubuntu versions (e.g 22.04) don't offer `at` preinstalled, which is used by the teardown script. We need to install it manually in order not to break on Ubuntu releases.
1 parent b6803f5 commit e578a77

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

action.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ service_account_key=
2323
runner_ver=
2424
machine_zone=
2525
machine_type=
26+
boot_disk_type=
2627
disk_size=
2728
runner_service_account=
2829
image_project=
@@ -44,6 +45,7 @@ while getopts_long :h opt \
4445
runner_ver required_argument \
4546
machine_zone required_argument \
4647
machine_type required_argument \
48+
boot_disk_type optional_argument \
4749
disk_size optional_argument \
4850
runner_service_account optional_argument \
4951
image_project optional_argument \
@@ -79,6 +81,9 @@ do
7981
machine_type)
8082
machine_type=$OPTLARG
8183
;;
84+
boot_disk_type)
85+
boot_disk_type=${OPTLARG-$boot_disk_type}
86+
;;
8287
disk_size)
8388
disk_size=${OPTLARG-$disk_size}
8489
;;
@@ -151,13 +156,15 @@ function start_vm {
151156
image_flag=$([[ -z "${image}" ]] || echo "--image=${image}")
152157
image_family_flag=$([[ -z "${image_family}" ]] || echo "--image-family=${image_family}")
153158
disk_size_flag=$([[ -z "${disk_size}" ]] || echo "--boot-disk-size=${disk_size}")
159+
boot_disk_type_flag=$([[ -z "${boot_disk_type}" ]] || echo "--boot-disk-type=${boot_disk_type}")
154160
preemptible_flag=$([[ "${preemptible}" == "true" ]] && echo "--preemptible" || echo "")
155161
ephemeral_flag=$([[ "${ephemeral}" == "true" ]] && echo "--ephemeral" || echo "")
156162
no_external_address_flag=$([[ "${no_external_address}" == "true" ]] && echo "--no-address" || echo "")
157163

158164
echo "The new GCE VM will be ${VM_ID}"
159165

160166
startup_script="
167+
apt update && apt install -y at && \\
161168
gcloud compute instances add-labels ${VM_ID} --zone=${machine_zone} --labels=gh_ready=0 && \\
162169
RUNNER_ALLOW_RUNASROOT=1 ./config.sh --url https://github.com/${GITHUB_REPOSITORY} --token ${RUNNER_TOKEN} --labels ${VM_ID} --unattended ${ephemeral_flag} --disableupdate && \\
163170
./svc.sh install && \\
@@ -186,6 +193,7 @@ function start_vm {
186193
gcloud compute instances create ${VM_ID} \
187194
--zone=${machine_zone} \
188195
${disk_size_flag} \
196+
${boot_disk_type_flag} \
189197
--machine-type=${machine_type} \
190198
--scopes=${scopes} \
191199
${service_account_flag} \

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ inputs:
7777
description: "Whether the GitHub actions have already been installed at `/actions-runner`."
7878
default: false
7979
required: true
80+
boot_disk_type:
81+
description: "Boot disk type for the GCE instance (https://cloud.google.com/sdk/gcloud/reference/compute/disk-types/list)"
8082
outputs:
8183
label:
8284
description: >-
@@ -103,6 +105,7 @@ runs:
103105
--image_project=${{ inputs.image_project }}
104106
--image=${{ inputs.image }}
105107
--image_family=${{ inputs.image_family }}
108+
--boot_disk_type=${{ inputs.boot_disk_type }}
106109
--preemptible=${{ inputs.preemptible }}
107110
--ephemeral=${{ inputs.ephemeral }}
108111
--no_external_address=${{ inputs.no_external_address }}

0 commit comments

Comments
 (0)