Skip to content

Commit 8fc7a70

Browse files
committed
Changes based on WG feedback
Signed-off-by: Javier Romero <rjavier@vmware.com>
1 parent 99fc145 commit 8fc7a70

File tree

1 file changed

+83
-72
lines changed

1 file changed

+83
-72
lines changed

text/0000-prepare-operation.md

Lines changed: 83 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# Summary
1313
[summary]: #summary
1414

15+
It is common for platform to execute common operations before executing the lifecycle. These sort of operations include, downloading buildpacks, making changes the the `order.toml`, cleaning up the workspace, and more. These operations are typically influenced by configuration. One of those common configuration inputs is the `project.toml` (aka Project Descriptor). This RFC, proposes a contractual interface for a Prepare operation that is executed before the Build operation. The benefits for doing so are it enables common functionality to be made portable. Additionally, it allows the project to provide guidance on what the expected behaviour is regarding input configuration such as the `project.toml`.
1516

1617
# Definitions
1718
[definitions]: #definitions
@@ -63,12 +64,11 @@ Therefore the following changes have been made from the [latest schema][pd-02]:
6364

6465
### Version `io.buildpacks` namespace
6566

66-
Given that the project descriptor's `io.buildpacks` namespace is directly tied to the platform by the fact that it's the platform that needs to consume and parse it, it makes sense to unify the version of the schema with that of the platform API.
67-
67+
The `io.buildpacks` namespace schema should be able to change without changing the Project Descriptor spec. For this reason, the namespace should define a `schema-version`.
6868

6969
### Schema
7070

