github.com/octohelm/wagon@v0.0.0-20240308040401-88662650dc0b/pkg/engine/plan/task/setting.go (about) 1 package task 2 3 import ( 4 "github.com/octohelm/wagon/pkg/engine/plan" 5 "github.com/octohelm/wagon/pkg/engine/plan/task/core" 6 "golang.org/x/net/context" 7 ) 8 9 func init() { 10 core.DefaultFactory.Register(&Setting{}) 11 } 12 13 type Setting struct { 14 core.Task 15 16 Registry map[string]RegistrySetting `json:"registry"` 17 } 18 19 type RegistrySetting struct { 20 Auth core.Auth `json:"auth"` 21 } 22 23 func (v *Setting) Setup() bool { 24 return true 25 } 26 27 func (v *Setting) Do(ctx context.Context) error { 28 as := plan.RegistryAuthStoreContext.From(ctx) 29 30 for host, r := range v.Registry { 31 as.Store(host, &plan.Auth{ 32 Username: r.Auth.Username, 33 SecretID: r.Auth.Secret.SecretID(), 34 }) 35 } 36 37 return nil 38 }