New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bake: fix BAKE_CMD_CONTEXT relative path resolution #1840
bake: fix BAKE_CMD_CONTEXT relative path resolution #1840
Conversation
c7647f4
to
41c613d
Compare
5296eaa
to
cf100e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a test case for
Lines 1011 to 1013 in 7cef021
if strings.HasPrefix(rel, ".."+string(os.PathSeparator)) { | |
return errors.Errorf("path %s is outside of the working directory, please set BAKE_ALLOW_REMOTE_FS_ACCESS=1", p) | |
} |
@crazy-max sure, will work on this. |
efe200a
to
537a643
Compare
Signed-off-by: Justin Chadwell <me@jedevc.com>
- Adds a new GitServeHTTP function to start an http server to serve a target git repository. - Adds a new GitDir helper method to get the path to the .git directory - Updates the GitAdd method to take a variable number of files Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
Fixed in 12b6a3a, but now we have regression tests! So we can add a check that we don't break this behavior again. Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
537a643
to
d34103b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iiuc the util/gitutil
serves dual purposes atm and is used for reading VCS info for builds as well as test utilities. This isn't ideal and these responsibilities should be split. Not needed in this PR though.
🛠️ Fixes path resolution issue with
BAKE_CMD_CONTEXT
.In https://docs.docker.com/build/bake/remote-definition/, the following snippet no longer works:
Instead returning the following error:
This issue comes from
buildx/bake/bake.go
Lines 1007 to 1010 in 341fb65
To resolve this issue, we need to ensure that the passed path is an absolute path, instead of the relative path
.
.To prevent further regression, I add a couple of tests to build against a remote git repo (which is where most of the code in this PR comes from 😱).
cc @crazy-max @dvdksn