Open juanmacoo opened 2 years ago
Interesting find, thank you! I cannot imagine a scenario where one would want to trigger a build on a deleted branch – git checkout would fail. But maybe I am unaware of some edgy use cases in the wild, e.g. a job that does some cleanup stuff ...🤔
We will look into this.
I agree, maybe just avoid running all together would be better. but yeah I agree, who knows, maybe someone has some weird use case. Maybe it could be the inverse, a check box to run on Deleted branches.
I wouldn't use it but hey 🤷♂️ who am I to say what others should do.
Additionally I would like to add that this happened on branch(**)
in a normal pipeline job (not multibranch), just in case it wasn't clear.
It would indeed be cool if the plugin did not trigger in this case. We worked around this by specifying a branch filter for the push action. Something like this :(develop|release/|hotfix/).*
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Is this issue still present? It seems I cannot replicate it.
I'd say this is still an issue. We have the following setup:
Bitbucket server push
and Allowed branches unset.This setup works while working on feature branches as well as building integration branches on merge. The problem is that it will also trigger a build for the deleted branch with an error message similar to
Started by Bitbucket PPR: server repository event by user666
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --prune -- origin +refs/heads/feature/my-cool-feature:refs/remotes/origin/feature/my-cool-feature" returned status code 128:
stdout:
stderr: fatal: couldn't find remote ref refs/heads/feature/my-cool-feature
fatal: the remote end hung up unexpectedly
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:408)
Caused: java.io.IOException
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:413)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:219)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:126)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:73)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE
On the push event it would be nice to have a checkbox to avoid running from deleted branches.
This happens when you want to run the pipeline from all branches (Branch Specifier: **), and an event comes in with ref_change such as