-
Notifications
You must be signed in to change notification settings - Fork 959
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
Command to early-exit the job and set check conclusion #662
Comments
This is really useful and is quite needed! |
This is useful to not repeat the same if statement many times, you can instead do an early exit |
I can't believe GHA does not support this. I guess you need to just implement and entire job as one big step run by your own driver script and then you can put whatever logic you want in that script to terminate early and with a zero exist (and a nice informational message). Is that the only current workaround for this? GHA seems to be a new unique declarative language with somewhat limited functionality. |
Fixes GoogleContainerTools#6032, add code to not run Github Actions on docs-only changes. This PR: - Updates linux and osx github actions to check if the PR only changes docs/* files and if so, pass the test w/o running the full test suite Github actions does not have support for exiting the job from a step easily. See: - https://stackoverflow.com/questions/60589373/how-to-force-to-exit-in-github-actions-step - actions/runner#662 The approach here uses an env var and checks this env var in all subsequent steps, this way no single command fails and tests are skipped as desired. The downside is that all subsequent steps need to have this check but there is no better solution at the moment from my investigation I considered directly using the the 'conclusion' value github actions provides, eg: - "if: steps.s1.conclusion == 'failure'" but I believe that if a step fails then the test fails which is not what we want. There shouldn't be any side effects w/ this approach, all steps have a conditional on the docs-only check and should work correctly as before in the non-docs file are updated case N/A. Future work generally might include a tag that also skips testing but is not directly related
Fixes GoogleContainerTools#6032, add code to not run Github Actions on docs-only changes. This PR: - Updates linux and osx github actions to check if the PR only changes docs/* files and if so, pass the test w/o running the full test suite Github actions does not have support for exiting the job from a step easily. See: - https://stackoverflow.com/questions/60589373/how-to-force-to-exit-in-github-actions-step - actions/runner#662 The approach here uses an env var and checks this env var in all subsequent steps, this way no single command fails and tests are skipped as desired. The downside is that all subsequent steps need to have this check but there is no better solution at the moment from my investigation I considered directly using the the 'conclusion' value github actions provides, eg: - "if: steps.s1.conclusion == 'failure'" but I believe that if a step fails then the test fails which is not what we want. There shouldn't be any side effects w/ this approach, all steps have a conditional on the docs-only check and should work correctly as before in the non-docs file are updated case N/A. Future work generally might include a tag that also skips testing but is not directly related
Fixes GoogleContainerTools#6032, add code to not run Github Actions on docs-only changes. This PR: - Updates linux and osx github actions to check if the PR only changes docs/* files and if so, pass the test w/o running the full test suite Github actions does not have support for exiting the job from a step easily. See: - https://stackoverflow.com/questions/60589373/how-to-force-to-exit-in-github-actions-step - actions/runner#662 The approach here uses an env var and checks this env var in all subsequent steps, this way no single command fails and tests are skipped as desired. The downside is that all subsequent steps need to have this check but there is no better solution at the moment from my investigation I considered directly using the the 'conclusion' value github actions provides, eg: - "if: steps.s1.conclusion == 'failure'" but I believe that if a step fails then the test fails which is not what we want. There shouldn't be any side effects w/ this approach, all steps have a conditional on the docs-only check and should work correctly as before in the non-docs file are updated case N/A. Future work generally might include a tag that also skips testing but is not directly related
Fixes GoogleContainerTools#6032, add code to not run Github Actions on docs-only changes. This PR: - Updates linux and osx github actions to check if the PR only changes docs/* files and if so, pass the test w/o running the full test suite Github actions does not have support for exiting the job from a step easily. See: - https://stackoverflow.com/questions/60589373/how-to-force-to-exit-in-github-actions-step - actions/runner#662 The approach here uses an env var and checks this env var in all subsequent steps, this way no single command fails and tests are skipped as desired. The downside is that all subsequent steps need to have this check but there is no better solution at the moment from my investigation I considered directly using the the 'conclusion' value github actions provides, eg: - "if: steps.s1.conclusion == 'failure'" but I believe that if a step fails then the test fails which is not what we want. There shouldn't be any side effects w/ this approach, all steps have a conditional on the docs-only check and should work correctly as before in the non-docs file are updated case N/A. Future work generally might include a tag that also skips testing but is not directly related
Fixes GoogleContainerTools#6032, add code to not run Github Actions on docs-only changes. This PR: - Updates linux and osx github actions to check if the PR only changes docs/* files and if so, pass the test w/o running the full test suite Github actions does not have support for exiting the job from a step easily. See: - https://stackoverflow.com/questions/60589373/how-to-force-to-exit-in-github-actions-step - actions/runner#662 The approach here uses an env var and checks this env var in all subsequent steps, this way no single command fails and tests are skipped as desired. The downside is that all subsequent steps need to have this check but there is no better solution at the moment from my investigation I considered directly using the the 'conclusion' value github actions provides, eg: - "if: steps.s1.conclusion == 'failure'" but I believe that if a step fails then the test fails which is not what we want. There shouldn't be any side effects w/ this approach, all steps have a conditional on the docs-only check and should work correctly as before in the non-docs file are updated case N/A. Future work generally might include a tag that also skips testing but is not directly related
Fixes GoogleContainerTools#6032, add code to not run Github Actions on docs-only changes. This PR: - Updates linux and osx github actions to check if the PR only changes docs/* files and if so, pass the test w/o running the full test suite Github actions does not have support for exiting the job from a step easily. See: - https://stackoverflow.com/questions/60589373/how-to-force-to-exit-in-github-actions-step - actions/runner#662 The approach here uses an env var and checks this env var in all subsequent steps, this way no single command fails and tests are skipped as desired. The downside is that all subsequent steps need to have this check but there is no better solution at the moment from my investigation I considered directly using the the 'conclusion' value github actions provides, eg: - "if: steps.s1.conclusion == 'failure'" but I believe that if a step fails then the test fails which is not what we want. There shouldn't be any side effects w/ this approach, all steps have a conditional on the docs-only check and should work correctly as before in the non-docs file are updated case N/A. Future work generally might include a tag that also skips testing but is not directly related
Fixes GoogleContainerTools#6032, add code to not run Github Actions on docs-only changes. This PR: - Updates linux and osx github actions to check if the PR only changes docs/* files and if so, pass the test w/o running the full test suite Github actions does not have support for exiting the job from a step easily. See: - https://stackoverflow.com/questions/60589373/how-to-force-to-exit-in-github-actions-step - actions/runner#662 The approach here uses an env var and checks this env var in all subsequent steps, this way no single command fails and tests are skipped as desired. The downside is that all subsequent steps need to have this check but there is no better solution at the moment from my investigation I considered directly using the the 'conclusion' value github actions provides, eg: - "if: steps.s1.conclusion == 'failure'" but I believe that if a step fails then the test fails which is not what we want. There shouldn't be any side effects w/ this approach, all steps have a conditional on the docs-only check and should work correctly as before in the non-docs file are updated case N/A. Future work generally might include a tag that also skips testing but is not directly related
Fixes GoogleContainerTools#6032, add code to not run Github Actions on docs-only changes. This PR: - Updates linux and osx github actions to check if the PR only changes docs/* files and if so, pass the test w/o running the full test suite Github actions does not have support for exiting the job from a step easily. See: - https://stackoverflow.com/questions/60589373/how-to-force-to-exit-in-github-actions-step - actions/runner#662 The approach here uses an env var and checks this env var in all subsequent steps, this way no single command fails and tests are skipped as desired. The downside is that all subsequent steps need to have this check but there is no better solution at the moment from my investigation I considered directly using the the 'conclusion' value github actions provides, eg: - "if: steps.s1.conclusion == 'failure'" but I believe that if a step fails then the test fails which is not what we want. There shouldn't be any side effects w/ this approach, all steps have a conditional on the docs-only check and should work correctly as before in the non-docs file are updated case N/A. Future work generally might include a tag that also skips testing but is not directly related
@joshmgross since you directed people here in actions/github-script#147 (comment), is there any chance this could be reopened, or that https://github.com/orgs/community/discussions/82744 could be updated? |
Has anything changed about this? I'm searching for how to successfully exit the workflow in the middle to skip the rest of the steps. Is it possible? |
i dont think anything changed in GHA iteself... i might be wrong tho...
and so on... for how many steps you have after your condition |
Ok, thx for reply, I have 27 steps to skip so this isn't a solution for my workflow. I will have to create a new workflow for this case. |
I experienced the same problem myself. I am unable to terminate entire workflow as success without adding conditions in subsequent steps, which significantly obfuscates the entire code. Closing this issue after a few years is not serious, considering how many people expect it. |
"For avoidance of doubt", he's surely saying that GH is not treating the issue seriously, rather than that closing the issue is not serious for the people who want the issue resolved. |
This avoids sending emails when there's merge conflicts. The check will appear to be green, but it doesn't matter since the PR can't be merged anyways. Unfortunately there's no better way to do this right now: actions/runner#662
It might not fit all scenarios but in our similar too many if else case, it was possible to split the single pipeline to tag a new version on push and other pipelines would just run on a new tag, instead of checking an if statement. |
This avoids sending emails when there's merge conflicts. The check will appear to be green, but it doesn't matter since the PR can't be merged anyways. Unfortunately there's no better way to do this right now: actions/runner#662
This avoids sending emails when there's merge conflicts. The check will appear to be green, but it doesn't matter since the PR can't be merged anyways. Unfortunately there's no better way to do this right now: actions/runner#662
Bumping this up as this is a very common use-case that the community is demanding. |
TODO: - this requires some extra stuff in the container: pacman -Sy --noconfirm make pyqt-builder sip - skip tests if no patch applied: actions/runner#662 - extensible patch selection, eg patches in a dir and auto select the ones to apply based on detected versions
TODO: - this requires some extra stuff in the container: pacman -Sy --noconfirm make pyqt-builder sip - skip tests if no patch applied: actions/runner#662 - extensible patch selection, eg patches in a dir and auto select the ones to apply based on detected versions
TODO: - this requires some extra stuff in the container: pacman -Sy --noconfirm make pyqt-builder sip - skip tests if no patch applied: actions/runner#662 - extensible patch selection, eg patches in a dir and auto select the ones to apply based on detected versions
4 years on the making... :( |
They aren't making it 4 years. I think they don't do it because it doesn't fit nicely into the current code as it would need custom logic, something like an edge case, some coders don't like this and prefer the default behavior. Also, I think it would need to patch things all around to make this real. |
TODO: - this requires some extra stuff in the container: pacman -Sy --noconfirm make pyqt-builder sip - skip tests if no patch applied: actions/runner#662 - extensible patch selection, eg patches in a dir and auto select the ones to apply based on detected versions
TODO: - this requires some extra stuff in the container: pacman -Sy --noconfirm make pyqt-builder sip - skip tests if no patch applied: actions/runner#662 - extensible patch selection, eg patches in a dir and auto select the ones to apply based on detected versions
TODO: - this requires some extra stuff in the container: pacman -Sy --noconfirm make pyqt-builder sip - skip tests if no patch applied: actions/runner#662 - extensible patch selection, eg patches in a dir and auto select the ones to apply based on detected versions
Describe the enhancement
Currently to skip the rest of steps during a job, an
if
condition has to be added to all of steps or steps have to be moved to another job.It'd be nice to have a command to early-exit (premature, prematurely, graceful, gracefully) (end, finish, terminate, termination, stop, halt, skip, cancel, discontinue, fail) the job during a step without failing the job:
It'd be also nice to set the conclusion of early-exited job:
(equivalent to
exit 1
)or
(equivalent to
exit 78
in Actions v1)and other check conclusions.
This would help save build time for both GitHub and customers.
Additional information
Related StackOverflow and GitHub Community posts:
Related issues:
setNeutral
method been removed? toolkit#146Other CIs:
circleci-agent step halt
travis_terminate
appveyor exit
(Linux)currentBuild.result
exit 0
The text was updated successfully, but these errors were encountered: