Add GCL_VARIABLE_<name> env var support, replace yargs .env("GCL")#1805
Add GCL_VARIABLE_<name> env var support, replace yargs .env("GCL")#1805
Conversation
Allows injecting individual CI/CD variables via environment variables prefixed with GCL_VARIABLE_, e.g. GCL_VARIABLE_MY_VAR=hello.
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/test-cases/gcl-variable-env/integration.test.ts">
<violation number="1" location="tests/test-cases/gcl-variable-env/integration.test.ts:89">
P2: This integration test bypasses the `GCL_VARIABLE_*` code path by passing `variable` directly, so it would not catch a regression in env-var injection.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Sets process.env instead of passing variable array directly to handler, so the test covers the actual injection code path.
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/test-cases/gcl-variable-env/integration.test.ts">
<violation number="1" location="tests/test-cases/gcl-variable-env/integration.test.ts:84">
P1: This test should not run concurrently while it mutates `process.env`; the shared global env can leak into other tests and cause nondeterministic failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Removes yargs .env("GCL") which blocked GCL_VARIABLE_* env vars via
strictOptions. Env vars are now derived from yargs option metadata, so
option names are defined once. Array options split on semicolons,
naturally supporting GCL_VARIABLE=A=1;B=2 bulk format.
Integration test now uses subprocess with isolated env instead of
mutating process.env.
There was a problem hiding this comment.
3 issues found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/argv.ts">
<violation number="1" location="src/argv.ts:46">
P1: Applying `GCL_*` values after `yargs.parse()` bypasses yargs validation and coercion for env-provided options.</violation>
<violation number="2" location="src/argv.ts:68">
P2: This default-value comparison lets `GCL_*` override an explicit CLI flag when the CLI value equals the option's default.</violation>
</file>
<file name="src/index.ts">
<violation number="1" location="src/index.ts:45">
P2: Injecting `GCL_*` values only inside the main handler regresses shell completion, because the `.completion(...)` path never sees those env-backed options.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…support - Fix TS2559 by widening injectGclVariableEnvVars parameter type - Fix TS2551 by using type assertion for yargs internal getOptions() - Use yargs parsed.defaulted to correctly detect CLI-explicit values, ensuring CLI always takes precedence over GCL_ env vars even when the CLI value matches the option default - Inject GCL env vars in completion callback so GCL_CWD etc. work during tab completion - Add 12 unit tests for injectGclEnvVars
Keep yargs .env("GCL") + .strictOptions() for standard options so that
validation, coercion, precedence, and unknown-option rejection all work
as before. Strip GCL_VARIABLE_* entries from process.env before yargs
sees them (avoiding strictOptions conflict), then inject them into
argv.variable in the handler.
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/argv.ts">
<violation number="1" location="src/argv.ts:30">
P2: `GCL_VARIABLE_` (empty suffix) is not stripped from `env`, so yargs env parsing can still see an unexpected `GCL_VARIABLE_*` key.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
…dVars tests Always delete GCL_VARIABLE_* entries from process.env before yargs parses, including the bare GCL_VARIABLE_ key, so strictOptions() does not reject it. Add tests for Argv.ignorePredefinedVars getter.
There was a problem hiding this comment.
2 issues found across 3 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/argv.ts">
<violation number="1">
P2: `ignorePredefinedVars` can now be a string at runtime, causing substring-based whitelist checks instead of exact key matching.</violation>
</file>
<file name="src/index.ts">
<violation number="1">
P2: The coerce callback assumes a string, but yargs can pass an array for repeated flags; this can crash with `v.split is not a function`.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
This MR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---|---|---| | [npm:gitlab-ci-local](https://github.com/firecow/gitlab-ci-local) | `4.67.2` → `4.70.0` |  |  |  |  | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>firecow/gitlab-ci-local (npm:gitlab-ci-local)</summary> ### [`v4.70.0`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.70.0) [Compare Source](firecow/gitlab-ci-local@4.69.0...4.70.0) #### What's Changed - Add `GCL_VARIABLE_<name>` env var support, replace `yargs .env("GCL")` by [@​firecow](https://github.com/firecow) in [#​1805](firecow/gitlab-ci-local#1805) - fix: prefix rsync paths with ./ by [@​ednxzu](https://github.com/ednxzu) in [#​1801](firecow/gitlab-ci-local#1801) - chore(deps): update all non-major by [@​renovate](https://github.com/renovate)\[bot] in [#​1802](firecow/gitlab-ci-local#1802) - chore(deps): lock file maintenance by [@​renovate](https://github.com/renovate)\[bot] in [#​1798](firecow/gitlab-ci-local#1798) #### New Contributors - [@​ednxzu](https://github.com/ednxzu) made their first contribution in [#​1801](firecow/gitlab-ci-local#1801) **Full Changelog**: <firecow/gitlab-ci-local@4.69.0...4.70.0> ### [`v4.69.0`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.69.0) [Compare Source](firecow/gitlab-ci-local@4.68.1...4.69.0) #### What's Changed - fix: disable .env autoload in compiled binaries by [@​firecow](https://github.com/firecow) in [#​1799](firecow/gitlab-ci-local#1799) - Add `--wait-for-services-timeout` option to CLI by [@​dernilz](https://github.com/dernilz) in [#​1796](firecow/gitlab-ci-local#1796) - ci: add Node.js and Bun version matrix to smoke test by [@​firecow](https://github.com/firecow) in [#​1797](firecow/gitlab-ci-local#1797) - chore(deps): update github/codeql-action action to v4.32.6 by [@​renovate](https://github.com/renovate)\[bot] in [#​1793](firecow/gitlab-ci-local#1793) **Full Changelog**: <firecow/gitlab-ci-local@4.68.1...4.68.2> ### [`v4.68.1`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.68.1) [Compare Source](firecow/gitlab-ci-local@4.68.0...4.68.1) #### What's Changed - chore(deps): update all non-major by [@​renovate](https://github.com/renovate)\[bot] in [#​1792](firecow/gitlab-ci-local#1792) - fix: disable Bun automatic .env loading by [@​firecow](https://github.com/firecow) in [#​1794](firecow/gitlab-ci-local#1794) **Full Changelog**: <firecow/gitlab-ci-local@4.68.0...4.68.1> ### [`v4.68.0`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.68.0) [Compare Source](firecow/gitlab-ci-local@4.67.2...4.68.0) #### What's Changed - chore(deps): lock file maintenance by [@​renovate](https://github.com/renovate)\[bot] in [#​1785](firecow/gitlab-ci-local#1785) - fix: docker cp fails on read-only directories by [@​firecow](https://github.com/firecow) in [#​1773](firecow/gitlab-ci-local#1773) - make services run as container user instead of root by [@​peterbbeu](https://github.com/peterbbeu) in [#​1781](firecow/gitlab-ci-local#1781) - chore(deps): update github/codeql-action action to v4.32.5 by [@​renovate](https://github.com/renovate)\[bot] in [#​1786](firecow/gitlab-ci-local#1786) - Migrate test runner from bun:test to vitest by [@​firecow](https://github.com/firecow) in [#​1784](firecow/gitlab-ci-local#1784) - Route parser warnings through WriteStreams instead of console.log by [@​firecow](https://github.com/firecow) in [#​1788](firecow/gitlab-ci-local#1788) - Use test.concurrent for independent integration tests by [@​firecow](https://github.com/firecow) in [#​1769](firecow/gitlab-ci-local#1769) - Fix Docker volume leak on SIGTERM, SIGHUP, and concurrent cleanup by [@​cegofrhs](https://github.com/cegofrhs) in [#​1787](firecow/gitlab-ci-local#1787) - Add TypeScript type checking to CI by [@​firecow](https://github.com/firecow) in [#​1789](firecow/gitlab-ci-local#1789) - Convert remaining tests to concurrent and tune vitest by [@​firecow](https://github.com/firecow) in [#​1790](firecow/gitlab-ci-local#1790) - fix: flaky log-padding test assertions by [@​firecow](https://github.com/firecow) in [#​1791](firecow/gitlab-ci-local#1791) #### New Contributors - [@​cegofrhs](https://github.com/cegofrhs) made their first contribution in [#​1787](firecow/gitlab-ci-local#1787) **Full Changelog**: <firecow/gitlab-ci-local@4.67.2...4.68.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My42MS43IiwidXBkYXRlZEluVmVyIjoiNDMuODYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->



Summary
GCL_VARIABLE_<name>=<value>for injecting individual CI/CD variables via envGCL_VARIABLE_*fromprocess.envbefore yargs parse to avoidstrictOptions()conflict.env("GCL")for standard options (validation, coercion, precedence, unknown-option rejection)--variableflags take precedence overGCL_VARIABLE_*env varsExample
Test plan
stripGclVariableEnvVars(4 tests)injectGclVariableEnvVars(7 tests)