-
Notifications
You must be signed in to change notification settings - Fork 264
[nodejs planner] InputFiles should take paths relative to devbox.json, and not combined with srcDir #212
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
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
aa4ff52
to
96769e4
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.
👍
Just to confirm, this works with devbox build <absolute_path>
, devbox build <relative_child_path>
, devbox build <relative_parent_path>
, and devbox build
?
I'll test these to verify, but conceptually these should work because we normalize all of these by using the absolute-path in EDIT: ugh, no this will still fail 😩 |
This has a bug: using |
…, and not combined with srcDir
e93b4ca
to
d3137eb
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.
Thanks for fixing!
For a follow up PR: What can we do to catch these automatically? (and avoid a regression) |
Good question. I was thinking about this as well. One idea is to have a We could run this |
Summary
This should fix a consequence of a change introduced in #200 to make the devbox.srcDir be an absolute path.In the BuildPlanners, we need the paths to be relative so they are inside the "docker context" and
can be used in Dockerfiles.
New Fix:
I think the problem is actually scoped to just the NodeJSPlanner. Within NodeJSPlanner, the inputFiles were being set using
filepath.Join(srcDir, <filename>)
when instead it should be just<filename>
, or more pedanticallypath/of/filename/from/devbox-json
.This is because the docker-context is the directory-of-devbox-json, and any files
COPY --link
'd should be specified with paths relative to this docker-context.I inspected
git grep InputFiles
and it seems NodeJSPlanner is the only one with this issue.I also went back in history to a commit from Monday, built the binary and found that the following would fail due to this reason:
It works now with this fix.
How was it tested?
in www.jetpack.io repo,
devbox build
anddocker run -p 3000:3000 --expose 3000 -ti devbox
and could open the website in localhost:3000cd root-of-www.jetpack.io
and diddevbox build www && docker run -p 3000:3000 --expose 3000 -ti devbox
. Works!mkdir -p root-of-www.jetpack.io/www/fake-dir && cd root-of-www.jetpack.io/www/fake-dir
and then:devbox build ../ && docker run -p 3000:3000 --expose 3000 -ti devbox
. Works! Also, works with justdevbox build
i.e. omitting../
argument (due to [config] look for the devbox.json file in parent directories as well #200)For NodeJS testdata in
testdata/nodejs
:cd testdata/nodejs
anddevbox build nodejs-18 && docker run devbox
. Works!cd testdata/nodejs/nodejs-18
anddevbox build && docker run devbox
. Works!cd testdata/nodejs/nodejs-18/fake-dir
anddevbox build && docker run devbox
. Works!in devbox repo,
did
devbox build
anddocker run devbox
with:testdata/rust/rust-stable
testdata/python/pip-example