As a buildpack developer I want to create a builder image on top of a custom stack so that I can create builder images specific to my platform
Creating a builder with a custom Stack
It respects the -s
or --stack
flag
Given I have created a ~/.pack/config.toml
file with the following contents
[[stacks]]
id = “my.custom.stack”
run-images = ["my-org/run", "registry2.org/my-org/run" ]
build-images = ["my-org/build"]
When I run pack create-builder my-org/builder -s "my.custom-stack" -b builder.toml
Then an image my-org/builder
is created using my-org/build
as the base image
And The following label is added to the builder image io.buildpacks.stack.id=my.custom.stack
It respects the default stack field
Given I have created a ~/.pack/config.toml
file with the following contents
default-stack-id = “my.custom.stack”
[[stacks]]
id = “my.custom.stack”
run-images = ["my-org/run", "registry2.org/my-org/run" ]
build-images = ["my-org/build"]
When I run pack create-builder my-org/builder -b builder.toml
Then an image my-org/builder
is created using my-org/build
as the base image
Building with a custom stack
Given I have created my-org/builder
using my.custom.stack
When I run pack build --builder my-org/builder my-org/app
Then my-org/app
image is generated using my-org/run
as the base image
It defaults to the run-image with a registry matching the app image
Given I have added new default stack to my config.toml
file
[[stacks]]
id = “my.custom.stack”
run-images = ["my-org/run", "registry2.org/my-org/run" ]
build-images = ["my-org/build"]
Given I have created my-org/builder
using my.custom.stack
When I run pack build --builder my-org/builder registry2.org/my-org/app
Then an app image registry2.org/my-org/app
is generated using registry2.org/my-org/run
as the base image
Allows custom run-images but errors on stack mismatch
Given I have created my-org/builder
using my.custom.stack
When I run pack build --builder my-org/builder registry2.org/my-org/app --run-image some-org/bad-run-image
Where some-org/bad-run-image
no io.buildpacks.stack.id
label or a io.buildpacks.stack.id
label who's value does not match my.custom.stack
Then it fails and prints a helpful error message
- run-images with correct stack labels are allowed, even if they are not included in the
config.toml
file
Recording default stacks
Whenever pack build
or pack create-builder
is run, any new stacks are added to the config.toml
if they do not exist already and bionic is set as the default stack if none is specified.
Note
- For domain matching look at domain matching in img package