From 37c8af0fb1e352cccd4f3bf2467e782c0940a857 Mon Sep 17 00:00:00 2001 From: Michael Kuhnt Date: Wed, 19 Apr 2023 11:39:55 +0200 Subject: [PATCH 1/2] formatting stuff --- params/params.go | 16 +++++++++------- util/util.go | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/params/params.go b/params/params.go index ece5b52b..74ec6c03 100644 --- a/params/params.go +++ b/params/params.go @@ -25,13 +25,15 @@ import ( uuid "github.com/satori/go.uuid" ) -type PoolType string -type AddressType string -type EventType string -type EventLevel string -type OSType string -type OSArch string -type ProviderType string +type ( + PoolType string + AddressType string + EventType string + EventLevel string + OSType string + OSArch string + ProviderType string +) const ( // LXDProvider represents the LXD provider. diff --git a/util/util.go b/util/util.go index 0bf283eb..5af5b53c 100644 --- a/util/util.go +++ b/util/util.go @@ -171,7 +171,7 @@ func GetLoggingWriter(cfg *config.Config) (io.Writer, error) { Filename: cfg.Default.LogFile, MaxSize: 500, // megabytes MaxBackups: 3, - MaxAge: 28, //days + MaxAge: 28, // days Compress: true, // disabled by default } } From 535c875eb83e0379feef3130d348429189796bfe Mon Sep 17 00:00:00 2001 From: Michael Kuhnt Date: Wed, 19 Apr 2023 11:40:51 +0200 Subject: [PATCH 2/2] 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")