71-
See [Platform Spec changes](#Platform-Spec).
71+
See [`io.buildpacks` Namespace Schema](#io-buildpacks-Namespace-Schema) section below.
7272

7373
#### Usages Examples
7474

@@ -166,7 +166,6 @@ The default implementation COULD take care of applying the following configurati
166166
- This is mitigated by providing [utilities](#Cloud-Native-Buildpacks-utilities) and the fact that the prepare phase is an independant and swappable.
167167
2. Executing the Prepare operation may require an additional container to be spun up in some platforms; this would effectively increase the overall build process.
168168

169-
170169
# Alternatives
171170
[alternatives]: #alternatives
172171

@@ -205,6 +204,8 @@ The idea of a buildpack that can apply configuration from `project.toml` has bee
205204
- Should arbitrary properties be allowed in `io.buildpacks.defaults`?
206205
- How does the Prepare operation make changes to non-filesystem options such as `tags`, `run-image`, etc?
207206
- Ideally, the lifecycle would have a filesystem based interface that we can leverage. This would prevent the preparer from having it's own independant mechanism. A prior RFC for something similar has existed (see [Add Lifecycle Config File RFC][lifecycle-config-rfc]). It may be worth revisiting.
207+
- Where do we define the `io.buildpacks` namespace if we want to keep it seperate from the Project Descriptor Spec?
208+
- We've been wanting to restructure our spec repo to include other schemas, in JSON format, as well. Maybe this is an opportunity to rethink our repo structure.
208209

209210
[lifecycle-config-rfc]: https://github.com/buildpacks/rfcs/pull/128
210211

@@ -217,7 +218,7 @@ No changes necessary.
217218

218219
## Platform Spec
219220

220-
### Add Project Descriptor `io.buildpacks` namespace
221+
### Add Project Descriptor
221222

222223
---
223224

@@ -227,72 +228,6 @@ The format of `project.toml` MUST adhere to version `0.2` of the [project descri
227228

228229
[project-descriptor-spec]: https://github.com/buildpacks/spec/blob/main/extensions/project-descriptor.md
229230

230-
##### `io.buildpacks` namespace
231-
232-
```toml
233-
[io.buildpacks]
234-
schema-version = "<platform API version>"
235-
236-
[io.buildpacks.defaults]
237-
include = ["<.gitignore pattern>"]
238-
exclude = ["<.gitignore pattern>"]
239-
240-
[[io.buildpacks.defaults.pre.group]]
241-
id = "<buildpack ID>"
242-
version = "<buildpack version>"
243-
uri = "<url or path to the buildpack"
244-
245-
[io.buildpacks.defaults.pre.group.script]
246-
api = "<buildpack API version>"
247-
shell = "<string>"
248-
inline = "<script contents>"
249-
250-
[[io.buildpacks.defaults.group]]
251-
id = "<buildpack ID>"
252-
version = "<buildpack version>"
253-
uri = "<url or path to the buildpack"
254-
255-
[io.buildpacks.defaults.group.script]
256-
api = "<buildpack API version>"
257-
shell = "<string>"
258-
inline = "<script contents>"
259-
260-
[[io.buildpacks.defaults.post.group]]
261-
id = "<buildpack ID>"
262-
version = "<buildpack version>"
263-
uri = "<url or path to the buildpack"
264-
265-
[io.buildpacks.defaults.post.group.script]
266-
api = "<buildpack API version>"
267-
shell = "<string>"
268-
inline = "<script contents>"
269-
270-
[[io.buildpacks.defaults.build.env]]
271-
name = "<name>"
272-
value = "<value>"
273-
```
274-
275-
Where:
276-
277-
- `schema-version` (required): is the version of the schema which correlates with the platform API.
278-
- `defaults` (optional): is a table of default properties that all platforms should apply.
279-
_`include` and `exclude` are mutually exclusive. If both are present the build process MUST result in an error._
280-
- `include` (optional): is an array of `.gitignore` pattern-based paths to include during the build operation.
281-
- `exclude` (optional): is an array of `.gitignore` pattern-based paths to exclude from the build operation and thereby produced image.
282-
- `group` (optional): is an array of buildpacks.
283-
_Either a `version`, `uri`, or `script` table MUST be included, but MUST NOT include any combination of these elements._
284-
- `id` (optional): is the ID of the buildpack.
285-
- `version` (optional, default=`latest`): is the version of the buildpack.
286-
- `uri` (optional, default=`urn:buildpack:<id>`): is the URI to the buildpack.
287-
- `script` (optional): defines an inline buildpack.
288-
- `api` (required): is the api key defines its Buildpack API compatibility.
289-
- `shell` (optional, default=`/bin/sh`): defines the shell used to execute the inline script.
290-
- `inline` (required): is the build script for the inline buildpack.
291-
- `build` (optional):
292-
- `env` (optional): an array table that defines environment variables to be applied during the `build` phase.
293-
- `name` (required): is the name of the environment variable.
294-
- `value` (required): is the value of the environment variable.
295-
296231
---
297232

298233
### Add Prepare operation
@@ -371,4 +306,80 @@ A `preparer` may make general changes to the file system, modify input files, or
371306

372307
#### Remove `io.buildpacks` namespace
373308

374-
We'll want to remove the `io.buildpacks` namespace since it will now be defined in the Platform spec.
309+
We'll want to remove the `io.buildpacks` namespace since it will now be defined in the Platform spec.
310+
311+
---
312+
313+
## `io.buildpacks` Namespace Schema
314+
315+
> NOTE: This is expected to live in a seperate file.
316+
317+
---
318+
319+
##### `io.buildpacks` namespace
320+
321+
```toml
322+
[io.buildpacks]
323+
schema-version = "0.2"
324+
325+
[io.buildpacks.defaults]
326+
include = ["<.gitignore pattern>"]
327+
exclude = ["<.gitignore pattern>"]
328+
329+
[[io.buildpacks.defaults.pre.group]]
330+
id = "<buildpack ID>"
331+
version = "<buildpack version>"
332+
uri = "<url or path to the buildpack"
333+
334+
[io.buildpacks.defaults.pre.group.script]
335+
api = "<buildpack API version>"
336+
shell = "<string>"
337+
inline = "<script contents>"
338+
339+
[[io.buildpacks.defaults.group]]
340+
id = "<buildpack ID>"
341+
version = "<buildpack version>"
342+
uri = "<url or path to the buildpack"
343+
344+
[io.buildpacks.defaults.group.script]
345+
api = "<buildpack API version>"
346+
shell = "<string>"
347+
inline = "<script contents>"
348+
349+
[[io.buildpacks.defaults.post.group]]
350+
id = "<buildpack ID>"
351+
version = "<buildpack version>"
352+
uri = "<url or path to the buildpack"
353+
354+
[io.buildpacks.defaults.post.group.script]
355+
api = "<buildpack API version>"
356+
shell = "<string>"
357+
inline = "<script contents>"
358+
359+
[[io.buildpacks.defaults.build.env]]
360+
name = "<name>"
361+
value = "<value>"
362+
```
363+
364+
Where:
365+
366+
- `schema-version` (required): is the version of the schema.
367+
- `defaults` (optional): is a table of default properties that all platforms should apply.
368+
_`include` and `exclude` are mutually exclusive. If both are present the build process MUST result in an error._
369+
- `include` (optional): is an array of `.gitignore` pattern-based paths to include during the build operation.
370+
- `exclude` (optional): is an array of `.gitignore` pattern-based paths to exclude from the build operation and thereby produced image.
371+
- `group` (optional): is an array of buildpacks.
372+
_Either a `version`, `uri`, or `script` table MUST be included, but MUST NOT include any combination of these elements._
373+
- `id` (optional): is the ID of the buildpack.
374+
- `version` (optional, default=`latest`): is the version of the buildpack.
375+
- `uri` (optional, default=`urn:buildpack:<id>`): is the URI to the buildpack.
376+
- `script` (optional): defines an inline buildpack.
377+
- `api` (required): is the api key defines its Buildpack API compatibility.
378+
- `shell` (optional, default=`/bin/sh`): defines the shell used to execute the inline script.
379+
- `inline` (required): is the build script for the inline buildpack.
380+
- `build` (optional):
381+
- `env` (optional): an array table that defines environment variables to be applied during the `build` phase.
382+
- `name` (required): is the name of the environment variable.
383+
- `value` (required): is the value of the environment variable.
384+
385+
---

0 commit comments

Comments
 (0)