Skip to content

Adding context option to command line - #172

Open
russellseymour wants to merge 3 commits into
mainfrom
feat/task-cli-context
Open

russellseymour wants to merge 3 commits into
mainfrom
feat/task-cli-context

Conversation

@russellseymour

Copy link
Copy Markdown
Collaborator

📲 What

This change adds support for two command-line overrides that make task testing safer and more flexible when working with temporary or uncommitted config:

  • eirctl run --import can load additional config files at runtime and merge them into the active configuration, with imported entries taking precedence on name clashes.
  • eirctl run ... --context overrides the context assigned to a task for a single invocation, without requiring the tracked config file to be edited.

This is intended to support testing tasks in alternate contexts or with local config overlays while keeping the checked-in configuration unchanged.

🤔 Why

When a task needs to be validated in another execution context, or when a developer wants to try a local override without committing it to the repo, the command-line interface previously offered no clean way to do so.

The result was friction in local development and a higher risk of accidentally persisting temporary configuration changes. The update keeps runtime overrides explicit and scoped to a single invocation.

🛠 How

  • Added repeatable --import support to the eirctl run flow, merging imported config files into the current config with override precedence.
  • Added --context handling for task execution so the selected task can run with an alternate context for that invocation only.
  • Guarded against using --context when executing pipelines, returning a clear validation error.
  • Added CLI regression coverage for import precedence and context override behavior.
  • Updated the user documentation to describe both features.

👀 Evidence

  • Added command coverage in cmd/eirctl/run_test.go
  • Added CLI import override fixture: cmd/eirctl/testdata/cli-import-override.yaml
  • Updated docs: docs/import.adoc, docs/tasks.adoc

🕵️ How to test

# Override the task context for one invocation

eirctl run task task:context:override --context context:env --raw

# Merge an additional config file at runtime

eirctl run task task:from:cli:import --import testdata/cli-import-override.yaml --raw

# Run the focused command test suite

go test ./cmd/eirctl/...

Expected result:

  • the task runs using the overridden context
  • imported tasks/contexts become available without changing the base config
  • the relevant CLI tests pass

✅ Acceptance criteria checklist

  • Linked the related issue or explained why one is not needed.
  • Added or updated tests, or explained why tests are not applicable.
  • Updated documentation, examples, schemas, or release notes where applicable.
  • Ran the relevant linting, test, and validation checks successfully.
  • Checked that the change does not expose secrets or weaken security controls.
  • Rebased or merged the latest main and re-tested where needed.
  • Confirmed the change meets the repository coding standards.

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