From 535c875eb83e0379feef3130d348429189796bfe Mon Sep 17 00:00:00 2001 From: Michael Kuhnt Date: Wed, 19 Apr 2023 11:40:51 +0200 Subject: [PATCH] add userdata options to allow disabling package updates during boot / cloud-init --- params/params.go | 7 +++++++ util/util.go | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/params/params.go b/params/params.go index 74ec6c03..0e07f3a1 100644 --- a/params/params.go +++ b/params/params.go @@ -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 { diff --git a/util/util.go b/util/util.go index 5af5b53c..35b50ee2 100644 --- a/util/util.go +++ b/util/util.go @@ -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")