You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+58-1
Original file line number
Diff line number
Diff line change
@@ -79,6 +79,36 @@ To this end, this provider supports the following extra specs schema:
79
79
"hardware_reservation_id": {
80
80
"type": "string",
81
81
"description": "The hardware reservation ID to use."
82
+
},
83
+
"disable_updates": {
84
+
"type": "boolean",
85
+
"description": "Disable automatic updates on the VM."
86
+
},
87
+
"enable_boot_debug": {
88
+
"type": "boolean",
89
+
"description": "Enable boot debug on the VM."
90
+
},
91
+
"extra_packages": {
92
+
"type": "array",
93
+
"description": "Extra packages to install on the VM.",
94
+
"items": {
95
+
"type": "string"
96
+
}
97
+
},
98
+
"runner_install_template": {
99
+
"type": "string",
100
+
"description": "This option can be used to override the default runner install template. If used, the caller is responsible for the correctness of the template as well as the suitability of the template for the target OS. Use the extra_context extra spec if your template has variables in it that need to be expanded."
101
+
},
102
+
"extra_context": {
103
+
"type": "object",
104
+
"description": "Extra context that will be passed to the runner_install_template.",
105
+
"additionalProperties": {
106
+
"type": "string"
107
+
}
108
+
},
109
+
"pre_install_scripts": {
110
+
"type": "object",
111
+
"description": "A map of pre-install scripts that will be run before the runner install script. These will run as root and can be used to prep a generic image before we attempt to install the runner. The key of the map is the name of the script as it will be written to disk. The value is a byte array with the contents of the script."
82
112
}
83
113
},
84
114
"additionalProperties": false
@@ -90,10 +120,37 @@ An example extra specs json would look like this:
*NOTE*: The `extra_context` spec adds a map of key/value pairs that may be expected in the `runner_install_template`.
142
+
The `runner_install_template` allows us to completely override the script that installs and starts the runner. In the example above, I have added a copy of the current template from `garm-provider-common`, with the adition of:
143
+
144
+
```bash
145
+
{{- if .ExtraContext.GolangDownloadURL }}
146
+
curl -LO {{ .ExtraContext.GolangDownloadURL }}
147
+
rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.4.linux-amd64.tar.gz
148
+
export PATH=$PATH:/usr/local/go/bin
149
+
{{- end }}
150
+
```
151
+
152
+
*NOTE*: `runner_install_template` is a [golang template](https://pkg.go.dev/text/template), which is used to install the runner. An example on how you can extend the currently existing template with a functionthat downloads, extracts and installs Go on the runner is provided above.
Copy file name to clipboardexpand all lines: internal/spec/spec.go
+52-3
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,36 @@ const jsonSchema string = `
51
51
"hardware_reservation_id": {
52
52
"type": "string",
53
53
"description": "The hardware reservation ID to use."
54
+
},
55
+
"disable_updates": {
56
+
"type": "boolean",
57
+
"description": "Disable automatic updates on the VM."
58
+
},
59
+
"enable_boot_debug": {
60
+
"type": "boolean",
61
+
"description": "Enable boot debug on the VM."
62
+
},
63
+
"extra_packages": {
64
+
"type": "array",
65
+
"description": "Extra packages to install on the VM.",
66
+
"items": {
67
+
"type": "string"
68
+
}
69
+
},
70
+
"runner_install_template": {
71
+
"type": "string",
72
+
"description": "This option can be used to override the default runner install template. If used, the caller is responsible for the correctness of the template as well as the suitability of the template for the target OS. Use the extra_context extra spec if your template has variables in it that need to be expanded."
73
+
},
74
+
"extra_context": {
75
+
"type": "object",
76
+
"description": "Extra context that will be passed to the runner_install_template.",
77
+
"additionalProperties": {
78
+
"type": "string"
79
+
}
80
+
},
81
+
"pre_install_scripts": {
82
+
"type": "object",
83
+
"description": "A map of pre-install scripts that will be run before the runner install script. These will run as root and can be used to prep a generic image before we attempt to install the runner. The key of the map is the name of the script as it will be written to disk. The value is a byte array with the contents of the script."
0 commit comments