Skip to content

Commit 3339793

Browse files
author
Natalie Arellano
committed
Add migration guide for Platform 0.12 (WIP)
Signed-off-by: Natalie Arellano <[email protected]>
1 parent 82f8f3b commit 3339793

10 files changed

+161
-31
lines changed

content/docs/reference/spec/migration/buildpack-api-0.8-0.9.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ Buildpack processes can still use a shell! However, the `command` must now expli
2020

2121
Hand-in-hand with shell removal is the introduction of overridable process arguments.
2222

23-
In `launch.toml`, `command` is now a list. The first element in `command` is the command, and all following entries are arguments that are always provided to the process, regardless of how the application is started. The `args` list now designates arguments that can be overridden by the end user - if supported by the platform (platform API version 0.10 and above). For further details, see the platform [migration guide](/docs/reference/spec/migration/platform-api-0.9-0.10).
23+
In `launch.toml`, `command` is now a list. The first element in `command` is the command, and all following entries are arguments that are always provided to the process, regardless of how the application is started. The `args` list now designates arguments that can be overridden by the end user - if supported by the platform (Platform API version 0.10 and above). For further details, see the platform [migration guide](/docs/reference/spec/migration/platform-api-0.9-0.10).
2424

25-
For older platforms (platform API version 0.9 and below), arguments in `args` will be appended to arguments in `command`, negating the new functionality (but preserving compatibility).
25+
For older platforms (Platform API version 0.9 and below), arguments in `args` will be appended to arguments in `command`, negating the new functionality (but preserving compatibility).
2626

2727
### Image extensions are supported (experimental)
2828

content/docs/reference/spec/migration/platform-api-0.10-0.11.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ title="Platform API 0.10 -> 0.11"
44

55
<!--more-->
66

7-
This guide is most relevant to platform operators.
7+
This guide is most relevant to platform operators and builder authors.
88

9-
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.11) for platform API 0.11 for the full list of changes and further details.
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.11) for Platform API 0.11 for the full list of changes and further details.
1010

1111
## Platform Operator
1212

