buildpacks / roadmap

Issue tracker
https://buildpacks.io
Apache License 2.0
0 stars 0 forks source link

replace `configure-builder` with `configure-run-image` #38

Closed ekcasey closed 5 years ago

ekcasey commented 5 years ago

I think we should allow users to specify additional run-image locations by adding local configuration for a run-image rather than for a builder. This will allow users to avoid specifying duplicate configuration for every builder that is based on the same stack. It also expresses the idea that all of the run images should be different locations for the same artifact. Finally It allows us to use the same run-image selection logic on both build and rebase.

set-run-image-mirrors

When I run pack set-run-image-mirrors <run-image> --mirror=<mirror-image-1> --mirror=<mirror-image-2> Then I can see the following entry in my config.toml

[[run-images]]
 image = <run-image>
 mirrors =  [<mirror-image-1>, <mirror-image-2>]

create-builder

Given I have a stack and run image mirrors configured

[[stacks]]
 id = <stack-id>
 build-image = <build-image>
 run-image = <run-image>

[[run-images]]
 image = <run-image>
 mirrors =  [<mirror-image-1>, <mirror-image-2>]

When I run pack create-builder -s <stack-id> Then my builder is generated with the follow metadata label which excludes the mirrors

{"runImage": { "image": "<run-image>", "mirrors": []} }

pack build

When I run pack build <app-image> --run-image=<custom-run-image> Then <custom-run-image is used as the base image for <app-image>. We will not look up mirrors

Given I have configured run image mirrors

[[run-images]]
 image = <run-image>
 mirrors =  [<mirror-image-1>, <mirror-image-2>]

Given my default builder has the following metadata label {"runImage": { "image": "<run-image>", "mirrors": [<builder-configured-mirror>]} } When I run pack build <app-image> Then Then the run image is chosen by finding a image with a registry that matches the app-image preferring a locally configured mirror to a mirror from the builder metadata. (same behavior and order of precedence that we currently have)

pack inspect-builder

Given I have configured run image mirrors

[[run-images]]
 image = <run-image>
 mirrors =  [<mirror-image-1>, <mirror-image-2>]

Given my builder has the following metadata label {"runImage": { "image": "<run-image>", "mirrors": [<builder-configured-mirror>]} } When I run pack inspect builder <builder> Then the run images section of the output should look like:

Run image: <run-image>
Run images:
  <mirror-image-1> (locally-configured)
  <mirror-image-2> (locally-configured)
  <run-image>
  <builder-configured-mirror>
sclevine commented 5 years ago

Suggested change to config.toml:

[[stacks]]
 id = <stack-id>
 build-image = <build-image>
 run-image = <run-image>
 run-image-mirrors = [<mirror-image-1>, <mirror-image-2>]

Suggested change to behavior: When A builder is created with pack create-builder Then In addition to the run-image, the run-image-mirrors are added to the builder metadata

sclevine commented 5 years ago

tag was used instead of image in config.toml. We should avoid the word "tag," because:

  1. Digest references are valid in this context (e.g., example.com/image@sha256:abc2345)
  2. tag is often misused (even in official documentation) to refer to the part of the tag after the :

ref would also be acceptable, but we seem to use image consistently in other places, so I think we should use that here.