Skip to content

Add getenv builtin to os plugin#40

Open
badcount wants to merge 2 commits into
cadence-workflow:mainfrom
badcount:badcount/sw-os
Open

Add getenv builtin to os plugin#40
badcount wants to merge 2 commits into
cadence-workflow:mainfrom
badcount:badcount/sw-os

Conversation

@badcount
Copy link
Copy Markdown
Contributor

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

  • Public Starlark API: new function os.getenv.
  • Go API: unchanged exports — _getenv and environ are unexported; only the Module and the Plugin registration are public.
  • Behavioral compatibility: purely additive; os.environ still works the same way.

How did you test it?
Unit test and end to end run

Potential risks

Release notes

Documentation Changes

badcount and others added 2 commits May 14, 2026 10:04
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>
@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented May 14, 2026

Code Review ✅ Approved

Adds the os.getenv builtin to the os plugin to provide a more ergonomic way to access environment variables. No issues found.

Rules ❌ No requirements met

Repository Rules

PR Description Quality Standards: The [How did you test it?] section is vague, and [Potential risks], [Release notes], and [Documentation Changes] sections are empty without even 'N/A' placeholders.
Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant