I use Jenkins with a Github repository, and after restart Jenkins runs spec on all branches, even on those deleted from the repo. How do I make jenkins run specs on only the actual repo branches?
This happens as you still have all the branches, tags, etc. in your local repository, client side. In order to avoid using them during your build process, there are few scenarios you might consider:
Jenkins git plugin enables you to run git remote prune
before every build. As the documentation for the command is quite specific, it will do exactly what you wanted:
Deletes all stale tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in "remotes/".
This feature is available at the project configuration page, section Source Code Management, then find Git and your repository definition. Below them you should have an Advanced button, and after clicking it an option named Prune remote branches before build should be visible. Make sure it checked and you should be good to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With