command(bake): Specify local and remote bake files#1838
command(bake): Specify local and remote bake files#1838crazy-max merged 1 commit intodocker:masterfrom
Conversation
tonistiigi
left a comment
There was a problem hiding this comment.
The "local://" prefix is not ideal but don't have better ideas either.
Ideally, this could have an integration test under tests but let us know if you need help with that.
|
Fun tangent: was looking into this PR, only to discover that
This seems kinda similar to the
👍 yup! Our integration tests are quite new here, so any help you can give to help us build those out is very appreciated ❤️ |
tonistiigi
left a comment
There was a problem hiding this comment.
^ PTAL comment from @jedevc
|
Apologies for the late reply, I was away on holiday so will get back to this PR at the end of the week.
Could you please point me in the right direction where to do this? I should do it like the TestReadLocalFilesDefault function right?
Ok thanks - so I should use the |
We have our integration tests in https://github.com/docker/buildx/blob/master/tests/bake.go, and our bake unit tests in https://github.com/docker/buildx/blob/master/bake/bake_test.go. Ideally - we'd be able to have both, though if the logic is only defined in the
Yeah, It's fine if the code doesn't share nicely, this is for different purposes 🎉 Maybe it would be good to try and define the |
99761bf to
c84b21d
Compare
|
Also, can you squash commits, and add a sign-off (see https://github.com/docker/buildx/blob/master/.github/CONTRIBUTING.md#sign-your-work) |
9034439 to
5638919
Compare
|
Hi, apologies for the delay in getting this done. I've added an integration test as well. Let me know if you require anything else. Thanks for your time 😃 |
5638919 to
78616f2
Compare
|
@c-ameron I realized that 5638919#diff-3f9c21dce82a82fae6d5ca096e77e5ddcf0eccd7051f815b452ec26fbfeb314bR284 was incorrect, which was causing the e2e tests to fail. I pushed a commit that should fix that up, and simplifies the splitting logic, so we don't need the |
|
Cool! Thanks for your help @jedevc ! 😃 |
|
Is this ok to be approved/merged @tonistiigi ? Thanks in advance! 😃 |
78616f2 to
6d13818
Compare
|
I've rebased the commit onto master as there was a conflict in Although I'm not sure why this test is now failing https://github.com/docker/buildx/actions/runs/6408757454/job/17398732309?pr=1838 |
6d13818 to
d551dd1
Compare
@c-ameron Sorry for the delay. I have rebased to fix this ci issue. I pushed an extra commit to fix some error handling when reading local/remote files and consolidate the logic in a single func as well. Feel free to squash if that looks good to you. |
9bd369d to
589a4c9
Compare
|
No worries, thanks @crazy-max . I've squashed and added you as a co-author too. |
208b042 to
38b0bc0
Compare
This adds the ability to source additional local build definition files when sourcing Bake files via a remote url. Prefixing a file with 'cwd://' will source a bake file on the local machine, instead of the remote location. Local files will be read/have precedence before remote files. Usage: ``` docker buildx bake https://github.com/example/upstream.git --file cwd://docker-bake.override.hcl --print ``` This will source a default file from the example/upstream repository, and also source a build definition from the local machine. Also moves remote and local files reading logic to a func Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com> Signed-off-by: Cameron Adams <pnzreba@gmail.com> Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
38b0bc0 to
abfc04f
Compare
As I mentioned on Slack. This adds the ability to source additional local build definition files when sourcing Bake files via a remote url.
Prefixing a file with
cwd://will source the bake file from the local machine, instead of the remote location.Local files will be read/have precedence before remote files.
Usage:
This will source a default file from the example/upstream repository, and also source a build definition from the local machine.
I'm a Go novice so any suggestions are welcome 😄
Thanks!