forked from related-sciences/gce-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
138 lines (138 loc) · 5.32 KB
/
action.yml
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
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:
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
preemptible:
description: Use GCE preemptible VM instance; https://cloud.google.com/compute/docs/instances/preemptible
default: false
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
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=${{ 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 }}
--preemptible=${{ inputs.preemptible }}
--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 }}
shell: bash