@@ -25,6 +25,27 @@ and copied to `<layers>/sbom/launch/<buildpack-id>/sbom.<ext>` (for build-time d
2525
Platforms that are already handling these files should not need to take additional action -
2626
the resulting SBOMs will simply be more complete.
2727

28+
### The rebaser accepts a -previous-image flag to allow rebasing by digest reference
29+
30+
Previously, when rebasing an image, the rebased image would always be saved to the same tag as the original image.
31+
This prevented rebasing by digest, among other use cases.
32+
33+
In Platform 0.11, the original image may be specified separately from the destination image with the `previous-image` flag, as in the following:
34+
35+
```bash
36+
/cnb/lifecycle/rebaser -previous-image some-original-image some-destination-image
37+
```
38+
39+
As before, additional tags for the destination image can also be provided:
40+
41+
```bash
42+
/cnb/lifecycle/rebaser -previous-image some-original-image -tag some-additional-tag:latest some-destination-image
43+
```
44+
45+
To use this feature, platforms can provide the new `-previous-image` flag to the `rebaser`.
46+
47+
## Builder Author
48+
2849
### Platforms can specify build time environment variables
2950

3051
Builders can include a `/cnb/build-config/env/` directory to define environment variables for buildpacks.
@@ -44,23 +65,4 @@ The order of application for env directories is:
4465

4566
For additional information, see the [buildpack environment](https://github.com/buildpacks/spec/blob/main/platform.md#buildpack-environment) section in the Platform spec.
4667

47-
To use this feature, during builder creation operators should include a `/cnb/build-config/env/` directory with the desired configuration.
48-
49-
### The rebaser accepts a -previous-image flag to allow rebasing by digest reference
50-
51-
Previously, when rebasing an image, the rebased image would always be saved to the same tag as the original image.
52-
This prevented rebasing by digest, among other use cases.
53-
54-
In Platform 0.11, the original image may be specified separately from the destination image with the `previous-image` flag, as in the following:
55-
56-
```bash
57-
/cnb/lifecycle/rebaser -previous-image some-original-image some-destination-image
58-
```
59-
60-
As before, additional tags for the destination image can also be provided:
61-
62-
```bash
63-
/cnb/lifecycle/rebaser -previous-image some-original-image -tag some-additional-tag:latest some-destination-image
64-
```
65-
66-
To use this feature, platforms can provide the new `-previous-image` flag to the `rebaser`.
68+
To use this feature, builder authors should include a `/cnb/build-config/env/` directory with the desired configuration.
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
+++
2+
title="Platform API 0.11 -> 0.12"
3+
+++
4+
5+
<!--more-->
6+
7+
This guide is most relevant to platform operators, base image authors, and builder authors.
8+
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.12) for Platform API 0.12 for the full list of changes and further details.
10+
11+
## Platform Operator
12+
13+
### Stacks are deprecated
14+
15+
In Platform 0.12, the concepts of stacks and mixins are removed
16+
in favor of existing constructs in the container image ecosystem such as operating system name, operating system distribution, and architecture.
17+
18+
#### During build
19+
20+
The `-stack` flag is removed from the `analyzer` and `exporter` and replaced with a `-run` flag
21+
that indicates the location of a `run.toml` file with schema:
22+
23+
```toml
24+
[[images]]
25+
image = "<image>"
26+
mirrors = ["<mirror>", "<mirror>"]
27+
```
28+
29+
For each image in `[[images]]`, `image` is a tag reference to a run image and `mirrors` contains tag references to its mirrors.
30+
31+
Note that whereas `stack.toml` (removed in this API version) only contained a single run image with mirrors, `run.toml` contains a list of images.
32+
This is because of image extensions and the possibility of run image switching, introduced in Platform 0.10.
33+
For platforms that do not use image extensions, only a single run image with mirrors is needed in `run.toml`.
34+
35+
#### After build
36+
37+
The `stack` key in the `io.buildpacks.lifecycle.metadata` is removed.
38+
To find a tag reference to the run image and mirrors information,
39+
platforms should read the newly added `runImage.image` and `runImage.mirrors` in `io.buildpacks.lifecycle.metadata`.
40+
41+
#### During rebase
42+
43+
Additional validations were added to the `rebaser` along with a `-force` flag to force rebase when validations are not satisfied.
44+
45+
If `-force` is not provided,
46+
* The following values in the image config for the new run image must match the original image config:
47+
* `os`
48+
* `architecture`
49+
* `variant` (if specified)
50+
* `io.buildpacks.base.distro.name` label (if specified)
51+
* `io.buildpacks.base.distro.version` label (if specified)
52+
* If `-run-image` is provided it must be found in `io.buildpacks.lifecycle.metadata` in either `runImage.image` or `runImage.mirrors`
53+
* `io.buildpacks.rebasable` must be `true` (see run image extension below)
54+
55+
### Run image extensions is supported (experimental)
56+
57+
In Platform 0.12 extensions can be used to extend not only build-time base images, but runtime base images as well.
58+
59+
TODO
60+
61+
### OCI layout is a supported export format
62+
63+
TODO
64+
65+
## Base Image Author
66+
67+
### Stacks are deprecated
68+
69+
When creating build-time or runtime base images, base image authors should set `io.buildpacks.base.distro.name` and `io.buildpacks.base.distro.version` labels
70+
containing the values specified in `/etc/os-release` (`$ID` and `$VERSION_ID`).
71+
This information - along with operating system, architecture, and architecture variant from the OCI image config,
72+
will be exposed to buildpacks through `$CNB_TARGET_*` environment variables.
73+
74+
Additionally, authors may set an `io.buildpacks.base.id` label on runtime base images to uniquely identify the image "flavor" - see the [Platform spec](https://github.com/buildpacks/spec/blob/main/platform.md#target-data) for further information and requirements.
75+
76+
To allow newer builders to run on older platforms, base image authors should continue to set any `io.buildpacks.stack.*` labels that are still relevant.
77+
Note that "information only" labels such as `io.buildpacks.stack.maintainer` have new equivalents in `io.buildpacks.base.maintainer`,
78+
and it is recommended to set both sets of labels for the time being.
79+
80+
To maintain compatibility with older buildpacks, build-time base images should continue to set `$CNB_STACK_ID` in the build environment.
81+
82+
## Builder Author
83+
84+
### Stacks are deprecated
85+
86+
With the removal of stacks, there is also a new way to reference build-time and runtime base images in `builder.toml`.
87+
Builder authors should ensure their `pack` version is at least `0.30.0` in order to create builders that will work with newer platforms.
88+
89+
The new `builder.toml` schema is:
90+
91+
```toml
92+
[run]
93+
[[run.images]]
94+
image = "cnbs/some-run-image"
95+
mirrors = ["mirror1", "mirror2"]
96+
[build]
97+
image = "cnbs/some-build-image"
98+
```
99+
100+
Run image information will be translated to `run.toml` in the builder with schema:
101+
102+
```toml
103+
[[images]]
104+
image = "cnbs/some-run-image"
105+
mirrors = ["mirror1", "mirror2"]
106+
```
107+
108+
Run image information will also be translated to `stack.toml` (for compatibility with older platforms) in the builder with schema:
109+
110+
```toml
111+
[run-image]
112+
image = "cnbs/some-run-image"
113+
mirrors = ["mirror1", "mirror2"]
114+
```
115+
116+
The old `builder.toml` schema is still valid:
117+
118+
```toml
119+
[stack]
120+
id = "some.stack.id"
121+
run-image = "cnbs/some-run-image"
122+
run-image-mirrors = ["mirror1", "mirror2"]
123+
build-image = "cnbs/some-build-image"
124+
```
125+
126+
If the old `builder.toml` schema is used, run image information will be translated to the same `run.toml` and `stack.toml` file formats as above.
127+
128+
It is possible to define both the new and the old schema within `builder.toml`, but they must be consistent or `pack builder create` will fail.

content/docs/reference/spec/migration/platform-api-0.3-0.4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title="Platform API 0.3 -> 0.4"
66

77
This guide is most relevant to platform operators.
88

9-
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.4) for platform API 0.4 for the full list of changes and further details.
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.4) for Platform API 0.4 for the full list of changes and further details.
1010

