jenkinsci / bitbucket-push-and-pull-request-plugin

Plugin for Jenkins v2.138.2 or later, that triggers job builds on Bitbucket's push and pull request events.
https://plugins.jenkins.io/bitbucket-push-and-pull-request
MIT License
46 stars 50 forks source link

"Single triggered job" option. How does it work? #311

Closed x4team closed 8 months ago

x4team commented 8 months ago

Hi, everybody In the 3.0 version of the plugin, the developers added the option "Single triggered job", which can be configured in Manage Jenkins -> System and it has only one field WITHOUT a DESCRIPTION of its work. Also in changelog I did not find a description of this option ((

I have several jobs, and some of them have several repositories with a web hook. I want only one (or a limited number) jobs to run with this web hook. Is this an option about this? I tested this "Single triggered job" option and entered only my helm-upgrade job in this field. But unfortunately it didn't work, all jobs were started, where there was the same repository

cdelmonte-zg commented 8 months ago

Hi @solarlodge, maybe can you help @x4team ?

Tnx! :)

cdelmonte-zg commented 8 months ago

@x4team In the readme (Jenkins Global Configurations) there is a brief explanation of this new feature:

you can configure a single job to be triggered exclusively. That overrides the default behavior of having a dedicated endpoint (+ some internal matching logic) for ALL pipelines to be triggered via this plugin. In case of a non-existing job a WARNING will be logged at global jenkins log. You can omit this feature by simply leaving this field blank.

solarlodge commented 8 months ago

hi @x4team :) this feature is intended to one configure and ONLY one job to triggered via your configured hook endpoint. the jobname needs to be the full path name. You can check this via your jenkins instance's groovy concsole via println Jenkins.instance.allItems.find { it.fullName.contains('PART_OF_YOUR_JOBNAME') }.fullName e.g. In case of a non-existing job there should be a warning in your jenkins log.

x4team commented 8 months ago

hi @x4team :) this feature is intended to one configure and ONLY one job to triggered via your configured hook endpoint. the jobname needs to be the full path name. You can check this via your jenkins instance's groovy concsole via println Jenkins.instance.allItems.find { it.fullName.contains('PART_OF_YOUR_JOBNAME') }.fullName e.g. In case of a non-existing job there should be a warning in your jenkins log.

Hi @solarlodge , @cdelmonte-zg , thanks for the help Via Jenkins.instance.AllItems.. I found joba's name as "Dev/Category/helm-upgrade",and inserted it into the settings of the Bitbucket PPR plugin (field "Single triggered job"). Next I pushed commit to "helm" repository, and I saw that not only the "helm-upgrade" job was launched, but also all the release ones

Screenshot from 2023-10-31 15-31-01

Are my actions correct?

solarlodge commented 8 months ago

@x4team Looks correct. Out of curiosity: Does it work when you configure it, save and restart your whole jenkins instance AFTERWARDS?

x4team commented 8 months ago

@x4team Looks correct. Out of curiosity: Does it work when you configure it, save and restart your whole jenkins instance AFTERWARDS?

YES, thanks. This solved my problem 🤝

cdelmonte-zg commented 8 months ago

More docus will be added in the next release of the plugin