Skip to content

Commit

Permalink
Merge pull request #11755 from nalind/remote-build-eval-contextdir
Browse files Browse the repository at this point in the history
remote build: EvalSymlinks() the context directory
  • Loading branch information
openshift-merge-robot authored Sep 27, 2021
2 parents e27470b + 464fec2 commit 899d5d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/bindings/images/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
params.Add("platform", platform)
}
}
if contextDir, err := filepath.EvalSymlinks(options.ContextDirectory); err == nil {
options.ContextDirectory = contextDir
}

params.Set("pullpolicy", options.PullPolicy.String())

Expand Down
9 changes: 9 additions & 0 deletions test/system/070-build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,15 @@ EOF
run_podman build -t build_test $tmpdir
}

@test "podman build build context is a symlink to a directory" {
tmpdir=$PODMAN_TMPDIR/build-test
mkdir -p $tmpdir/target
ln -s target $tmpdir/link
echo FROM alpine > $tmpdir/link/Dockerfile
echo RUN echo hello >> $tmpdir/link/Dockerfile
run_podman build -t build_test $tmpdir/link
}

function teardown() {
# A timeout or other error in 'build' can leave behind stale images
# that podman can't even see and which will cascade into subsequent
Expand Down

0 comments on commit 899d5d7

Please sign in to comment.