Open faiyat opened 10 years ago
I'm also seeing this behavior. Clicking on the Trigger Build Button has no effect.
I think the action taken by "Trigger build" is only to ping Jenkins with the repository name. Then, any Jenkins jobs that are configured to poll for that repository will then poll for changes, and build if any changes are detected. Thus, "Trigger build" from a given pull request does not specifically request a build job be executed for that pull request itself.
Now, this behavior might have changed in v2.5.0 when it started including a SHA1 alongside the repo name, but I'm not sure.
Further, since the build job will only execute a build if the poll detects a new commit, the PR's trigger button will not rerun a build for that PR on demand.
If so, then the only time this button seems useful is when you have set very infrequent poll schedule in the corresponding Jenkins job. And this button should be moved outside of each pull request to not confuse people that it looks like it can trigger a build for that pull request.
All of my build jobs are set to poll with no schedule. Thus, they only build when triggered by a ping from Stash.
It may be that the main/original point of the Trigger button on the PR is for scenarios where the jobs are configured to only "run periodically" (not poll) on a particular schedule. In this case, I guess it sort of would provide a build "on demand", if the PR had changes that had not yet been recorded in one of the previous executions of the scheduled build, e.g. "I pushed a new PR commit, and I don't want to wait for the next scheduled build to see its result".
Actually what i just said above about schedule is not right. According to its implementation/doc, poll schedule is not required to be set. The notification to the Jenkins job is sent by the Stash hook after each commit is processed. So the trigger build button is only useful if it can rebuild the same pull request or it can start the build right away even though there are pending builds already. But it seems it doesn't work either way.
There is a backlog for builds triggered by webhook in Jenkins, that is there is always one pending build for the designated Jenkins job. There are 7+ pull requests that haven't been built yet. If I click on the 'trigger build' button in pull request that's among the 7+ PRs, the next build and the next next build won't be the one I clicked. Instead, it'll still build according to the time the change was received and in the meantime skipping the PR that has been built before. Is this desired behavior or a bug? I thought the Jenkins job should start build the one I clicked. This makes 'trigger button' button essentially no use.