Skip to content

Commit

Permalink
Allow preview even if no Dockefile inline and location are not defined
Browse files Browse the repository at this point in the history
When using `dockerfile.inline` parameter, we would use "future"
reference of something that has not already been computed during the
preview stage.
In this case, `dockefile.location` and `dockerfile.infile` can be empty
but can be available during the processing stage.

Signed-off-by: Alexandre Nicolaie <alexandre.nicolaie@radiofrance.com>
  • Loading branch information
xunleii committed Jun 12, 2024
1 parent 4e8cf8f commit 96acb8d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions provider/internal/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ func (bc *BuildContext) validate(preview bool, d *Dockerfile) (*Dockerfile, *Con
return d, c, newCheckFailure(err, "context.location")
}

if d.Location == "" && d.Inline == "" {
if d.Location == "" && d.Inline == "" && !preview {
// If a Dockerfile wasn't provided and our context is on-disk, then
// set our Dockerfile to a default of <PATH>/Dockerfile.
// set our Dockerfile to a default of <PATH>/Dockerfile. However, if
// we're in preview mode, we don't want to do this because we don't
// know if the inline Dockerfile parameter contains unknowns or if
// we will use the default Dockerfile.
d.Location = filepath.Join(c.Location, "Dockerfile")
}

Expand Down

0 comments on commit 96acb8d

Please # to comment.