-
Notifications
You must be signed in to change notification settings - Fork 71
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
RFC for build environment variables #293
Open
kappratiksha
wants to merge
1
commit into
buildpacks:main
Choose a base branch
from
kappratiksha:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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,96 @@ | ||
# Meta | ||
[meta]: #meta | ||
- Name: Support for env vars in creator | ||
- Start Date: 2023-09-07 | ||
- Author(s): [kappratiksha](https://github.com/kappratiksha) | ||
- Status: Draft | ||
- RFC Pull Request: (leave blank) | ||
- CNB Pull Request: (leave blank) | ||
- CNB Issue: (leave blank) | ||
- Supersedes: N/A | ||
|
||
# Summary | ||
[summary]: #summary | ||
|
||
Add a flag for passing the build time env variables to buildpacks when invoking creator | ||
|
||
# Definitions | ||
[definitions]: #definitions | ||
|
||
N/A | ||
|
||
# Motivation | ||
[motivation]: #motivation | ||
|
||
When invoking the creator process, there is no way to pass build time environment variables to the buildpacks other than creating the files under /platform/env folder. This adds an extra step for the authors when implementing their buildpack. Adding a new flag to the creator process will simplify the process of setting the environment variables. | ||
|
||
We already have something similar for the [pack cli tool](https://buildpacks.io/docs/tools/pack/cli/pack_build/) and it proves to be very convenient. Example: | ||
|
||
``` | ||
pack build test_img --env VAR1=VALUE1 | ||
``` | ||
|
||
# What it is | ||
[what-it-is]: #what-it-is | ||
|
||
A flag that can be used by buildpack user to pass down the environment variables while invoking creator. | ||
|
||
/cnb/lifecycle/creator -env stringArray | ||
|
||
A sample use case would look like: | ||
``` | ||
/cnb/lifecycle/creator -env LANGUAGE=java -env VERSION=1.1 | ||
``` | ||
|
||
# How it Works | ||
[how-it-works]: #how-it-works | ||
|
||
|
||
Before calling the `bin\detect`, create environment variables passed down by the flag `--env` under /platform/env folder | ||
|
||
# Migration | ||
[migration]: #migration | ||
|
||
|
||
# Drawbacks | ||
[drawbacks]: #drawbacks | ||
|
||
|
||
# Alternatives | ||
[alternatives]: #alternatives | ||
|
||
|
||
# Prior Art | ||
[prior-art]: #prior-art | ||
|
||
|
||
# Unresolved Questions | ||
[unresolved-questions]: #unresolved-questions | ||
|
||
- What parts of the design do you expect to be resolved before this gets merged? | ||
This will improve the effeciency of using the build environment variables. Instead of users having to set the environment variables manually by creating the folders, they can now use the new flag. | ||
|
||
# Spec. Changes (OPTIONAL) | ||
[spec-changes]: #spec-changes | ||
This change will involve some spec changes for the new flag. | ||
|
||
# History | ||
[history]: #history | ||
|
||
<!-- | ||
## Amended | ||
### Meta | ||
[meta-1]: #meta-1 | ||
- Name: (fill in the amendment name: Variable Rename) | ||
- Start Date: (fill in today's date: YYYY-MM-DD) | ||
- Author(s): (Github usernames) | ||
- Amendment Pull Request: (leave blank) | ||
|
||
### Summary | ||
|
||
A brief description of the changes. | ||
|
||
### Motivation | ||
|
||
Why was this amendment necessary? | ||
---> |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add details on order of precedence?
E.g. If a platform spits values into
/platform/env
today, say from aproject.toml
. Theproject.toml
hasFOO=bar
. The platform decides that they always wanted to setFOO=baz
via the new-env
, what happens.