add userdata options to allow disabling package updates during boot / cloud-init

This commit is contained in:
Michael Kuhnt 2023-04-19 11:40:51 +02:00
parent 37c8af0fb1
commit 535c875eb8
No known key found for this signature in database
GPG key ID: 088DC1E2EDC5A631
2 changed files with 13 additions and 0 deletions

View file

@ -216,6 +216,13 @@ type BootstrapInstance struct {
// PoolID is the ID of the garm pool to which this runner belongs.
PoolID string `json:"pool_id"`
// UserDataOptions are the options for the user data generation.
UserDataOptions UserDataOptions `json:"user_data_options"`
}
type UserDataOptions struct {
DisableUpdatesOnBoot bool `json:"disable_updates_on_boot"`
}
type Tag struct {

View file

@ -266,6 +266,12 @@ func GetCloudConfig(bootstrapParams params.BootstrapInstance, tools github.Runne
switch bootstrapParams.OSType {
case params.Linux:
cloudCfg := cloudconfig.NewDefaultCloudInitConfig()
if bootstrapParams.UserDataOptions.DisableUpdatesOnBoot {
cloudCfg.PackageUpgrade = false
cloudCfg.Packages = []string{}
}
cloudCfg.AddSSHKey(bootstrapParams.SSHKeys...)
cloudCfg.AddFile(installScript, "/install_runner.sh", "root:root", "755")
cloudCfg.AddRunCmd("/install_runner.sh")