Skip to content

Commit

Permalink
Support gcloud --min-cpu-platform parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegibson authored and ravwojdyla committed Nov 20, 2024
1 parent c6cf0af commit 1299daa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ actions_preinstalled=
maintenance_policy_terminate=
arm=
accelerator=
min_cpu_platform_flag=

OPTLIND=1
while getopts_long :h opt \
Expand Down Expand Up @@ -67,6 +68,7 @@ while getopts_long :h opt \
arm required_argument \
maintenance_policy_terminate optional_argument \
accelerator optional_argument \
min_cpu_platform optional_argument \
help no_argument "" "$@"
do
case "$opt" in
Expand Down Expand Up @@ -141,7 +143,10 @@ do
;;
accelerator)
accelerator=$OPTLARG
;;
;;
min_cpu_platform)
min_cpu_platform_flag=--min-cpu-platform="$OPTLARG"
;;
h|help)
usage
exit 0
Expand Down Expand Up @@ -307,6 +312,7 @@ function start_vm {
${subnet_flag} \
${accelerator} \
${maintenance_policy_flag} \
"${min_cpu_platform_flag}" \
--labels=gh_ready=0,gh_repo_owner="${gh_repo_owner}",gh_repo="${gh_repo}",gh_run_id="${gh_run_id}" \
--metadata=startup-script="$startup_script" \
&& echo "label=${VM_ID}" >> $GITHUB_OUTPUT
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ inputs:
boot_disk_type:
description: "Boot disk type for the GCE instance (https://cloud.google.com/sdk/gcloud/reference/compute/disk-types/list)"
required: false
min_cpu_platform:
description: "When specified, the VM will be scheduled on host with specified CPU architecture or a newer one."
required: false
outputs:
label:
description: >-
Expand Down Expand Up @@ -135,4 +138,5 @@ runs:
--actions_preinstalled=${{ inputs.actions_preinstalled }}
--maintenance_policy_terminate=${{ inputs.maintenance_policy_terminate }}
--arm=${{ inputs.arm }}
--min_cpu_platform="${{ inputs.min_cpu_platform }}"
shell: bash

0 comments on commit 1299daa

Please sign in to comment.