-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
While running a github actions workflow we got the following error: GitHub Actions has encountered an internal error when running your job. . After searching online, I found a relevant discussion: actions/runner-images#2579 (comment)
It turned out that the issue was caused by this line of code:
if: (inputs.pushToAllEnvs && inputs.pushImage && ((contains(fromJSON('[\"master\", \"main\"]'), needs.devops-setmatrix.outputs.branchName) || startsWith(needs.devops-setmatrix.outputs.branchName, 'hotfix')))) || (github.event.repository.name == 'workflow-docker-build')
We resolved the issue by updating the condition to:
if: (inputs.pushToAllEnvs && inputs.pushImage && (needs.devops-setmatrix.outputs.branchName == 'main' || needs.devops-setmatrix.outputs.branchName == 'master' || startsWith(needs.devops-setmatrix.outputs.branchName, 'hotfix'))) || (github.event.repository.name == 'workflow-docker-build')
To Reproduce
Steps to reproduce the behavior:
Have a multi jobs pipeline with a similiar if.
Expected behavior
First, I don't fully understand why the initial approach is failing. I'd like to understand what's wrong with the original condition and why it's not working as expected.
Secondly, if there is a syntax problem, I would expect a more helpful error message. The generic internal error message was misleading, as I initially thought it was related to our self-hosted runners.
Runner Version and Platform
2.320.0 ( self hosted on k8s)
OS of the machine running the runner? linux/amd
What's not working?
Job Log Output
Nothing useful.
Runner and Worker's Diagnostic Logs
Nothing useful.
