Merge pull request #87 from mercedes-benz/userdata-options

Add Userdata options to disable package update during boot / cloud-init
This commit is contained in:
Gabriel 2023-04-19 12:29:15 +02:00 committed by GitHub
commit fdfcc619ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 8 deletions

View file

@ -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.
@ -214,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

@ -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
}
}
@ -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")