1111
### Windows support
1212

content/docs/reference/spec/migration/platform-api-0.4-0.5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title="Platform API 0.4 -> 0.5"
66

77
This guide is most relevant to platform operators and stack authors.
88

9-
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.5) for platform API 0.5 for the full list of changes and further details.
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.5) for Platform API 0.5 for the full list of changes and further details.
1010

1111
## Platform Operator
1212

content/docs/reference/spec/migration/platform-api-0.5-0.6.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title="Platform API 0.5 -> 0.6"
66

77
This guide is most relevant to platform operators.
88

9-
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.6) for platform API 0.6 for the full list of changes and further details.
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.6) for Platform API 0.6 for the full list of changes and further details.
1010

1111
## Platform Operator
1212

content/docs/reference/spec/migration/platform-api-0.6-0.7.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title="Platform API 0.6 -> 0.7"
66

77
This guide is most relevant to platform operators.
88

9-
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.7) for platform API 0.7 for the full list of changes and further details.
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.7) for Platform API 0.7 for the full list of changes and further details.
1010

1111
## Platform Operator
1212

content/docs/reference/spec/migration/platform-api-0.7-0.8.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title="Platform API 0.7 -> 0.8"
66

77
This guide is most relevant to platform operators.
88

9-
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.8) for platform API 0.8 for the full list of changes and further details.
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.8) for Platform API 0.8 for the full list of changes and further details.
1010

1111
## Platform Operator
1212

content/docs/reference/spec/migration/platform-api-0.8-0.9.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title="Platform API 0.8 -> 0.9"
66

77
This guide is most relevant to platform operators.
88

9-
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.9) for platform API 0.9 for the full list of changes and further details.
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.9) for Platform API 0.9 for the full list of changes and further details.
1010

1111
## Platform Operator
1212

content/docs/reference/spec/migration/platform-api-0.9-0.10.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title="Platform API 0.9 -> 0.10"
66

77
This guide is most relevant to platform operators.
88

9-
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.10) for platform API 0.10 for the full list of changes and further details.
9+
See the [spec release](https://github.com/buildpacks/spec/releases/tag/platform%2Fv0.10) for Platform API 0.10 for the full list of changes and further details.
1010

1111
## Platform Operator
1212

0 commit comments

Comments
 (0)