Skip to content

Commit

Permalink
Add function performing replacements in matching Image, Container and…
Browse files Browse the repository at this point in the history
… Kubernetes components

This relies on the Docker Distribution library
to parse image references in order to detect if
they are absolute or relative.

See [1] for more details about the proposal.

[1] devfile/api#985 (comment)

Signed-off-by: Armel Soro <[email protected]>
  • Loading branch information
rm3l committed Apr 24, 2023
1 parent 8dd8571 commit bd42db7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/devfile/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ func ParseDevfileAndValidate(args parser.ParserArgs) (d parser.DevfileObj, varWa
varWarning = variables.ValidateAndReplaceGlobalVariable(d.Data.GetDevfileWorkspaceSpec())
}

// Use image names as selectors after variable substitution,
// as users might be using variables for image names.
if args.ImageNamesAsSelector != nil && args.ImageNamesAsSelector.Registry != "" {
err = replaceImageNames(&d, args.ImageNamesAsSelector.Registry, args.ImageNamesAsSelector.Tag)
if err != nil {
return d, varWarning, err
}
}

// generic validation on devfile content
err = validate.ValidateDevfileData(d.Data)
if err != nil {
Expand Down

0 comments on commit bd42db7

Please sign in to comment.