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

Add Builder extension spec #193

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.idea/
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ When the specification refers to a path in the context of an OCI layer tar (e.g.
- [Bindings Extension Specification](extensions/bindings.md)
- [Buildpack Registry Extension Specification](extensions/buildpack-registry.md)
- [Project Descriptor Extension Specification](extensions/project-descriptor.md)
- [Builder Extension Specification](extensions/builder.md)

## API Versions

Expand Down
3 changes: 3 additions & 0 deletions distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ Each stack ID MUST only be present once.
For a given stack, the `mixins` list MUST enumerate mixins such that no included buildpacks are missing a mixin for the stack.

Fewer stack entries as well as additional mixins for a stack entry MAY be specified.

### Builders
Buildpacks may be distributed using builders, described in the [builder extension spec](extensions/builder.md).
145 changes: 145 additions & 0 deletions extensions/builder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Builder
dfreilich marked this conversation as resolved.
Show resolved Hide resolved

A **builder** is an image that MUST contain an implementation of the lifecycle, and build-time environment, and MAY contain buildpacks. Platforms SHOULD use builders to ease the build process.
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
hone marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording here still feels a bit awkward to me. However it also seems like a repetition of the first section. Maybe instead of word smithing we should just remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you dislike the first sentence?

I do think the second sentence the "SHOULD" probably is a "MAY".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a suggestion

dfreilich marked this conversation as resolved.
Show resolved Hide resolved

## Table of Contents

dfreilich marked this conversation as resolved.
Show resolved Hide resolved
## Required File/Directories
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
A builder MUST have the following directories/files:
- `/cnb/order.toml` → As defined in the [platform specification][order-toml-spec]
- `/cnb/stack.toml` → As defined in the [platform specification][stack-toml-spec]
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
- `/cnb/lifecycle/<lifecycle binaries>` &rarr; An implementation of the lifecycle, which contains the required lifecycle binaries for [building images][lifecycle-for-build].

In addition, every buildpack blob contained on a builder MUST be stored at the following file path:
- `/cnb/buildpacks/...<buildpack ID>/<buildpack version>/`
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
dfreilich marked this conversation as resolved.
Show resolved Hide resolved

## Environment Variables/Labels
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
A builder's environment is the build-time environment of the stack, and as such, MUST fulfill all of the [build image specifications][build-image-specs].
dfreilich marked this conversation as resolved.
Show resolved Hide resolved

The following variables MUST be set in the builder environment (through the image config's `Env` field):
dfreilich marked this conversation as resolved.
Show resolved Hide resolved

| Env Variable | Description
|-----------------|--------------------------------------
| `WorkingDir` | The working directory where buildpacks should default (eg: `/workspace`)
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
| `CNB_APP_DIR` | Application directory of the build environment (eg: `/app`)
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
| `CNB_LAYERS_DIR` | The directory to create and store `layers` in the build environment (eg: `/layers`)
| `CNB_PLATFORM_DIR` | The directory to create and store platform focused files in the build environment (eg: `/platform`)

The following variables MAY be set in the builder environment (through the image config's `Env` field):
dfreilich marked this conversation as resolved.
Show resolved Hide resolved

| Env Variable | Description
|-----------------|--------------------------------------
| `SERVICE_BINDING_ROOT` | The directory where services are bound

The following labels MUST be set in the builder environment (through the image config's `Labels` field):
dfreilich marked this conversation as resolved.
Show resolved Hide resolved

| Env Variable | Description
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
|-----------------|--------------------------------------
| `io.buildpacks.builder.api` | The Builder API this builder implements (at this point, **0.1**)
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
| `io.buildpacks.builder.metadata` | A JSON object representing [Builder Metadata](#iobuildpacksbuildermetadata)
| `io.buildpacks.buildpack.order` | A JSON object representing the [order of the buildpacks stored on the builder](#iobuildpacksbuildpackorder)
| `io.buildpacks.buildpack.layers` | A JSON object representing the [buildpack layers](#iobuildpacksbuildpacklayers)
| `io.buildpacks.lifecycle.version` | A string, representing the version of the lifecycle stored in the builder (greater than `0.9.0`)
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
| `io.buildpacks.lifecycle.apis` | A JSON object representing the [lifecycle APIs](#iobuildpackslifecycleapis) the lifecycle stored in the builder supports
dfreilich marked this conversation as resolved.
Show resolved Hide resolved

dfreilich marked this conversation as resolved.
Show resolved Hide resolved
### `io.buildpacks.builder.metadata`
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
The `io.buildpacks.builder.metadata` data should look like:
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
```json
{
"description": "<Some description>",
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
"stack": {
"runImage": {
"image": "<some/run-image>",
"mirrors": [
"<gcr.io/some/default>"
]
}
},
"buildpacks": [
{
"id": "<buildpack id>",
"version": "<buildpack version>",
"homepage": "http://geocities.com/top-bp"
}
],
"createdBy": {
"name": "<creator of builder>",
"version": "<version of tool used to create builder>"
}
}
```

### `io.buildpacks.buildpack.order`
The `io.buildpacks.buildpack.order` data MUST look like:
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
```json
[
{
"group":
[
{
"id": "<buildpack id>",
"version": "<buildpack version>",
"optional": "<bool>"
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
]
```

### `io.buildpacks.buildpack.layers`
The `io.buildpacks.buildpack.layers` data should look like:
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
```json
{
"<buildpack id>": {
"<buildpack version>": {
"api": "<buildpack API>",
"order": [
{
"group": [
{
"id": "<inner buildpack>",
"version": "<inner bulidpacks version>"
}
]
}
],
"layerDiffID": "sha256:test.nested.sha256",
"homepage": "http://geocities.com/top-bp"
}
},
"<inner buildpack>": {
"<inner buildpacks version>": {
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
"api": "<buildpack API>",
"stacks": [
{
"id": "<stack ID buildpack supports>",
"mixins": ["<list of mixins required>"]
dfreilich marked this conversation as resolved.
Show resolved Hide resolved
}
],
"layerDiffID": "sha256:test.bp.one.sha256",
"homepage": "http://geocities.com/cool-bp"
}
}
}
```

### `io.buildpacks.lifecycle.apis`
The `io.buildpacks.lifecycle.apis` data should look like:
```json
{
"buildpack": {
"deprecated": ["<list of versions>"],
"supported": ["<list of versions>"]
},
"platform": {
"deprecated": ["<list of versions>"],
"supported": ["<list of versions>"]
}
}
```

[//]: <> (Links)
[build-image-specs]: https://github.com/buildpacks/spec/blob/main/platform.md#build-image
[order-toml-spec]: https://github.com/buildpacks/spec/blob/main/platform.md#ordertoml-toml
[stack-toml-spec]: https://github.com/buildpacks/spec/blob/main/platform.md#stacktoml-toml
[lifecycle-for-build]: https://github.com/buildpacks/spec/blob/main/platform.md#build
2 changes: 2 additions & 0 deletions platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ The platform SHOULD ensure that:
- The image config's `Label` field has the label `io.buildpacks.stack.description` set to the description of the stack.
- The image config's `Label` field has the label `io.buildpacks.stack.metadata` set to additional metadata related to the stack.

A Stack build image MAY be a [valid builder](extensions/builder.md)
dfreilich marked this conversation as resolved.
Show resolved Hide resolved

### Run Image

The platform MUST ensure that:
Expand Down