Closed ekcasey closed 5 years ago
@sclevine
Added acceptance criteria and notes.
After a team discussion, we want to change this feature to have the following behavior:
Build
Rebase
--run-image
flag (Scenario 2).Waiting on approval of https://github.com/buildpack/lifecycle/pull/90
pack changes on branch run_images_during_rebase
to get merged after the above PR is merged
I think the desired end state we would like to get to is the following
pack create-builder
When the builder.toml
has the following contents
[stack]
id = "com.example.stack"
build-image = "example/build"
run-image = "example/run"
run-image-mirrors = ["registry.example.com/exmaple/run", "other.example.com/other/run"]
Then the builder is created with a label io.buildpacks.builder.metadata
with the following value
"{"runImage":{"image":"example/run","mirrors":["registry.example.com/exmaple/run", "other.example.com/other/run"]}"
And the following file is added to the builder image at path /buildpacks/mirrors.toml
.
And the following environment variable is set on the builder image CNB_MIRRORS_PATH=/buildpacks/mirrors.toml
lifecycle/exporter
When exporter
is called w/o the -runImage
flag
Then the exporter
selects the right run image from the mirrors.toml file at CNB_MIRRORS_PATH
And all the of the mirrors from the mirrors.toml
file are add to the io.buildpacks.run-image.metadata
label
"{"runImage":{"image":"example/run","mirrors":["registry.example.com/exmaple/run", "other.example.com/other/run"]}"
-runImage
)When exporter
is called with the -runImage
Then it uses the provided run-image as the base image for the exported app
And the mirrors from mirrors.toml
are added to a label as described above
*The value passed to -runImage does not* end up in a label
-mirrors
)When exporter
is called with -mirrors=/some/path/mirrors.toml
either with or without -runImage
Then It behaves as described in scenarios 1 (without -runImage
) & 2 (with -runImage
) but the mirrors.toml
is found at /some/path/mirrors.toml
is used instead of the file found at CNB_MIRRORS_PATH
pack rebase
pack rebase
selects the correct run image from the io.buildpacks.run-image.metadata
label
I am comfortable with us doing some subset of this functionality now but I think the interim behavior the subset to conform to the same interface (lifecycle flag, label names, value names within the labels), requiring only additive changes in the future.
With the above the changes, we should revert the change that added the label
flag to the exporter.
mirrors.toml
image = "string"
mirrors = ["string"]
We broke out the exporter selecting the run-image into buildpack/roadmap#58
We also made some last minute changes to the schema of metadata labels and files to reduce the total number of labels and the number of different names we use for the same concept
on the builder image:
stack.toml
file with the following schema
[run-image]
image = "string"
mirrors = ["string", "string"]
io.buildpacks.builder.metadata
label
{"stack":{"runImage": {"image": "string", "mirrors": ["string", "string"]}}}
on the app image:
we added the stack info to theio.buildpacks.lifecycle.metadata
label
{"stack":{"runImage": {"image": "string", "mirrors": ["string", "string"]}}}
Leaving this as unaccepted because I want to test more edge cases, but it looks good enough to release in v0.1.0.
Acceptance Criteria Given When I run
pack build my-image
Then I new version of the run image is available on all mirrorsScenario 1 When I run
pack rebase my-image
(without--run-image
) Then The run image undermy-image
is replaced with a run image from the appropriate sourceScenario 2 When I run
pack rebase my-image --run-image custom/image
Then The run image undermy-image
is replaced withcustom/image
Notes
pack build
. This means therun-image
andrun-image-mirrors
from the builder used duringpack build
must be encoded in the generated OCI image on eachpack build
.--no-pull
to work when only a local image is availablepack build --publish
,pack rebase --publish
should work when the run image is not available at the target registry. This means that if a suitable run image is not available on the registry, then select the canonical image.pack *-stack
commandsImplementation Notes
pack create-builder
should add a file (similar toorder.toml
) that also contains the run image mirror metadata (that is also available as a LABEL on the image). The file path should have a default value, but also be overridable using an arg or env var (likeorder.toml
).CNB_MIRRORS_PATH
/-mirrors
//buildpacks/mirrors.toml