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

[RFC #0105] Extender changes for run image extension (Dockerfiles phase 3) #998

Closed
Tracked by #224
natalieparellano opened this issue Feb 2, 2023 · 0 comments · Fixed by #1022
Closed
Tracked by #224
Assignees
Labels
status/ready type/enhancement New feature or request

Comments

@natalieparellano
Copy link
Member

natalieparellano commented Feb 2, 2023

Spec PR: https://github.com/buildpacks/spec/pull/347/files

For newer platform API (0.12 and above), the extender accepts new -extended and -kind flags. -extended is the location of a directory to output extended run image layers. -kind is the kind of image to extend (build (default) or run).

When extending the run image, the extender should find the image-to-extend's manifest & config in <kaniko-dir>/cache (the restorer pulls these down).

After extending the image, the extender:

  - **If** any `run.Dockerfile` set the label `io.buildpacks.rebasable` to `false` or left the label unset:
    - SHALL set the label `io.buildpacks.rebasable` to `false` on the extended run image
  - SHALL copy the manifest and config for the extended run image, along with any new layers, to `<extended>`

The extender should provide user_id and group_id build args to each Dockerfile (build or run).

@natalieparellano natalieparellano added this to the lifecycle 0.17.0 milestone Feb 6, 2023
@natalieparellano natalieparellano self-assigned this Mar 6, 2023
natalieparellano added a commit that referenced this issue Mar 24, 2023
We'll be able to fully remove internal/selective
when we update tests for the extender as part of #998

Signed-off-by: Natalie Arellano <narellano@vmware.com>
natalieparellano added a commit that referenced this issue Mar 28, 2023
* Make a single constructor for lifecycle inputs

- The logic to update the default path for TOML files was repeated across phases
- In general it is safe to provide default values for inputs that might not be relevant to the current phase,
  as these will be ignored when constructing a new service for the phase;
  e.g., platform.LifecycleInputs.OrderPath will be ignored when constructing a lifecycle.Exporter
- As more inputs are shared across phases (e.g., analyzed.toml is now an input to the detect phase),
  duplicating the logic for providing default values is becoming more cumbersome

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Read values from environment

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Buildpack API: run.Dockerfiles are allowed instructions on versions >= 0.10

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Platform API: the detector accepts a new -run flag

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Move responsibility for validating Dockerfiles into the buildpack package

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* When verifying Dockerfiles, return the new base image name if necessary

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* When determining the new runtime base image, use criteria outlined in the platform spec

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Platform API: the schema of analyzed.toml is updated to include run-image.extend = <true or false, default false>

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* TESTME: Update analyzed.toml with new run image if needed

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* If extensions are used to switch the runtime base image, the detector should fail if the selected base image is not found in run.toml.

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Add fixture to test re-writing of analyzed.toml

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Move updating analyzed.toml into lifecycle package for easier testing

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Platform API: the restorer will update analyzed.toml with:
- digest ref for run image
- target data for run image

Additionally the restorer will download the run image manifest & config when extend is true

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Update acceptance/extender_test.go

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix merge and restore selective package

imgutil/layout/sparse modifies the image media types which we don't want

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Update analyzed.toml with digest reference or target data if needed

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix acceptance

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Don't redefine -layers

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Test organization and remove the requirement that we're exporting to a registry to use run image extensions

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix acceptance

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix acceptance

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Test that we don't update target data for older platforms

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Remove target partial and use helper function

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix acceptance

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Bump imgutil

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix acceptance

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Use imgutil/sparse package instead of internal/selective package

We'll be able to fully remove internal/selective
when we update tests for the extender as part of #998

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Don't try to pull a builder image if it wasn't specified

Ensure we write a digest reference to analyzed.toml

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Fix lint

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Add and update comment

Signed-off-by: Natalie Arellano <narellano@vmware.com>

---------

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/ready type/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant