Stephen Connolly your suggestion appears to have fixed the issue.
Fixed by https://github.com/samrocketman/jervis/commit/e4cd6324ff22c3593d7e6feab88dff79e516e14b
I'll do some more testing but it now appears to work reliably.
After making the change from Stephen Connolly's suggestion I had to click "Scan Repository Now". The problem continued to be broken until I scanned the repository for branches.
Results (the fixed flow)
The following flow is how I reproduced reliably and confirmed the fix.
- Bootstrapped Jenkins with vagrant
- Generated a multibranch pipeline for samrocketman/jervis project.
- Clicked "Scan repository Now" so branches would be detected.
- Clicked "Build now" on the jervis_simple branch. This always succeeded the first time.
- Log into Jenkins and restart it. /etc/init.d/jenkins stop; /etc/init.d/jenkins start
- Visit the jervis job and click "Build now" (the ERROR used to occur here every time with this flow; clicking build repeatedly and restarting Jenkins did not help and caused the same failure every time)
After the fix, step 6 above now always works and I no longer encounter the error. I will test further to be absolutely sure it's fixed. Thanks Stephen!