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

Trigger global failure on shell error? #208

Open
xdhmoore opened this issue May 7, 2022 · 2 comments
Open

Trigger global failure on shell error? #208

xdhmoore opened this issue May 7, 2022 · 2 comments
Milestone

Comments

@xdhmoore
Copy link
Contributor

xdhmoore commented May 7, 2022

Is your feature request related to a problem? Please describe.
Is there a way to trigger a global halt of the workflow when a particular (shell) action fails instead of continuing with other rules? I have some actions that apply to the whole source location and if they fail it doesn't make sense to go on. It doesn't do much harm though.

Describe the solution you'd like
Something like a fail_globally attribute on the shell action:

    actions: # TODO fail completely when this fails
      - shell:
          cmd: pwsh -C "Write-Error this should stop everything"
          ignore_errors: false
          # HERE: Causes the whole workflow to stop on failure if an error happens and ignore_errors==false
          fail_globally: true  
    

** Alternatives **
It might make sense to have a global-level flag for this behavior, because in my case I'd want to always have it fail globally.

** EDIT: **
I think a similar case could be made for the python filter and python action features.

@xdhmoore
Copy link
Contributor Author

xdhmoore commented May 7, 2022

Apologies again. I was confused. I realized the ignore_errors field is doing what I want, but when calling pwsh you have to explicitly pass out the exit code for it to make it up the chain.

 - shell: pwsh -c "exit 1"; exit %errorlevel%;

@xdhmoore xdhmoore closed this as completed May 7, 2022
@xdhmoore
Copy link
Contributor Author

xdhmoore commented Jun 4, 2022

Reopening. Sorry to flip-flop on this one. After some more experience with the tool it looks like ignore_errors: false causes the actions for that rule to be skipped, but not for all rule processing to stop and organize to halt, which is what I was looking for. I've edited the description to include the python action and filter, which are similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants