-
Notifications
You must be signed in to change notification settings - Fork 75
RFC: Remove Stacks & Mixins #172
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
Changes from 7 commits
d16f1a9
1b55b44
5e7d9ff
df7d715
02cb22a
f888612
ce16a04
b876676
891104e
e2587fb
0dd5899
b1f606c
4299b4b
ef6d531
ff4c94a
3fe2b89
e24bcad
85545b5
ad051c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| # Meta | ||
| [meta]: #meta | ||
| - Name: Remove Stacks & Mixins | ||
| - Start Date: 2021-06-30 | ||
| - Author(s): sclevine | ||
| - RFC Pull Request: (leave blank) | ||
| - CNB Pull Request: (leave blank) | ||
| - CNB Issue: (leave blank) | ||
| - Supersedes: [RFC0069](https://github.com/buildpacks/rfcs/blob/main/text/0069-stack-buildpacks.md), [RFC#167](https://github.com/buildpacks/rfcs/pull/167), many others | ||
|
|
||
| # Summary | ||
| [summary]: #summary | ||
|
|
||
| *NOTE: This proposal is part of a larger initiative to reduce complexity originally outlined in https://github.com/buildpacks/rfcs/pull/167* | ||
|
|
||
| This RFC proposes that we remove the "stack" and "mixin" concepts from the project and replace them with existing constructs in the container image ecosystem such as base images, Dockerfiles, and OS packages. | ||
|
|
||
| # Motivation | ||
| [motivation]: #motivation | ||
|
|
||
| The "stack" and "mixin" concepts add unnecessary complexity to the project and make it difficult for new users and contributors to understand how buildpacks work. Compatibility guarantees that are strongly enforced by the stack contract could be replaced with metadata validations and warnings. | ||
|
|
||
| # What it is | ||
| [what-it-is]: #what-it-is | ||
|
|
||
| Summary of changes: | ||
| - Remove mixins | ||
| - Replace stack metadata (including stack IDs) with canonical OS metadata. | ||
|
jromero marked this conversation as resolved.
|
||
|
|
||
| # How it Works | ||
| [how-it-works]: #how-it-works | ||
|
|
||
| ## Base Image Metadata | ||
|
sclevine marked this conversation as resolved.
|
||
|
|
||
| Instead of a stack ID, runtime and build-time base images must contain the following canonicalized metadata: | ||
| - OS (e.g., "linux", `$GOOS`), specified as `os` in the base image `config` | ||
| - Architecture (e.g., "arm", `$GOARCH`), specified as `architecture` in the base image `config` | ||
| - Architecture Variant (optional) (e.g., "v6", `$GOARM`), specified as `variant` in the base image `config` | ||
| - Distribution (optional) (e.g., "ubuntu", `$ID`), specified as a label `io.buildpacks.distribution.name` | ||
| - Version (optional) (e.g., "18.04", `$VERSION_ID`), specified as a label `io.buildpacks.distribution.version` | ||
|
jromero marked this conversation as resolved.
|
||
|
|
||
| OS, Architecture, and Architecture Variant must be valid identifiers as defined in the [OCI Image specification](https://github.com/opencontainers/image-spec/blob/main/config.md). | ||
| For Linux-based images, each field should be canonicalized against values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`). | ||
|
hone marked this conversation as resolved.
Outdated
sclevine marked this conversation as resolved.
Outdated
|
||
| The `os.version` field in an base image `config` may contain combined distribution and version information, but it is not used by the lifecycle. | ||
|
|
||
| The `stacks` list in `buildpack.toml` is replaced by a `targets` list, where each entry corresponds to a different buildpack image that is exported into a [manifest index](https://github.com/opencontainers/image-spec/blob/master/image-index.md). Each entry may contain multiple valid values for Distribution and/or Version, but only a single OS, Architecture, and Variant. | ||
|
|
||
| App image builds fail if the build image and selected run image have mismatched metadata. We may introduce flags or additional labels to skip this validation (e.g., for cross-compilation or minimal runtime base images). An image without a specified Distribution is compatible with images specifying any Distribution. An image specifying a Distribution without a Version is compatible with images specifying any Versions of that Distribution. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Haven't thought this through all the way but would it make sense to this in the build plan as well. E.g. a buildpack could specify in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Is this what would replace wildcard stack support, i.e.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not sure this needs to be dynamic. I wonder if this could be part of the multi-platform interface? See: #172 (comment)
The requirement is just describing the contract between the build and run images. Wildcard stack support is achieved by leaving off Distribution and Version entirely. (There is no wildcard support for OS/Architecture.)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just updating this thread in case someone comes along in two more years, but anyway it turned out while implementing we did make an explicit extension for "*" OS/Architecture. |
||
|
|
||
| When an app image is rebased, `pack rebase` will fail if the new run image and previous run image have mismatched metadata. This check may be skipped for Distribution and Version by passing a new `--force` flag to `pack rebase`. | ||
|
sclevine marked this conversation as resolved.
Outdated
|
||
|
|
||
|
Comment on lines
+68
to
+69
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /queue-issue buildpacks/lifecycle "Rebaser should validate new run image metadata against old run image metadata" epic/dockerfiles type/enhancement
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /queue-issue buildpacks/pack "Add --force to rebase operation" |
||
| #### Example: buildpack.toml `targets` table | ||
|
|
||
| ```toml | ||
|
hone marked this conversation as resolved.
|
||
| [[targets]] | ||
| os = "linux" | ||
| arch = "x86_64" | ||
| [[targets.distributions]] | ||
| name = "ubuntu" | ||
| versions = ["18.04", "20.04"] | ||
|
|
||
| [[targets]] | ||
| os = "linux" | ||
| arch = "x86_64" | ||
|
ekcasey marked this conversation as resolved.
|
||
| [[targets.distributions]] | ||
| name = "ubuntu" | ||
| versions = ["14.04", "16.04"] | ||
|
|
||
| [[targets]] | ||
| os = "linux" | ||
| arch = "arm" | ||
| variant = "v6" | ||
| [[targets.distributions]] | ||
| name = "ubuntu" | ||
| versions = ["14.04", "16.04"] | ||
| ``` | ||
|
|
||
| ## Runtime Metadata | ||
|
|
||
| To allow different runtime base images to be used, and to support cross-compilation in the future, buildpacks may need access to the runtime base image's target metadata. | ||
| The following environment variables will be available to buildpacks directly in the build-time environment (not via `/platform/env`): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part is a little unclear to me. This appears to be talking about a set of environment variables that are given to the buildpacks during build-time.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| - `CNB_TARGET_OS` | ||
| - `CNB_TARGET_ARCH` | ||
| - `CNB_TARGET_VARIANT` | ||
| - `CNB_TARGET_DISTRO_NAME` | ||
| - `CNB_TARGET_DISTRO_VERSION` | ||
| - `CNB_TARGET_ID` (optional ID, if present on runtime base image `io.buildpacks.id` label) | ||
|
hone marked this conversation as resolved.
|
||
|
|
||
| ## Mixins | ||
|
|
||
| Mixins are no longer used. If an SBoM is available, platforms may warn when, e.g., a rebase operation would change the available packages. | ||
|
|
||
| ### Example: CycloneDX SBoM | ||
|
|
||
| ```json | ||
| { | ||
| "bomFormat": "CycloneDX", | ||
| "specVersion": "1.3", | ||
| "version": 1, | ||
| "components": [ | ||
| { | ||
| "type": "library", | ||
| "name": "curl", | ||
| "version": "1.2.3", | ||
| "purl": "pkg:deb/ubuntu/curl@1.2.3" | ||
| }, | ||
| { | ||
| "type": "library", | ||
| "name": "libcurl", | ||
| "version": "4.5.6", | ||
| "purl": "pkg:deb/ubuntu/libcurl@4.5.6" | ||
| }, | ||
| ... | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ### Validations | ||
|
|
||
| Buildpack base image metadata specified in `buildpack.toml`'s `targets` list are validated against the runtime and build-time base images. | ||
|
jromero marked this conversation as resolved.
|
||
|
|
||
| Runtime and build-time base image packages are no longer validated against each other. | ||
|
|
||
| If an SBoM is available, `pack rebase` will fail if packages are removed from the new runtime base image. | ||
|
sclevine marked this conversation as resolved.
Outdated
|
||
| This check may be skipped by passing a new `--force` flag to `pack rebase`. | ||
| However, this validation is not enforced by the specification. | ||
|
|
||
| ### Migration | ||
|
|
||
| All existing labels and environment variables for stacks and mixins may be preserved on a base image until all users have migrated to the new format. | ||
| These labels will be deprecated (but allowed) for the forseeable future. | ||
| If the newly-specified field values are missing, the lifecycle and pack may used existing, standardized stack IDs (i.e., `io.buildpacks.stacks.*`) to determine the values of the missing fields, as long as the lifecycle and pack provide a warning for the user. | ||
|
sclevine marked this conversation as resolved.
Outdated
|
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to address the migration path in this RFC
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed, let me know if you think I covered the relevant migration scenarios
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding this! Would we also continue to allow
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely, I can add that as well
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@jkutner This makes me think |
||
| # Drawbacks | ||
| [drawbacks]: #drawbacks | ||
|
|
||
| - Involves breaking changes when existing metadata is removed. | ||
| - `CNB_TARGET_*` env vars assume a single target -- may require more breaking changes to support parallel, single-container cross-compilation in the future. | ||
|
|
||
| # Alternatives | ||
| [alternatives]: #alternatives | ||
|
|
||
| - Keep stacks. | ||
|
sclevine marked this conversation as resolved.
|
||
| - Make the above changes but keep some existing terminology: stacks, build-image, run-image. | ||
|
jromero marked this conversation as resolved.
|
||
| - Continue to allow buildpacks to specify package requirements (e.g., by PURL instead of mixins) | ||
|
|
||
| # Unresolved Questions | ||
|
sclevine marked this conversation as resolved.
|
||
| [unresolved-questions]: #unresolved-questions | ||
|
|
||
| - How will migration work? Can we make new base images compatible with older buildpacks? Can we make newer buildpacks compatible with older stacks? | ||
| - What should builder.toml (and similar stack-dependent config files) look like? What should assets look like? Note: these could be decided in subsequent subteam RFCs / spec PRs. | ||
|
sclevine marked this conversation as resolved.
jromero marked this conversation as resolved.
|
||
|
|
||
|
sclevine marked this conversation as resolved.
|
||
| # Spec. Changes (OPTIONAL) | ||
| [spec-changes]: #spec-changes | ||
|
|
||
| This RFC requires extensive changes to all specifications. | ||
Uh oh!
There was an error while loading. Please reload this page.