[.gitpod.yml] Introduce top-level env
#20339
Merged
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.
Description
The
.gitpod.ymlspec has not changed for more than 2 years! Let's break the streak.This PR introduces the top-level
envkeyword to the.gitpod.ymlfile, defining key-value pairs of environment variables that ought to be available on workspaces created from it.Here is an example:
Simple enough. The funny part comes when you try to plug this approach into our existing approaches for setting environment variables.
graph TD A["Environment Variable Overriding in Gitpod Workspaces"] A --> |"1 (Highest Priority)"| B[".gitpod.yml[tasks][n][env]"] B --> |"2"| C["Environment variables passed via the context URL"] C --> |"3"| D["Repository-specific environment variables"] D --> |"4"| E["User-specific environment variables"] E --> |"5 (this PR's addition)"| F[".gitpod.yml[env]"] F --> |"6 (Lowest Priority)"| G["Image's environment variables (e.g., ENV in Dockerfile)"] style A fill:#f9f9f9,stroke:#333,stroke-width:2px; style B fill:#f2f2f2,stroke:#3a86ff,stroke-width:2px; style C fill:#f2f2f2,stroke:#8338ec,stroke-width:2px; style D fill:#f2f2f2,stroke:#ff006e,stroke-width:2px; style E fill:#f2f2f2,stroke:#fb5607,stroke-width:2px; style F fill:#f2f2f2,stroke:#ffbe0b,stroke-width:2px; style G fill:#f2f2f2,stroke:#00a676,stroke-width:2px;Related Issue(s)
Fixes CLC-874
How to test
$VARpopulated with a value in the resulting workspaceThis PR also updates tests
Documentation
Yes it does. Documentation in https://github.com/gitpod-io/website/pull/4942