-
Notifications
You must be signed in to change notification settings - Fork 279
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
Added support for inline buildpacks #1166
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1166 +/- ##
==========================================
- Coverage 80.96% 80.89% -0.07%
==========================================
Files 136 136
Lines 8316 8369 +53
==========================================
+ Hits 6732 6769 +37
- Misses 1158 1167 +9
- Partials 426 433 +7
Flags with carried forward coverage won't be shown. Click here to find out more. |
build.go
Outdated
if err != nil { | ||
return nil, nil, errors.Wrap(err, "Could not create temporary inline buildpack") | ||
} | ||
println(pathToInlineBuildpack) |
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.
What is this? 🤔
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.
code gnomes put that there
shell = "/bin/sh" | ||
} | ||
|
||
binBuild := fmt.Sprintf(`#!%s |
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.
#! looks like it could cause problems on windows machines. And might be useful to have an integration test with one of these inline buildpacks just to show things do work in both envs.
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.
do you mean windows as the host machine, or windows containers (or both)?
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.
I'm thinking windows containers. #!
will just comment out the first line.
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.
Should we have a different default shell for windows containers?
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.
Should we have a different default shell for windows containers?
Technically, Windows doesn't need an explicit shell chosen, nor a shebang line, instead it needs an appropriate file suffix (detect.bat
/ build.bat
) since cmd.Start()
will automatically call the all .bat
files with cmd.exe
. If the suffix is .ps1
, they would be called with powershell
(if it's present).
Unfortunately though, the #!
will be treated as invalid syntax, not as a comment (which are ::
or REM
in .bat
files)
If it's possible to detect the container/daemon OS here, I think it's fine to assume the syntax is .bat
when Windows. If it's not possible to detect, I'd also feel ok with a special case like shell = "cmd.exe"
triggering the Windows behavior (add .bat
suffixes, remove shebang).
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.
Yeah, that would work. I wrote a hybrid buildpack that does just that.
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.
I'll think about it. that would mean writing either an invalid build
or build.bat
in every case.
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.
I've updated this to create the hybrid buildpack (both build
and build.bat
)
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.
@jkutner I think that we would still need to remove the shebang in the windows case. https://github.com/buildpacks/pack/pull/1166/files#r634567908
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.
@dfreilich fixed in 81c66ff
@jromero most of the codecov warning are from error cases where I'm not checking some error from the file system (like creating a file). How should I handle that? |
@jkutner We disregard codecov/patch in most cases, as long as there are appropriate tests. |
shell = "/bin/sh" | ||
} | ||
|
||
binBuild := fmt.Sprintf(`#!%s |
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.
@jkutner I think that we would still need to remove the shebang in the windows case. https://github.com/buildpacks/pack/pull/1166/files#r634567908
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.
Looks great for me! The UA you have in the initial post is perfect :D
Can someone with access to Windows do UA for that? @micahyoung ?
I'll try to get this done. EDIT: Looks great to me! 👍🏾 |
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
…to accept URI buildpacks Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com> Co-authored-by: David Freilich <freilich.david@gmail.com>
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
947b8f4
to
7f12ca8
Compare
Summary
This is an implementation of Inline Buildpacks described in RFC-0048.
Output
Give an app with a
project.toml
containing:Before
After
Documentation