Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually install at dependency #30

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ service_account_key=
runner_ver=
machine_zone=
machine_type=
boot_disk_type=
disk_size=
runner_service_account=
image_project=
Expand All @@ -44,6 +45,7 @@ while getopts_long :h opt \
runner_ver required_argument \
machine_zone required_argument \
machine_type required_argument \
boot_disk_type optional_argument \
disk_size optional_argument \
runner_service_account optional_argument \
image_project optional_argument \
Expand Down Expand Up @@ -79,6 +81,9 @@ do
machine_type)
machine_type=$OPTLARG
;;
boot_disk_type)
boot_disk_type=${OPTLARG-$boot_disk_type}
;;
disk_size)
disk_size=${OPTLARG-$disk_size}
;;
Expand Down Expand Up @@ -151,13 +156,15 @@ function start_vm {
image_flag=$([[ -z "${image}" ]] || echo "--image=${image}")
image_family_flag=$([[ -z "${image_family}" ]] || echo "--image-family=${image_family}")
disk_size_flag=$([[ -z "${disk_size}" ]] || echo "--boot-disk-size=${disk_size}")
boot_disk_type_flag=$([[ -z "${boot_disk_type}" ]] || echo "--boot-disk-type=${boot_disk_type}")
preemptible_flag=$([[ "${preemptible}" == "true" ]] && echo "--preemptible" || echo "")
ephemeral_flag=$([[ "${ephemeral}" == "true" ]] && echo "--ephemeral" || echo "")
no_external_address_flag=$([[ "${no_external_address}" == "true" ]] && echo "--no-address" || echo "")

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

startup_script="
apt update && apt install -y at && \\
gcloud compute instances add-labels ${VM_ID} --zone=${machine_zone} --labels=gh_ready=0 && \\
RUNNER_ALLOW_RUNASROOT=1 ./config.sh --url https://github.com/${GITHUB_REPOSITORY} --token ${RUNNER_TOKEN} --labels ${VM_ID} --unattended ${ephemeral_flag} --disableupdate && \\
./svc.sh install && \\
Expand Down Expand Up @@ -186,6 +193,7 @@ function start_vm {
gcloud compute instances create ${VM_ID} \
--zone=${machine_zone} \
${disk_size_flag} \
${boot_disk_type_flag} \
--machine-type=${machine_type} \
--scopes=${scopes} \
${service_account_flag} \
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ inputs:
description: "Whether the GitHub actions have already been installed at `/actions-runner`."
default: false
required: true
boot_disk_type:
description: "Boot disk type for the GCE instance (https://cloud.google.com/sdk/gcloud/reference/compute/disk-types/list)"
outputs:
label:
description: >-
Expand All @@ -103,6 +105,7 @@ runs:
--image_project=${{ inputs.image_project }}
--image=${{ inputs.image }}
--image_family=${{ inputs.image_family }}
--boot_disk_type=${{ inputs.boot_disk_type }}
--preemptible=${{ inputs.preemptible }}
--ephemeral=${{ inputs.ephemeral }}
--no_external_address=${{ inputs.no_external_address }}
Expand Down