implemented --with to fill inputs.params
Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
17
plan/plan.go
17
plan/plan.go
@@ -23,7 +23,7 @@ type Plan struct {
|
||||
source *compiler.Value
|
||||
}
|
||||
|
||||
func Load(ctx context.Context, args ...string) (*Plan, error) {
|
||||
func Load(ctx context.Context, withParams []string, args ...string) (*Plan, error) {
|
||||
log.Ctx(ctx).Debug().Interface("args", args).Msg("loading plan")
|
||||
|
||||
// FIXME: universe vendoring
|
||||
@@ -36,6 +36,21 @@ func Load(ctx context.Context, args ...string) (*Plan, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(withParams) > 0 {
|
||||
for i, param := range withParams {
|
||||
log.Ctx(ctx).Debug().Interface("with", param).Msg("applying parameter")
|
||||
paramV, err := compiler.Compile(fmt.Sprintf("with%v", i), param)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fillErr := v.FillPath(cue.ParsePath("inputs.params"), paramV)
|
||||
if fillErr != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p := &Plan{
|
||||
context: plancontext.New(),
|
||||
source: v,
|
||||
|
Reference in New Issue
Block a user