GitHub
09/19/2025, 3:04 PMenv field to job definitions [DRAFT]
Pull request opened by cjohnhanson on <!date^1757342962^{date_short}|2025-09-08T14:49:22Z>
## Summary
Implements the data model and CLI interface for job environment variables as requested in #6386. This PR adds the ability to define environment variables on jobs but does not yet propagate them during job execution.
## Changes
• Add env field to TaskSets model (dict[str, str])
• Support YAML dict format: {tasks: [...], env: {KEY: value}}
• Add CLI parameters: --env KEY=value for job add and job set
• Job listing includes environment variables in output
• Full backward compatibility with existing job definitions
• Comprehensive test coverage following existing patterns
## TODO (before marking ready)
• Environment variable propagation during meltano run job-name
• Environment variable precedence order during execution
## Example Usage
yaml
jobs:
• name: gitlab
tasks: [dbt-postgres:seed, tap-gitlab, target-postgres]
env:
DBT_MODELS: +gitlab+
TARGET_BATCH_SIZE: "100"
bash
meltano job add my-job --tasks "tap-github target-jsonl" --env DBT_MODELS=+models+ --env BATCH_SIZE=100
Related to #6386
## Summary by Sourcery
Introduce support for environment variables on jobs by extending the TaskSets model, YAML parsing, and CLI commands to accept and display env vars while preserving backward compatibility.
New Features:
• Allow defining environment variables on jobs via the YAML env field
• Add --env KEY=value option to job add and job set commands
Enhancements:
• Extend TaskSets to include an env attribute and merge CLI-provided vars with YAML
• Update job listing (text and JSON) to include environment variables
• Enhance tasks_from_yaml_str to parse and validate env entries in dict format
• Modify TaskSetsService update logic to fully replace jobs (including env) for correct persistence
Tests:
• Add CLI tests for adding, setting, and listing jobs with environment variables
• Add core tests for parsing and validating env in TaskSets
• Add service tests to verify storage and retrieval of job env vars
meltano/meltanoGitHub
09/19/2025, 3:04 PMenv field to job definitions [DRAFT]
Pull request closed by cjohnhanson
meltano/meltano