plan: added auth support to engine.#Pull
Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
This commit is contained in:
parent
a9275d889f
commit
0be6a4066e
@ -19,6 +19,13 @@ func init() {
|
||||
type pullTask struct {
|
||||
}
|
||||
|
||||
type authValue struct {
|
||||
Target string
|
||||
Username string
|
||||
// FIXME: handle secrets
|
||||
Secret string
|
||||
}
|
||||
|
||||
func (c *pullTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.Solver, v *compiler.Value) (*compiler.Value, error) {
|
||||
// FIXME: handle auth
|
||||
rawRef, err := v.Lookup("source").String()
|
||||
@ -57,6 +64,17 @@ func (c *pullTask) Run(ctx context.Context, pctx *plancontext.Context, s solver.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
auth := []authValue{}
|
||||
|
||||
// Read auth data
|
||||
if err := v.Lookup("auth").Decode(&auth); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, a := range auth {
|
||||
s.AddCredentials(a.Target, a.Username, a.Secret)
|
||||
}
|
||||
|
||||
result, err := s.Solve(ctx, st, pctx.Platform.Get())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user