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

[.gitpod.yml] Introduce top-level env #20339

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

filiptronicek
Copy link
Member

@filiptronicek filiptronicek commented Nov 1, 2024

Description

The .gitpod.yml spec has not changed for more than 2 years! Let's break the streak.

This PR introduces the top-level env keyword to the .gitpod.yml file, defining key-value pairs of environment variables that ought to be available on workspaces created from it.

Here is an example:

image: gitpod/workspace-full

env:
  BOND: "007"

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 (this PR's addition)"| E[".gitpod.yml[env]"]
    E --> |"5"| F["User-specific environment variables"]
    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;
Loading

Related Issue(s)

Fixes CLC-874

How to test

  1. You can try starting a workspace in the preview environment based off of https://github.com/filiptronicek/test-foofies/blob/ft/envvars/.gitpod.yml.
  2. You should see $VAR populated with a value in the resulting workspace

Documentation

Yes it does. Documentation in https://github.com/gitpod-io/website/pull/4942

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants