Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add option for single triggered job #305

Merged
merged 4 commits into from
Oct 9, 2023
Merged

Feature: Add option for single triggered job #305

merged 4 commits into from
Oct 9, 2023

Conversation

solarlodge
Copy link
Contributor

Testing done

Submitter checklist

Preview Give feedback

- Add global feature to restrict jenkins instance to one (remote)
  triggerable job only
@cdelmonte-zg
Copy link
Contributor

@solarlodge thank you for the PR. can you tell me something more about this feature? Tnx

@solarlodge
Copy link
Contributor Author

solarlodge commented Oct 4, 2023

@solarlodge thank you for the PR. can you tell me something more about this feature? Tnx

@cdelmonte-zg Sure :)
The original idea derived from the gitlab plugin's webhook somehow -- having an endpoint that belongs to one job exclusively. For several reasons the approach of having a single endpoint for all pipelines + some fancy matching-magic after recieving the webhook didn't fulfill our needs. We came to recognize that we can circumvent the issues we had with our setup by using a single jenkins job that acts as a proxy pipeline. Our setup is now:

  • Any PR action of any repository triggers the proxy pipeline
  • This pipeline gets all the neccessary informations from the payload
  • Based on some values of the payload the according "real" pull-request pipeline is triggered by the proxy pipeline

To realize this we had to at plugin's site:

  • Introduce a global configure option at $JENKINS_URL/configure that is of type form and:
    • if empty -> triggers normal behavior
    • if non-empty and job exists -> bypass the iteration over all items of type job and triggers the global configured pipeline
    • if non-empty and job does not exist -> does nothing at all and logs a WARNING at global jenkins log

@cdelmonte-zg
Copy link
Contributor

@solarlodge All right, this is an interesting idea. Perhaps you would like to describe it in the readme and in the docs (a copy and paste from the readme is fine) https://github.com/jenkinsci/bitbucket-push-and-pull-request-plugin/blob/master/docs/index.md ? This would give more context to other users interested in this feature...
Thanks a lot

@solarlodge
Copy link
Contributor Author

solarlodge commented Oct 9, 2023

@cdelmonte-zg You're absolutely right m(
Added this to the docs.

@cdelmonte-zg cdelmonte-zg merged commit 6dd41e7 into jenkinsci:master Oct 9, 2023
14 of 15 checks passed
@solarlodge solarlodge deleted the feature/add-option-for-single-triggered-job branch October 9, 2023 13:28
@cdelmonte-zg
Copy link
Contributor

Hi @solarlodge, is your jenkins version >= 2.361.4? I'm asking because I'm updating the plugin to work with Java 17
and I'd like to release the features you've introduced with version 3.0.0 later this week.

Otherwise, if your Jenkins version is < 2.361.4, I'll schedule an extra release, say the 2.9.0, before I release the 3.0.0.

@solarlodge
Copy link
Contributor Author

@cdelmonte-zg It's Jenkins 2.414.2 (LTS). According to the jenkins java support policy it shouldn't be an issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants