in tests.go [195:234]
func (c *TestSpec) processBuildArgs(lex *shell.Lex, args map[string]string, allowArg func(string) bool) error {
var errs []error
appendErr := func(err error) {
errs = append(errs, err)
}
for i, s := range c.Mounts {
if err := s.processBuildArgs(lex, args, allowArg); err != nil {
appendErr(err)
continue
}
c.Mounts[i] = s
}
for k, v := range c.Env {
updated, err := expandArgs(lex, v, args, allowArg)
if err != nil {
appendErr(errors.Wrapf(err, "%s=%s", k, v))
continue
}
c.Env[k] = updated
}
for i, step := range c.Steps {
if err := step.processBuildArgs(lex, args, allowArg); err != nil {
appendErr(errors.Wrapf(err, "step index %d", i))
continue
}
c.Steps[i] = step
}
for name, f := range c.Files {
if err := f.processBuildArgs(lex, args, allowArg); err != nil {
appendErr(fmt.Errorf("error performing shell expansion to check output of file %s: %w", name, err))
}
c.Files[name] = f
}
return errors.Wrap(goerrors.Join(errs...), c.Name)
}