forked from related-sciences/gce-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
163 lines (163 loc) · 6.44 KB
/
action.yml
File metadata and controls
163 lines (163 loc) · 6.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: "Ephemeral GCE GitHub self-hosted runner"
description: >-
Creates ephemeral GCE based GitHub Action self-hosted runner.
It uses startup script to bootstrap the VM.
author: Rafal Wojdyla
branding:
icon: triangle
color: purple
inputs:
token:
description: >-
GitHub auth token, needs `repo`/`public_repo` scope: https://docs.github.com/en/rest/reference/actions#self-hosted-runners.
required: true
project_id:
description: >-
ID of the Google Cloud Platform project. If provided, this will configure gcloud to use this project ID.
required: false
service_account_key:
description: >-
The service account key which will be used for authentication credentials.
This key should be created and stored as a secret. Should be JSON key.
required: false
runner_ver:
description: Version of the GitHub Runner. "latest" will resolve the latest version.
default: "latest"
required: true
machine_zone:
description: GCE zone
default: "us-east1-c"
required: true
machine_type:
description: GCE machine type; https://cloud.google.com/compute/docs/machine-types
default: "n1-standard-4"
required: true
disk_size:
description: VM disk size.
required: false
network_tier:
description: Network tier for the VM instance. https://cloud.google.com/network-tiers/docs/overview
default: PREMIUM
required: false
network:
description: Specifies the network that the VM instances are a part of.
required: false
subnet:
description: Specifies the subnet that the VM instances are a part of (must be part of network).
required: false
accelerator:
description: >
[count=COUNT],[type=TYPE]
Attaches accelerators (e.g. GPUs) to the instances.
TYPE
The specific type (e.g. nvidia-tesla-k80 for nVidia Tesla K80) of accelerator
to attach to the instances. Use 'gcloud compute accelerator-types list' to
learn about all available accelerator types.
COUNT
Number of accelerators to attach to each instance. The default value is 1.
required: false
runner_service_account:
description: Service account of the VM, defaults to default compute service account.
required: false
image_project:
description: >
The Google Cloud project against which all image and image family
references will be resolved.
required: false
image:
description: Specifies the name of the image that the disk will be initialized with.
required: false
image_family:
description: The image family for the operating system that the boot disk will be initialized with.
required: false
provisioning_model:
description: Use GCE Standard or Spot VM instance; https://cloud.google.com/compute/docs/instances/create-use-spot
default: STANDARD
required: true
ephemeral:
description: Set GitHub runner to be ephemeral; https://docs.github.com/en/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners#using-ephemeral-runners-for-autoscaling
default: false
required: true
no_external_address:
description: Disables external IP address for the worker
default: false
required: true
scopes:
description: Scopes granted to the VM, defaults to full access (cloud-platform).
default: cloud-platform
required: true
shutdown_timeout:
description: "Shutdown grace period (in seconds)."
default: 30
required: true
actions_preinstalled:
description: "Whether the GitHub actions have already been installed at `/actions-runner`."
default: false
required: true
arm:
description: "Whether the GitHub actions should use arm64 binaries."
default: false
required: false
maintenance_policy_terminate:
description: "Set Google maintenance policy to TERMINATE. This is required for GPUs as they do ot support live-migration."
boot_disk_type:
description: "Boot disk type for the GCE instance (https://cloud.google.com/sdk/gcloud/reference/compute/disk-types/list)"
required: false
vm_create_timeout:
description: "Timeout in seconds to wait for VM to be ready."
default: 90
required: false
vm_create_retries:
description: "Number of times to retry creating the VM if it fails to be ready within the timeout."
default: 2
required: false
max_run_duration:
description: "Maximum runtime duration for the VM instance in seconds. After this time, the instance will be automatically terminated."
default: 1800
required: false
instance_termination_action:
description: "Action to take when the instance is terminated. Valid values: DELETE, STOP."
default: "DELETE"
required: false
outputs:
label:
description: >-
Unique runner label. This label can be used to request a specific
runner for the workflow job.
value: ${{ steps.gce-github-runner-script.outputs.label }}
runs:
using: "composite"
steps:
- id: gce-github-runner-script
run: >
${{ github.action_path }}/action.sh
--command=start
--token=${{ inputs.token }}
--project_id=${{ inputs.project_id }}
--service_account_key='${{ inputs.service_account_key }}'
--runner_ver=${{ inputs.runner_ver }}
--machine_zone=${{ inputs.machine_zone }}
--machine_type=${{ inputs.machine_type }}
--network_tier=${{ inputs.network_tier }}
--network=${{ inputs.network }}
--subnet=${{ inputs.subnet }}
--accelerator=${{ inputs.accelerator }}
--disk_size=${{ inputs.disk_size }}
--scopes=${{ inputs.scopes }}
--shutdown_timeout=${{ inputs.shutdown_timeout }}
--runner_service_account=${{ inputs.runner_service_account }}
--image_project=${{ inputs.image_project }}
--image=${{ inputs.image }}
--image_family=${{ inputs.image_family }}
--boot_disk_type=${{ inputs.boot_disk_type }}
--provisioning_model=${{ inputs.provisioning_model }}
--ephemeral=${{ inputs.ephemeral }}
--no_external_address=${{ inputs.no_external_address }}
--actions_preinstalled=${{ inputs.actions_preinstalled }}
--maintenance_policy_terminate=${{ inputs.maintenance_policy_terminate }}
--arm=${{ inputs.arm }}
--vm_create_timeout=${{ inputs.vm_create_timeout }}
--vm_create_retries=${{ inputs.vm_create_retries }}
--max_run_duration=${{ inputs.max_run_duration }}
--instance_termination_action=${{ inputs.instance_termination_action }}
shell: bash