Legacy code started this job. No cause information is available
There is always an extra build with triggered by “promote build plugin” on jenkins, which I dont know why…
Here is the whole pipeline:
- dev commits “feature_branch” to github
- jenkins triggers a build on “feature_branch” to run all unit tests
- if the branch passed the test, it should go to “code review” (I use promote_build_plugin here, manually promote after code view),
- I use “Trigger/call builds on other projects” as the action to trigger “deploy-job” to build only if it passes code review.
I can see a new build is triggered and that feature_branch is merged, but there is always another build take place with “no changes; Legacy code started this job. No cause information is available”
I googled a whole afternoon trying to solve this, any help?
One Solution collect form web for “Legacy code started this job. No cause information is available”
You probably have a post-commit hook that is triggering the same job through a URL or jenkins-cli
Edit after OP comments:
But I start to wonder on the deploy-job, I didnt configure “Build when a change is pushed to Github”, instead, I use “Build when another project is promoted”, so I think even github hook is triggered, it wont end up with an extra build?
Well, there is your problem ^^. The “Trigger/Call builds” mechanism is completely separate from the “Build when another project is promoted“.
- The former allows to trigger a new build from a buildstep or a promotion (tied to that specific promotion).
- The latter will trigger a build on any promotion of the configured job. It is the inverse of “Build other projects” post-build configuration.
Furthermore, build triggers are not AND’ed, they are OR’ed. Build when this or that or that trigger happens.
Remove the “Build when another project is promoted” from configuration to git rid of extra builds.
Now, if you want to prevent builds from being triggered by SCM commit hooks, you need to make sure there is no SCM polling configured on the job. Alternatively different SCM plugins have their own options (I know SVN SCM plugin allows to “ignore post-commit hooks”; don’t know about git SCM plugin)