Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use shell matching platform when running scripts #5034

Merged
merged 6 commits into from Sep 7, 2023

Conversation

twelvemo
Copy link
Collaborator

@twelvemo twelvemo commented Sep 6, 2023

What this PR does / why we need it:
The runScript() function that is used to run script steps in workflows as well as the initScript was directly shelling out via /bin/bash -s which causes the script to be run in WSL on Windows. This can cause confusing behaviour because the commands needed in the initScript might not be available in WSL e.g. clis to authenticate to cloud providers.
This PR uses the exec wrapper and sets shell: true which causes execa to dynamically pick the right shell for the platform.
Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

@twelvemo twelvemo requested a review from a team September 6, 2023 11:40
@twelvemo twelvemo changed the title Init script windows fix: use shell matching platform when running scripts Sep 6, 2023
mkhq
mkhq previously approved these changes Sep 6, 2023
@twelvemo twelvemo added this pull request to the merge queue Sep 6, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 6, 2023
@shumailxyz shumailxyz added this pull request to the merge queue Sep 6, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 6, 2023
@twelvemo twelvemo added this pull request to the merge queue Sep 6, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 6, 2023
@twelvemo twelvemo requested a review from mkhq September 7, 2023 12:09
}

const scriptError = new WorkflowScriptError({
message: `Script exited with code ${error.exitCode}`,
message: `Script exited with code ${err.detail.code}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

The detail field is currently being removed, but while that is underway I think using it is ok. /cc @stefreak @TimBeyer

Copy link
Member

Choose a reason for hiding this comment

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

yes, please keep using it! The ChildProcessError will still have details, the difference is that GardenError will simply not be a generic but the details are defined and typed in every single subclass of it that need them for use cases like this.

@twelvemo twelvemo added this pull request to the merge queue Sep 7, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 7, 2023
@twelvemo twelvemo added this pull request to the merge queue Sep 7, 2023
Merged via the queue into main with commit 22013ae Sep 7, 2023
41 checks passed
@twelvemo twelvemo deleted the init-script-windows branch September 7, 2023 16:21
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.

None yet

3 participants