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

Add buildpack pull command #935

Merged
merged 7 commits into from Dec 3, 2020
Merged

Add buildpack pull command #935

merged 7 commits into from Dec 3, 2020

Conversation

jkutner
Copy link
Member

@jkutner jkutner commented Nov 5, 2020

Summary

The pull-buildpack command accepts a buildpack URI as an argument, in the form of a URL, CNB URN, docker tag, or buildpack ID and version in a registry. It then pulls the buildpackage, extracts it into a buildpack image if necessary, and stores it in the local daemon.

This command is useful for users who may need to run the build or create-builder command with --pull-policy never. They can run the pull-buildpack at an earlier time to load the buildpackage image into the local daemon.

Output

$ pack pull-buildpack heroku/spring-boot@0.2.2
sha256:d5db24e9b2d1b2662e0712089c2934556e15d8280473d9d1bac46c3ef4c9d877: Pulling from heroku-examples/buildpacks/heroku_spring-boot
Digest: sha256:d5db24e9b2d1b2662e0712089c2934556e15d8280473d9d1bac46c3ef4c9d877
Status: Image is up to date for ghcr.io/heroku-examples/buildpacks/heroku_spring-boot@sha256:d5db24e9b2d1b2662e0712089c2934556e15d8280473d9d1bac46c3ef4c9d877
Successfully pulled heroku/spring-boot@0.2.2

Documentation

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

The pull-buildpack command accepts a buildpack URI as an argument, in
the for of a URL, CNB URN, docker tag, or buildpack ID and version in a
registry. It then pulls the buildpackage, extracts it into a buildpack
image if necessary, and stores it in the local daemon.

Signed-off-by: Joe Kutner <jpkutner@gmail.com>
@jkutner jkutner requested a review from a team as a code owner November 5, 2020 01:10
pull_buildpack.go Outdated Show resolved Hide resolved
pull_buildpack.go Outdated Show resolved Hide resolved
pull_buildpack.go Outdated Show resolved Hide resolved
Copy link
Member

@jromero jromero left a comment

Choose a reason for hiding this comment

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

This is a great idea!

It looks like there are a few issues in the implementation but should be easy enough to address. Looking forward to the update.

)

type PullBuildpackOptions struct {
URI string
Copy link
Member

Choose a reason for hiding this comment

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

I was confused by this in the beginning, until I realized I didn't know enough about the formal definition of a URI (which it should definitely fit):

A URI is an identifier of a specific resource. Like a page, or book, or a document. A URL is special type of identifier that also tells you how to access it, such as HTTPs, FTP, etc.—like https://www.google.com.
https://danielmiessler.com/study/difference-between-uri-url/

internal/commands/pull_buildpack.go Outdated Show resolved Hide resolved
pull_buildpack.go Show resolved Hide resolved
…stries

Signed-off-by: Joe Kutner <jpkutner@gmail.com>
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.

Overall, looks great. Just a small comment on adding some of the information from the PR to the command, to make it a bit clearer for users.

Use: "pull-buildpack <uri>",
Args: cobra.ExactArgs(1),
Short: prependExperimental("Pull the buildpack and store it locally"),
Example: "pack pull-buildpack example/my-buildpack@1.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

nit: Could you add a Long: description clarifying why people would use it, and what valid inputs look like?

@codecov
Copy link

codecov bot commented Nov 9, 2020

Codecov Report

Merging #935 (d6e0658) into main (6474956) will decrease coverage by 0.05%.
The diff coverage is 72.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #935      +/-   ##
==========================================
- Coverage   77.68%   77.63%   -0.04%     
==========================================
  Files         103      105       +2     
  Lines        5017     5060      +43     
==========================================
+ Hits         3897     3928      +31     
- Misses        725      731       +6     
- Partials      395      401       +6     
Flag Coverage Δ
os_linux 77.63% <72.10%> (-0.04%) ⬇️
os_macos 74.61% <72.10%> (-0.06%) ⬇️
os_windows 100.00% <ø> (ø)
unit 77.63% <72.10%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@dfreilich dfreilich added the type/enhancement Issue that requests a new feature or improvement. label Nov 18, 2020
@dfreilich dfreilich added this to the 0.16.0 milestone Nov 18, 2020
@dfreilich
Copy link
Member

I'm going to rework this command as part of #962 to make it pack buildpack pull.

@dfreilich dfreilich merged commit 2a17472 into main Dec 3, 2020
@dfreilich dfreilich deleted the jkutner/pull-buildpack branch December 3, 2020 09:54
@dfreilich dfreilich changed the title Add pull-buildpack command Add buildpack pull command Dec 3, 2020
@dfreilich dfreilich mentioned this pull request Dec 4, 2020
1 task
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