|
| 1 | ++++ |
| 2 | +title="Platform API 0.9 -> 0.10" |
| 3 | ++++ |
| 4 | + |
| 5 | +<!--more--> |
| 6 | + |
| 7 | +This guide is most relevant to platform operators. |
| 8 | + |
| 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. |
| 10 | + |
| 11 | +## Platform Operator |
| 12 | + |
| 13 | +### The `launcher` supports overridable process args |
| 14 | + |
| 15 | +The way user-provided arguments are handled by the launcher depends on the buildpack API of the buildpack that created the process definition. |
| 16 | + |
| 17 | +#### Newer buildpacks |
| 18 | + |
| 19 | +Process types contributed by newer buildpacks (buildpack API 0.9 and above) may have overridable process arguments. Looking at metadata.toml: |
| 20 | +``` |
| 21 | +[[processes]] |
| 22 | +type = "from-newer-buildpack" |
| 23 | +command = ["some-command", "always-1", "always-2"] |
| 24 | +args = ["override-1", "override-2"] |
| 25 | +``` |
| 26 | + |
| 27 | +`always-1` and `always-2` are arguments that are always provided to `some-command`. If no user-provided arguments are specified when the application image is launched, `override-1` and `override-2` will also be provided. If user-provided arguments are specified, these will be provided **instead of** `override-1` and `override-2`. Example: |
| 28 | + |
| 29 | +``` |
| 30 | +docker run --entrypoint from-newer-buildpack my-image |
| 31 | +``` |
| 32 | + |
| 33 | +will result in the following command invocation: `some-command always-1 always-2 override-1 override-2`. However: |
| 34 | + |
| 35 | +``` |
| 36 | +docker run --entrypoint from-newer-buildpack my-image user-1 user-2 |
| 37 | +``` |
| 38 | + |
| 39 | +will result in the following command invocation: `some-command always-1 always-2 user-1 user-2`. |
| 40 | + |
| 41 | +#### Older buildpacks |
| 42 | + |
| 43 | +Process types contributed by older buildpacks (buildpack API 0.8 and below) do not have overridable process arguments. Looking at metadata.toml: |
| 44 | +``` |
| 45 | +[[processes]] |
| 46 | +type = "from-older-buildpack" |
| 47 | +command = ["some-command"] |
| 48 | +args = ["always-1", "always-2"] |
| 49 | +``` |
| 50 | + |
| 51 | +The `command` list will never have more than one entry. `always-1` and `always-2` are arguments that are always provided to `some-command`. If no user-provided arguments are specified when the application image is launched, `always-1` and `always-2` will be provided only. If user-provided arguments are specified, these will be **appended** to the `args` list. Example: |
| 52 | + |
| 53 | +``` |
| 54 | +docker run --entrypoint from-newer-buildpack my-image |
| 55 | +``` |
| 56 | + |
| 57 | +will result in the following command invocation: `some-command always-1 always-2`. However: |
| 58 | + |
| 59 | +``` |
| 60 | +docker run --entrypoint from-older-buildpack my-image user-1 user-2 |
| 61 | +``` |
| 62 | + |
| 63 | +will result in the following command invocation: `some-command always-1 always-2 user-1 user-2`. |
| 64 | + |
| 65 | +### Image extensions are supported (experimental) |
| 66 | + |
| 67 | +Platform 0.10 introduces image extensions as experimental components for customizing build and run-time base images (see [here][TODO] for more information). Image extensions output Dockerfiles which are applied by the lifecycle using [kaniko][https://github.com/GoogleContainerTools/kaniko], a tool for building container images in Kubernetes, as a library. |
| 68 | + |
| 69 | +Note: image extensions are not supported for Windows container images. |
| 70 | + |
| 71 | +* To create a builder with extensions, ensure the `pack` version in use is at least TODO and enable experimental features: `pack config experimental`. |
| 72 | +* Invoke `analyzer` as usual |
| 73 | +* Invoke `detector` with a new optional argument: `-generated`, to specify the directory where Dockerfiles generated by image extensions will be output (defaults to `<layers>/generated`) and include image extensions in `order.toml` |
| 74 | + * Dockerfiles for customizing the build image can be found in `<generated>/build/<image extension ID>/Dockerfile` |
| 75 | + * Dockerfiles for customizing the run image can be found in `<generated>/run/<image extension ID>/Dockerfile` |
| 76 | + * The new run image will be written to `analyzed.toml` |
| 77 | +* Invoke `restorer` with a new required argument (when using extensions): `-build-image`, a tag reference to the builder image in use |
| 78 | + * A new volume mount is introduced with target `/kaniko`; this volume must be writable by the `restorer` user |
| 79 | +* Invoke `extender` (new lifecycle binary) as _root_ instead of `builder`; the extender will use kaniko to apply the relevant generated Dockerfiles to the build image and then drop privileges to run the `build` phase |
| 80 | + * The same volume from `restore` should be mounted at `/kaniko` |
| 81 | +* Invoke `exporter` as usual |
| 82 | + * If Dockerfiles for customizing the run image were output by extensions, the `exporter` will use the run image designated by the extension process |
| 83 | + |
| 84 | +Extensions workflows are not currently supported when using the `creator` binary, though support may be added in the future. |
0 commit comments