Add getenv builtin to os plugin#40
Open
badcount wants to merge 2 commits into
Open
Conversation
Exposes os.getenv(key, default=None) in Starlark so workflow code can read individual keys from the environ dict injected by the PipelineRun spec.input.environ, without having to access the full environ dict. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Code Review ✅ ApprovedAdds the os.getenv builtin to the os plugin to provide a more ergonomic way to access environment variables. No issues found. Rules ❌ No requirements metRepository Rules
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed?
A new Starlark builtin os.getenv(key, default=None) that lets workflow code read a single key from the environ dict, without having to grab the full os.environ map and index
into it.
Why?
The environ property already exposed the whole dict, but callers wanting a single key had to write os.environ.get("FOO", default) or os.environ["FOO"]. os.getenv("FOO",
default) mirrors Python's os.getenv and is more ergonomic for the common single-key case. The environ data comes from PipelineRun spec.input.environ.
Surface impact
How did you test it?
Unit test and end to end run
Potential risks
Release notes
Documentation Changes