Skip to content
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

Enables directory-buildpack support for WCOW/LCOW #1157

Merged

Conversation

micahyoung
Copy link
Member

@micahyoung micahyoung commented May 4, 2021

  • Re-enabled for pack build ... --buildpack <directory> and pack builder create ... with builder.toml containing buildpacks with directories.
  • Previously disabled due to needing to handle file permission however pack already sets appropriate default permissions, though further improvements can be added based on feedback.

Signed-off-by: Micah Young ymicah@vmware.com

Summary

This removes the guard disabling directory buildpacks on LCOW/WCOW. Directory-based buildpacks can now be used for builders and within apps with appropriate project.toml. Test coverage that previously only ran on Linux, now also runs on Windows (LCOW & WCOW).

Output

Before

cd samples

# builder create
pack builder create mynanoserver --config .\builders\nanoserver-1809\builder.toml

# output
ERROR: failed to add buildpacks to builder: buildpack file:///W:/samples/buildpacks/hello-universe-windows: directory-b
ased buildpacks are not currently supported on Windows

# build
pack build myapp --path .\apps\batch-script\ --builder cnbs/sample-builder:nanoserver-1809        

# output
ERROR: failed to build: checking support: buildpack file:///W:/samples/apps/batch-script/batch-script-buildpack: direct
ory-based buildpacks are not currently supported on Windows

After

The images generated are equivalent to current sample images in terms of the relevant buildpack files. The image IDs are different due to unrelated metadata causing slightly different image digests.

This example generates tarball saves of sample builders and compares the tarball entries using gnu-tar verbose output:

nanoserver sample builder on Windows host with local WCOW daemon
cd samples
.\pack-pr.exe builder create mynanoserver --config .\builders\nanoserver-1809\builder.toml
docker save mynanoserver -o nanoserver-pr.tar 
docker save cnbs/sample-builder:nanoserver-1809 -o nanoserver-cnbs.tar
alpine sample builder on Windows host with local LCOW daemon
cd samples
.\pack-pr.exe builder create myalpine --config .\builders\alpine\builder.toml
docker save myalpine -o alpine-pr.tar 
docker save cnbs/sample-builder:alpine -o alpine-cnbs.tar
compare builder image tarballs in POSIX environment (for gnu-tar) containing copied tarballs:
diff --report-identical-files   \
  <(gtar x -O -f alpine-cnbs.tar --wildcards '*/layer.tar' | gtar -t -i -v) \
  <(gtar x -O -f alpine-pr.tar   --wildcards '*/layer.tar' | gtar -t -i -v)

# output
Files /dev/fd/63 and /dev/fd/62 are identical

diff --report-identical-files   \
  <(gtar x -O -f nanoserver-cnbs.tar --wildcards '*/layer.tar' | gtar -t -i -v --pax-option "delete=*I*")  \
  <(gtar x -O -f nanoserver-pr.tar   --wildcards '*/layer.tar' | gtar -t -i -v --pax-option "delete=*I*")

# output
Files /dev/fd/63 and /dev/fd/62 are identical

Documentation

The only needed change I could find would be to remove this line:

https://github.com/buildpacks/docs/blame/71f3b301ad809341b0e84e9363a4024694b9eb65/content/docs/app-developer-guide/specific-buildpacks.md#L104

Other existing documentation and walkthroughs accurately describing the behavior.

  • Should this change be documented?
    • Yes, see #___
    • No

Related

Resolves: N/A no existing issue

- Re-enabled for `pack build ... --buildpack <directory>` and `pack builder create ...` with builder.toml containing buildpacks with directories.
- Previously disabled due to needing to handle file permission however pack already sets appropriate default permissions, though further improvements can be added based on feedback.

Signed-off-by: Micah Young ymicah@vmware.com

Signed-off-by: Micah Young <ymicah@vmware.com>
@micahyoung micahyoung requested a review from a team as a code owner May 4, 2021 14:37
@github-actions github-actions bot added this to the 0.19.0 milestone May 4, 2021
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label May 4, 2021
Copy link
Member

@dfreilich dfreilich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳🥳🥳

@dfreilich dfreilich merged commit 17f6004 into buildpacks:main May 4, 2021
@micahyoung micahyoung deleted the fix/directory-buildpacks-windows branch May 4, 2021 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants