-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Manage special bash options when no shell is defined in a workflow #2448
Comments
If you add For your example is your suggestion not really correct, because they use the sh template (that only has -e) for bash if you don't tell the workflow to use bash on linux/mac (due to a bug?) See here explicit bash has that flag https://github.com/actions/runner/blob/ddf41af7678a8bc585d9e6b8ab70d941cdb687b2/src/Runner.Worker/Handlers/ScriptHandlerHelpers.cs#L18 |
Hello @ChristopherHX Thanks a lot for your quick answer. You're right. Then, what would you think about running bash without pipefail in Something like this : case "":
shellCommand = "bash -e {0}"
case "sh":
shellCommand = "sh -e {0}"
case "bash":
shellCommand = "bash --noprofile --norc -e -o pipefail {0}" I'm just trying to find a solution to make act behavior as close as possible to github actions one. It will help me to convince my team mates to use act to win some time when implementing GitHub jobs ;) |
Hi again, It does not seem to be due to a bug as it is a documented behavior:
|
Or an old bug, then they merged a PR to document the current state. That wouldn't be the first time, where a fix would potential break existing workflows and then nothing is changed.
This looks like a good way to handle this and I give my 👍, however I remember the code may have somewhere a if shell == "" then shell = "bash" that would escape your change. |
I'll check this, thanks for the tip. |
Please have a look at my PR. I changed the code according to what we agreed. I tested on my workflow:
as expected. |
only the lint error tab vs. spaces and my suggestion to ignore WorkflowShell for yaml are blocking my 👍 Se tests failed as well,not shure what they do
|
Thanks for the quick review ! first time ever I code with Go, I'm learning ^^ I'll take all the suggestions in consideration and fix the tests, no problem |
…defined - lint error
Hey @ChristopherHX thanks for running the checks, linter is happy now, I'm working on test failures. |
…defined - bonus fix inverted expected and actual in TestGetGitHubContext assertions
…defined - lint error
…defined - bonus fix inverted expected and actual in TestGetGitHubContext assertions
I finally managed to make the tests work properly on my laptop. |
…defined * bash without "-o pipefail" option when "bash" is not explicitely defined in the workflow * bonus: fix inverted expected and actual in TestGetGitHubContext assertions
…defined * bash without "-o pipefail" option when "bash" is not explicitely defined in the workflow * bonus: fix inverted expected and actual in TestGetGitHubContext assertions
#2449) * bash without "-o pipefail" option when "bash" is not explicitely defined in the workflow * bonus: fix inverted expected and actual in TestGetGitHubContext assertions
Bug report info
Command used with act
Describe issue
The job fails when executing this bash expression on a file that does not contain any dependency which is updatable:
nb_updatable_dependencies=$(cat updatable.txt | grep . | grep -v '^No dependencies' | wc -l)
It fails because bash is called with :
-o pipefail
This option is not used in github actions.
This issue was already fixed : #528
But the "-o pipefail" option came back in this PR: #575
Link to GitHub repository
https://github.com/sebastien-perpignane/cardgame
Workflow content
Relevant log output
Additional information
Dockerfile to build the custom image I use (act-ubuntu-mvn image) -> https://gist.github.com/sebastien-perpignane/ade17b1922d35147d08cb08169a6a388
I submitted a PR as it is a very simple fix, even for someone who does not know Go, like me :)
The text was updated successfully, but these errors were encountered: