fix: running skaffold from a directory other than repository root #7430
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #7281
Related: #7251
Description
bazel cquery
command runs in the directory corresponding to the context and returns the tar path relative to that path.docker.Push()
function is invoked with the same working directory as the current working directory of the process.Prior to #7251, the path returned by
bazel cquery
was appended with an absolute path returned bybazel info bazel-bin
, so it ended up being an absolute path. With #7251 merged, this no longer happens, sodocker.Push()
receives a relative path returned bybazel cquery
.If
skaffold build
is executed in a directory different from the repository root,docker.Push()
will receive a relative path against the repository root and won't find the file.Take the following example. There is a
skaffold.yaml
file inprojects/acme/some-project
:If one does:
It will no longer work. It will fail with an error like:
This error may be confusing because the path does exist relative to the repository root. It does not exist relative to the current working directory though.