Skip to content

feat: add --shell option for powershell/pwsh shell-executor jobs - #1978

Open
jmatney2 wants to merge 3 commits into
firecow:masterfrom
jmatney2:feat/powershell-shell
Open

jmatney2 wants to merge 3 commits into
firecow:masterfrom
jmatney2:feat/powershell-shell

Conversation

@jmatney2

@jmatney2 jmatney2 commented Oct 22, 2026 •

Copy link
Copy Markdown

Closes #1739

Shell-executor jobs always ran through Git Bash. Add --shell bash|powershell|pwsh (also GCL_SHELL or SHELL= in .gitlab-ci-local-env) so those jobs can run in Windows PowerShell or PowerShell Core, with job variables passed into the process.

Container jobs still use bash inside the image.

Tested on Windows with PowerShell 5.1 and pwsh 7.6. The new tests run only on Windows, so Linux CI will skip them.


Summary by cubic

Shell-executor jobs can now run in Windows PowerShell or PowerShell Core instead of Git Bash via a new --shell option, also settable with GCL_SHELL in the environment or SHELL= in .gitlab-ci-local-env. Job variables take precedence over the host environment, and interactive jobs keep reading from stdin. Container jobs still use bash inside the image. Closes #1739.

  • Failing native commands stop the job with the correct exit code; status checks are inserted after complete statements (parsed by PowerShell) so if/else, try/catch, pipelines, and here-strings are not broken.
  • Windows PowerShell 5.x script files include a UTF-8 BOM so they parse reliably.
  • PowerShell tests run only on Windows; Linux CI skips them.

Written for commit ac5aa2d. Summary will update on new commits.

View guided diff

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/job.ts">

<violation number="1" location="src/job.ts:957">
P2: Interactive PowerShell jobs cannot consume input because this branch always passes `-NonInteractive`. Omit that switch for `this.interactive` jobs while retaining inherited stdin.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread README.md Resolved
Comment thread src/job.ts Resolved
Comment thread src/job.ts Resolved
Comment thread src/job.ts Outdated
this._filesToRm.push(interactiveScriptFile);

const interactiveCp = execa(this.argv.shell, [
"-NoProfile", "-NoLogo", "-NonInteractive", "-ExecutionPolicy", "Bypass",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Interactive PowerShell jobs cannot consume input because this branch always passes -NonInteractive. Omit that switch for this.interactive jobs while retaining inherited stdin.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/job.ts, line 957:

<comment>Interactive PowerShell jobs cannot consume input because this branch always passes `-NonInteractive`. Omit that switch for `this.interactive` jobs while retaining inherited stdin.</comment>

<file context>
@@ -927,8 +942,32 @@ If you know what you're doing and would like to suppress this warning, use one o
+                this._filesToRm.push(interactiveScriptFile);
+
+                const interactiveCp = execa(this.argv.shell, [
+                    "-NoProfile", "-NoLogo", "-NonInteractive", "-ExecutionPolicy", "Bypass",
+                    "-File", interactiveScriptFile,
+                ], {
</file context>
Suggested change
"-NoProfile", "-NoLogo", "-NonInteractive", "-ExecutionPolicy", "Bypass",
"-NoProfile", "-NoLogo", ...(this.interactive ? [] : ["-NonInteractive"]), "-ExecutionPolicy", "Bypass",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by removing -NonInteractive from the interactive path. That branch only runs for interactive jobs, so the conditional was unnecessary. Non-interactive jobs still pass it.

Document SHELL= in dotenv separately from GCL_SHELL in the environment. Check native-command status after each PowerShell line, and let interactive jobs read stdin with job variables taking precedence over the host environment.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread src/job.ts Resolved
Splitting scripts on physical lines inserted the failure probe inside if/else, try/catch, pipelines, and here-strings.

Co-authored-by: Cursor <cursoragent@cursor.com>

This branch has not been deployed

No deployments
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.

Allow configuring PowerShell shell instead of git bash on Windows

1 participant