-
Notifications
You must be signed in to change notification settings - Fork 6
Inject build parameters into local commands (env run / env shell) #199
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Area
Configuration (parameters, projects)
Problem or use case
When developing locally, developers often need access to the same environment variables and parameters that their TeamCity build configurations use. Today, the only way to get these values is to manually copy them from the UI or API, which is tedious and error-prone.
Modern CI/CD CLIs solve this elegantly:
- Railway:
railway run npm startinjects project env vars into a local command;railway shellopens a subshell with vars loaded - Vercel:
vercel env pull .env.localdownloads env vars to a file;vercel env run -- make testinjects them without writing to disk
TeamCity has rich parameter support (build parameters, system properties, environment variables) but no CLI path to use them locally.
Proposed solution
Two complementary commands:
teamcity job env <job> -- <command>
Fetches parameters from a build configuration and injects them as environment variables into a local command.
# Run local tests with the same env vars as CI
teamcity job env MyProject_Build -- make test
# Run with a specific branch's parameters
teamcity job env MyProject_Build --branch main -- npm startteamcity job env <job> --export
Prints parameters in a format suitable for shell eval or .env file:
# Export to .env file
teamcity job env MyProject_Build --export > .env
# Eval into current shell
eval $(teamcity job env MyProject_Build --export --format shell)Behavior
- Only inject parameters of type
env.by default (TeamCity env vars) --include-systemto also includesystem.properties--include-configto include configuration parameters- Respect
--jsonfor structured output - Warn (don't error) if a parameter is marked as a password/secret and skip it by default
--allow-secretsflag to explicitly include secret values (requires confirmation unless--no-input)
Alternatives considered
- Users can script this today with
teamcity api+jq, but it's fragile and doesn't handle parameter resolution or secret filtering - A
.envexport-only approach (no-- <command>execution) is simpler but less ergonomic — Railway proved thatrunis the killer feature
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request