Fix GCL_ array env vars not splitting semicolon-separated values - #1778
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 2 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="src/argv.ts">
<violation number="1" location="src/argv.ts:115">
P1: Bug: `flatMap` splitting on array elements corrupts CLI values containing semicolons. When multiple CLI flags are used (e.g., `--variable "MY_VAR=host=db;port=5432"`), the CLI framework already parses them into individual array elements. Splitting those elements on `;` corrupts values that legitimately contain semicolons (connection strings, CSS, etc.). The old code correctly left arrays untouched — only string inputs (from env vars) should be split.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
firecow
force-pushed
the
fix/semicolon-split-array-env-vars
branch
from
February 26, 2026 14:19
ee5745e to
591c423
Compare
firecow
marked this pull request as draft
February 27, 2026 15:47
When array options (--variable, --volume, etc.) are set via GCL_* environment variables with semicolon-separated values, yargs wraps the entire string as a single array element. This adds semicolon splitting for all array-type options derived from yargs at runtime. Also simplifies argv.ts: extracts getStringArray() helper to reduce repeated array/string normalization in getters, and uses early return in injectDotenv().
firecow
force-pushed
the
fix/semicolon-split-array-env-vars
branch
from
February 28, 2026 14:03
15f82ae to
7e8fb51
Compare
Replace super-linear regex flagged by SonarCloud (S5852) with a simpler equivalent that avoids overlapping alternatives.
firecow
marked this pull request as ready for review
February 28, 2026 14:26
firecow
requested review from
ANGkeith,
LauJosefsen,
byrdal and
moberghammer
February 28, 2026 14:27
Contributor
There was a problem hiding this comment.
2 issues found across 5 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-env-variable-split/integration.test.ts">
<violation number="1" location="tests/test-cases/gcl-env-variable-split/integration.test.ts:170">
P2: This test doesn't verify what its name claims. It passes already-split values (`["VAR1=hello", "VAR2=world"]`) directly to `handler()` rather than providing a semicolon-joined `GCL_VARIABLE` env var. The `splitSemicolonEnvVars` middleware is never exercised. To actually test env-split → handler integration, set `process.env.GCL_VARIABLE` (or mock it) and pass an unsplit argv.</violation>
</file>
<file name="src/argv.ts">
<violation number="1" location="src/argv.ts:125">
P2: Potential `TypeError` crash if a non-string, non-array value is stored in the map (e.g. `VOLUME=true` in a `.env` file gets stored as boolean `true` by `injectDotenv`). The old getters checked `typeof val == "string"` before calling `.split()`. Consider adding a type guard.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
The test claimed to verify that env-split variables reach the handler, but passed pre-split values directly. Now passes the unsplit value and calls splitSemicolonEnvVars before handler, actually testing the middleware.
Resolves SonarCloud S3358 (nested ternary operation).
|
4 tasks
|
Do you have any idea when the merge will occurs ? |
Owner
Author
|
@cedric-orange During easter 😄 |
…-array-env-vars # Conflicts: # src/index.ts
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Apr 7, 2026
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.70.0` → `4.70.1` |  |  |  |  | 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.1`](https://github.com/firecow/gitlab-ci-local/releases/tag/4.70.1) [Compare Source](firecow/gitlab-ci-local@4.70.0...4.70.1) #### What's Changed - fix: GCL\_ array env vars not splitting semicolon-separated values by [@​firecow](https://github.com/firecow) in [#​1778](firecow/gitlab-ci-local#1778) - fix: strip ports and digests from service aliases by [@​bidord](https://github.com/bidord) in [#​1820](firecow/gitlab-ci-local#1820) - fix: SonarCloud code smells by [@​firecow](https://github.com/firecow) in [#​1822](firecow/gitlab-ci-local#1822) - chore(deps): update github/codeql-action action to v4.34.0 by [@​renovate](https://github.com/renovate)\[bot] in [#​1807](firecow/gitlab-ci-local#1807) - chore(deps): update github/codeql-action action to v4.35.1 by [@​renovate](https://github.com/renovate)\[bot] in [#​1808](firecow/gitlab-ci-local#1808) - chore(deps): lock file maintenance by [@​renovate](https://github.com/renovate)\[bot] in [#​1811](firecow/gitlab-ci-local#1811) - build(deps): bump path-to-regexp from 0.1.12 to 0.1.13 in /examples/docker-compose-nodejs by [@​dependabot](https://github.com/dependabot)\[bot] in [#​1816](firecow/gitlab-ci-local#1816) - chore(deps): update sonarsource/sonarqube-scan-action action to v7.1.0 by [@​renovate](https://github.com/renovate)\[bot] in [#​1818](firecow/gitlab-ci-local#1818) - chore(deps): update dependency typescript to v6 by [@​renovate](https://github.com/renovate)\[bot] in [#​1812](firecow/gitlab-ci-local#1812) #### New Contributors - [@​bidord](https://github.com/bidord) made their first contribution in [#​1820](firecow/gitlab-ci-local#1820) **Full Changelog**: <firecow/gitlab-ci-local@4.70.0...4.70.1> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever MR is behind base branch, 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:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDQuOCIsInVwZGF0ZWRJblZlciI6IjQzLjEwNC44IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6cGF0Y2giXX0=-->
kevingerman
pushed a commit
to kevingerman/gitlab-ci-local
that referenced
this pull request
Apr 10, 2026
…ecow#1778) Co-authored-by: Mads Jon Nielsen <mjn@cego.dk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



GCL_VARIABLEand other array-type env vars not splitting semicolon-separated values (e.g.GCL_VARIABLE="VAR1=hello;VAR2=world")argv.ts:getStringArray()helper reduces getter boilerplate, early return ininjectDotenv()Fixes #992