forked from buildpacks/rfcs
-
Notifications
You must be signed in to change notification settings - Fork 0
make ready "Project TOML Converter RFC" #2
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
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
4f86735
draft
haliliceylan 58430fc
last
haliliceylan c0bb4dd
Update text/0000-project-toml-converter.md
haliliceylan b2f1208
CNB_PLATFORM_API
haliliceylan e9ca776
motivation prepare phase
haliliceylan a1b999f
motivation paraphraph 2
haliliceylan b62b489
What it is
haliliceylan ac955ab
natalie author
haliliceylan 3e93262
project toml example
haliliceylan 9c6a10c
Merge branch 'project-toml-converter' of github.com:haliliceylan/rfcs…
haliliceylan 5c219d9
some changes
haliliceylan 286fa8c
Update text/0000-project-toml-converter.md
haliliceylan 76431d3
Update text/0000-project-toml-converter.md
haliliceylan f2fa00f
Update text/0000-project-toml-converter.md
haliliceylan 2abe5fe
Update text/0000-project-toml-converter.md
haliliceylan 91595c8
Apply suggestions from code review
haliliceylan 02de1f1
update project toml
haliliceylan a6e9316
platform schema
haliliceylan 84a4a6b
Merge branch 'project-toml-converter' of github.com:haliliceylan/rfcs…
haliliceylan a42a290
Update text/0000-project-toml-converter.md
haliliceylan 9f5a350
Update text/0000-project-toml-converter.md
haliliceylan 500de41
Update text/0000-project-toml-converter.md
haliliceylan 27ba4d8
last feedback
haliliceylan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| # Meta | ||
| [meta]: #meta | ||
| - Name: Project TOML Converter | ||
| - Start Date: 10 Aug 2021 | ||
| - Author(s): haliliceylan, natalieparellano | ||
| - RFC Pull Request: (leave blank) | ||
| - CNB Pull Request: (leave blank) | ||
| - CNB Issue: (leave blank) | ||
| - Supersedes: N/A | ||
|
|
||
| # Summary | ||
| [summary]: #summary | ||
|
|
||
| The idea is to ship a binary with the lifecycle that would be responsible for translating project.toml from the schema defined in the project descriptor extension spec into something that the lifecycle knows the platform can understand i.e., a schema defined in the platform spec. | ||
|
|
||
| # Definitions | ||
| [definitions]: #definitions | ||
|
|
||
| * __project descriptor__ - a file that is included in the application directory to configure various behavior related to buildpacks; for more information, see the [`project.toml`](https://github.com/buildpacks/spec/blob/main/extensions/project-descriptor.md) extension specification | ||
|
|
||
| * __CNB_PLATFORM_API__ The Project TOML Converter will use the `CNB_PLATFORM_API` environment variable to decide the target schema. The `CNB_PLATFORM_API` environment variable is set by the platform in the lifecycle's execution environment. Version 0.3 is assumed if it is not set. | ||
|
|
||
| # Motivation | ||
| [motivation]: #motivation | ||
|
|
||
| - This feature has similarities with the "prepare" phase that has been discussed previously (see #555). But it is much smaller in scope. Potentially, the binary described in this RFC could eventually take on more responsibilities and look more like "prepare". But that is out of scope for this RFC. | ||
|
|
||
| - Project Descriptor (aka project.toml) is a file which describes behavior related to buildpacks. It is non-trivial for platform operators to upgrade support for different versions of project.toml. So with this feature we are giving to developers the ability to use any version of project.toml knowing that the platform can always support it. At the same time we are giving to operators the convenience of only having to know about one schema at a time for project.toml. | ||
|
|
||
| - What is the expected outcome? | ||
|
|
||
| # What it is | ||
| [what-it-is]: #what-it-is | ||
|
|
||
| The Project TOML Converter is a CLI tool that will ship alongside the lifecycle. It has only one responsibility at this time, to support conversion between schemas. | ||
|
|
||
| # How it Works | ||
| [how-it-works]: #how-it-works | ||
|
|
||
| Example Project.TOML with 0.1 schema | ||
| ``` | ||
| [project] | ||
| id = "<string>" # machine readable | ||
| name = "<string>" # human readable | ||
| version = "<string>" | ||
| authors = ["<string>"] | ||
| documentation-url = "<url>" | ||
| source-url = "<url>" | ||
|
|
||
| [[project.licenses]] | ||
| type = "<string>" | ||
| uri = "<uri>" | ||
|
|
||
| [build] | ||
| include = ["<string>"] | ||
| exclude = ["<string>"] | ||
| [[build.buildpacks]] | ||
| id = "<string>" | ||
| version = "<string>" | ||
| uri = "<string>" | ||
| [[build.env]] | ||
| name = "<string>" | ||
| value = "<string>" | ||
| [metadata] | ||
| # additional arbitrary keys allowed | ||
| ``` | ||
|
|
||
|
|
||
| Example Project.TOML with 0.2 schema | ||
| ```` | ||
| [_] | ||
| id = "io.buildpacks.my-app" | ||
| version = "0.1" | ||
|
|
||
| [_.metadata] | ||
| cdn = "https://cdn.example.com" | ||
|
|
||
| [[_.metadata.assets]] | ||
| url = "https://cdn.example.com/assets/foo.jar" | ||
| checksum = "3b1b39893d8e34a6d0bd44095afcd5c4" | ||
|
|
||
| buzz = ["a", "b", "c"] | ||
|
|
||
| [io.buildpacks] | ||
| builder = "cnbs/sample-builder:bionic" | ||
| include = [ | ||
haliliceylan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "cmd/", | ||
| "go.mod", | ||
| "go.sum", | ||
| "*.go" | ||
| ] | ||
|
|
||
| [[io.buildpacks.group]] | ||
| id = "io.buildpacks/java" | ||
| version = "1.0" | ||
|
|
||
| [[io.buildpacks.group]] | ||
| id = "io.buildpacks/nodejs" | ||
| version = "1.0" | ||
|
|
||
haliliceylan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| [[io.buildpacks.group]] | ||
| id = "example/post-build" | ||
|
|
||
| [io.buildpacks.group.script] | ||
| api = "0.5" | ||
| inline = "./post-build.sh" | ||
| ``` | ||
|
|
||
| # Drawbacks | ||
| [drawbacks]: #drawbacks | ||
|
|
||
| Why should we *not* do this? | ||
haliliceylan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - Another binary to maintain | ||
|
|
||
| # Alternatives | ||
| [alternatives]: #alternatives | ||
|
|
||
| - Having the lifecycle process project.toml directly (like prepare phase see: #555). This RFC is only focusing on the upgrade problem so that it can be done quickly. | ||
| - Do nothing, hope everything will be fine (we can leave as it is). We think it's too hard for platform operators to support multiple versions of project.toml. | ||
| - Having the translator binary translate from e.g., project.toml schema 0.1 -> project.toml schema 0.2. The platform API already represents the contract between the lifecycle and the platform, so it makes more sense than "project descriptor schema -> project descriptor schema" translation.. | ||
|
|
||
| # Prior Art | ||
| [prior-art]: #prior-art | ||
|
|
||
| Discuss prior art, both the good and bad. | ||
|
|
||
| # Unresolved Questions | ||
| [unresolved-questions]: #unresolved-questions | ||
|
|
||
| - What will the platform schema for project.toml look like? | ||
| - Out of scope: parts of project.toml that aren't relevant to the platform api (like setting env vars) | ||
|
|
||
| # Spec. Changes (OPTIONAL) | ||
| The new platform schema could look something like: | ||
| ``` | ||
| [project] | ||
| id = "<string>" | ||
| version = "<string>" | ||
|
|
||
| [build] | ||
| builder = "cnbs/sample-builder:bionic" | ||
| include = ["<string>"] | ||
| exclude = ["<string>"] | ||
|
|
||
| [[build.buildpacks]] | ||
| id = "io.buildpacks/java" | ||
| version = "1.0" | ||
|
|
||
| [metadata] | ||
| # all metadatas here | ||
| ``` | ||
|
|
||
| *Here are the namespace conversions* | ||
|
|
||
| For conversion to/from v0.1 | ||
| ``` | ||
| project = project | ||
| build = build | ||
| build.buildpacks = build.buildpacks | ||
| metadata = metadata | ||
| ``` | ||
|
|
||
| For conversion to/from v0.2: | ||
|
|
||
| ``` | ||
| project = _ | ||
| build = io.buildpacks | ||
| build.buildpacks = io.buildpacks.group | ||
| metadata = _.metadata | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.