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

Allow packages in pack build #495

Merged
merged 6 commits into from
Feb 12, 2020
Merged

Allow packages in pack build #495

merged 6 commits into from
Feb 12, 2020

Conversation

ameyer-pivotal
Copy link
Contributor

@ameyer-pivotal ameyer-pivotal commented Feb 11, 2020

Allows the use of packages in pack build via the --buildpack flag

  • There's also some cleanup/refactoring in here, but it should be mostly viewable as separate commits.

Resolves #348

@ameyer-pivotal ameyer-pivotal requested a review from a team as a code owner February 11, 2020 20:42
@ameyer-pivotal ameyer-pivotal changed the title Feature/348 packages in build Allow packages in pack build Feb 11, 2020
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 appears to be failing on Windows. :(

@ameyer-pivotal ameyer-pivotal force-pushed the feature/348-packages-in-build branch from 9911de4 to 15ee38a Compare February 12, 2020 14:56
@ameyer-pivotal ameyer-pivotal force-pushed the feature/348-packages-in-build branch from 928596d to 4e8b412 Compare February 12, 2020 19:45
ameyer-pivotal and others added 6 commits February 12, 2020 13:45
- Introduces `LocatorType` to help categorize different types of `--buildpack` string values

Signed-off-by: Andrew Meyer <ameyer@pivotal.io>
Signed-off-by: Micah Young <myoung@pivotal.io>
Signed-off-by: Andrew Meyer <ameyer@pivotal.io>
Signed-off-by: Micah Young <myoung@pivotal.io>
- Also refactored 'GetLocatorType()' to use 'BuildpackInfo'

Signed-off-by: Andrew Meyer <ameyer@pivotal.io>
Signed-off-by: Micah Young <myoung@pivotal.io>
- Interprets package from --buildpack flag

Signed-off-by: Andrew Meyer <ameyer@pivotal.io>
Signed-off-by: Javier Romero <jromero@pivotal.io>
Signed-off-by: Micah Young <myoung@pivotal.io>
Also:
- Cleaned up old 0.1 BP fixtures
- Separated --buildpack test cases to be more modular/focused
- Refactored createBuilder() helper function to work standalone
- Other formatting refactors

Signed-off-by: Andrew Meyer <ameyer@pivotal.io>
Signed-off-by: Andrew Meyer <ameyer@pivotal.io>
Signed-off-by: Natalie Arellano <narellano@pivotal.io>
@ameyer-pivotal ameyer-pivotal force-pushed the feature/348-packages-in-build branch from 4e8b412 to 41d5889 Compare February 12, 2020 19:45
@jromero jromero self-assigned this Feb 12, 2020
@jromero
Copy link
Member

jromero commented Feb 12, 2020

Do the --publish / --no-pull semantics play a part here and are taken into consideration?

Edit: Think I answered my question via a few trials. The answer is yes.

@jromero
Copy link
Member

jromero commented Feb 12, 2020

Acceptance - ✅

local buildpack in docker daemon

./out/pack build my-other-app -B cnbs/sample-builder:alpine -b cnbs/sample-package:hello-universe -p ../samples/apps/ruby-bundler/ -v
Pulling image index.docker.io/cnbs/sample-builder:alpine
alpine: Pulling from cnbs/sample-builder
Digest: sha256:cc0fe2eb24295b7f91780c96677eced421b307693686a825a1d33b9bb10107e8
Status: Image is up to date for cnbs/sample-builder:alpine
Selected run image cnbs/sample-stack-run:alpine
Pulling image cnbs/sample-stack-run:alpine
alpine: Pulling from cnbs/sample-stack-run
Digest: sha256:ec8f7e2edbcf65185a36b51a5c88975964a78a1e3d5fb84d618e2720c25f110d
Status: Image is up to date for cnbs/sample-stack-run:alpine
Adding buildpack io.buildpacks.samples.hello-universe version 0.0.1 to builder
Adding buildpack io.buildpacks.samples.hello-moon version 0.0.1 to builder
Adding buildpack io.buildpacks.samples.hello-world version 0.0.1 to builder
Setting custom order
...
===> EXPORTING
[exporter] Reusing layers from image with id '769e59742b7e2c23d10befbe5604e2302baf7bbd458462724497265341248635'
[exporter] Reusing layer 'app'
[exporter] Layer 'app' SHA: sha256:a473218c1ddb195fc64931101b401b9d9955c72330c695787768b4a63e881c25
[exporter] Reusing layer 'config'
[exporter] Layer 'config' SHA: sha256:ffb0454fbd928b649cdb857e7e7eb3b6d071db7573b93f805cd145d5bf300081
[exporter] Reusing layer 'launcher'
[exporter] Layer 'launcher' SHA: sha256:3a06d7427586a5c9cf718065e088c0e3358b35b21ed73c00a2fb4fe2e4e2d7db
[exporter] *** Images (f92793e747a9):
[exporter]       index.docker.io/library/my-other-app:latest
[exporter]
[exporter] *** Image ID: f92793e747a9ec1a62cc11526647becdda5c7cf413e6fc5ccc1514e3c95f730d
===> CACHING
Successfully built image my-other-app

local buildpack in docker daemon with --publish

./out/pack build my-other-app -B cnbs/sample-builder:alpine -b cnbs/sample-package:hello-universe -p ../samples/apps/ruby-bundler/ -v --publish
Pulling image index.docker.io/cnbs/sample-builder:alpine
alpine: Pulling from cnbs/sample-builder
Digest: sha256:cc0fe2eb24295b7f91780c96677eced421b307693686a825a1d33b9bb10107e8
Status: Image is up to date for cnbs/sample-builder:alpine
Selected run image cnbs/sample-stack-run:alpine
ERROR: creating from buildpackage cnbs/sample-package:hello-universe: fetching image cnbs/sample-package:hello-universe: image cnbs/sample-package:hello-universe does not exist in registry: not found

registry buildpack not in docker daemon with --publish

./out/pack build my-other-app -B cnbs/sample-builder:alpine -b cnbs/sample-package:hello-universe -p ../samples/apps/ruby-bundler/ -v --publish
Pulling image index.docker.io/cnbs/sample-builder:alpine
alpine: Pulling from cnbs/sample-builder
Digest: sha256:cc0fe2eb24295b7f91780c96677eced421b307693686a825a1d33b9bb10107e8
Status: Image is up to date for cnbs/sample-builder:alpine
Selected run image cnbs/sample-stack-run:alpine
Adding buildpack io.buildpacks.samples.hello-universe version 0.0.1 to builder
Adding buildpack io.buildpacks.samples.hello-world version 0.0.1 to builder
Adding buildpack io.buildpacks.samples.hello-moon version 0.0.1 to builder
Setting custom order
Using build cache volume pack-cache-84be41f001c5.build

registry buildpack not in docker daemon with --no-pull

./out/pack build my-other-app -B cnbs/sample-builder:alpine -b cnbs/sample-package:hello-universe -p ../samples/apps/ruby-bundler/ -v --no-pull
Selected run image cnbs/sample-stack-run:alpine
ERROR: creating from buildpackage cnbs/sample-package:hello-universe: fetching image cnbs/sample-package:hello-universe: image cnbs/sample-package:hello-universe does not exist on the daemon: not found

registry buildpack not in docker daemon

./out/pack build my-other-app -B cnbs/sample-builder:alpine -b cnbs/sample-package:hello-universe -p ../samples/apps/ruby-bundler/ -v
Pulling image index.docker.io/cnbs/sample-builder:alpine
alpine: Pulling from cnbs/sample-builder
Digest: sha256:cc0fe2eb24295b7f91780c96677eced421b307693686a825a1d33b9bb10107e8
Status: Image is up to date for cnbs/sample-builder:alpine
Selected run image cnbs/sample-stack-run:alpine
Pulling image cnbs/sample-stack-run:alpine
alpine: Pulling from cnbs/sample-stack-run
Digest: sha256:ec8f7e2edbcf65185a36b51a5c88975964a78a1e3d5fb84d618e2720c25f110d
Status: Image is up to date for cnbs/sample-stack-run:alpine
Pulling image cnbs/sample-package:hello-universe
hello-universe: Pulling from cnbs/sample-package
53007d1fc096: Pull complete
54b7faf4b27d: Pull complete
a76da803ecb4: Pull complete
Digest: sha256:1dbc3df4c42fc84302d1c52b4405499c9314894aaaefe6d4a522a04a50d7db18
Status: Downloaded newer image for cnbs/sample-package:hello-universe
Adding buildpack io.buildpacks.samples.hello-universe version 0.0.1 to builder
Adding buildpack io.buildpacks.samples.hello-world version 0.0.1 to builder
Adding buildpack io.buildpacks.samples.hello-moon version 0.0.1 to builder
Setting custom order
Using build cache volume pack-cache-84be41f001c5.build

@jromero jromero merged commit e453705 into master Feb 12, 2020
@jromero jromero deleted the feature/348-packages-in-build branch February 12, 2020 22:23
@ameyer-pivotal
Copy link
Contributor Author

Do the --publish / --no-pull semantics play a part here and are taken into consideration?

Edit: Think I answered my question via a few trials. The answer is yes.

@jromero Yep, they do, as it's using the same mechanism for pulling that pack uses for all other kinds of images (imageFetcher.Fetch()). We just wire through the CLI opts. That wiring is not explicitly tested however, so if you think it's worth covering, I can make that change.

@jromero jromero added this to the pack-0.9.0 milestone Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pack build --buildpack accepts a buildpackage as an argument
2 participants