How can you trigger a Jenkins master build from GitHub issue comments? - jenkins

We are allowing customers to manage infrastructure using Jenkins by specifying configuration in GitHub; when the configuration is merged to master a deployment pipeline runs to reconcile the configuration.
If there is an issue with the pipeline we want to raise this by creating an issue in GitHub describing what went wrong and allowing customers to comment /apply to rerun the pipeline. We are currently able to trigger the pipeline with PR comments (after ticking the Issue comments box in our webhook configuration) but issue comments are not being picked up.
Is it possible to trigger a pipeline on issue comments in Jenkins?
Jenkins version: 2.219

Related

Jenkins not triggering build on PR merged in bitbucket

We are using Bitbucket cloud to host our repos and Jenkins for CI/CD.
I have setup a multibranch pipeline which has develop and release branches. I want to trigger develop branch whenever a PR is merged from the feature branches to develop a branch (In fact on any manual webhook edit).
Below are the cases I tried:
Setup Manage hook in Jenkin:
This creates a webhook in bitbucket and when PR is merged, build is triggered.
But when I disable the Repository Push option in the webhook, the build is not triggering on PR merge.
Setup the webhook manually:
In this case, the Jenkins logs show the branch name as PR-XY since not triggering the develop branch.
I have set up a regex to filter branches (only develop and release are allowed) and when I add regex like PR(.*) then build gets triggers from the PR section (not desired case).
I want the build to be triggered from the develop branch, not as the PR branch. I have followed most of the options available in the forums but it's not working. Any help regarding this will be appreciated.
I faced the same issue, it's look like most of jenkins plugins like bitbucket plugin does not trigger the pipeline on merge only. even though i set the bitbucket trigger options like this:
unless you add a check mark next to push option.
to solve this i used another Jenkins plugin called Bitbucket Push and Pull Request
just make sure to uninstall Bitbucket plugin if you have it.
so you can use this one as they mentioned in there docs.
and follow the setup instructions.
note: i only test it with normal pipeline job

Jenkins Pipeline build specific branches on pull/pr

I think I'm missing something quite simple here so I thought I would ask.
I have a development branch that developers raise PR's against, when this occurs I would like my Jenkins pipeline to automatically trigger.
Then once a merge happens and a push goes to the development branch, I want to do some extra steps which I have configured in the pipeline successfully.
The problem is how do I get Jenkins to automatically checkout and build branches that have a PR raised against development?
Currently I'm using GitHub hook trigger for GITScm polling and I can see the triggers in github being fired but it just constantly rebuilds the master branch instead of the branch that the PR is being raised on.
We are using github-branch-source and this automatically builds PRs.
There is a nice documentation: cloudbees docu

Jenkins and bitbucket web hooking

I'm trying to configure webhook between Jenkins and Bit bucket for a particular branch.
After this, Jenkins job should start if any changes happen in that specific branch, but the first job is triggering when changes happen for any branch.
After that, webhook is working as expected. It will create a problem to copy the existing job as new and forget to check the job trigger.
Is there anyone who faced any issues like this or am I doing any wrong configuration to setup webhook?
By using this Bitbucket Plugin you can specify the branch name as an option in your job configuration.

Configure JIRA Trigger Plugin for Jenkins multi branch pipeline

I have Jenkins Mutibranch pipeline. I want to integrate my Jira with one of multibranch project. I have installed the JIRA Trigger Plugin and configured Webhook in Jira. however, when I checked in my Jenkins job it does not show me the B***uild when an issue is updated in JIRA*** but it shows when I go to View Configuration in the particular branch. it allows me to select the Build when an issue is updated in JIRA but there is no option to save the changes. I know this might be a reason the option is view only. but how can I configure this?
Is anyone configured JIRA Trigger Plugin with Jenkins mutibranch project where using Jenkinsfile? and what is the correct way of integrating this?
Should I do some coding in the Jenkins file to get this done?

Triggerig Jenkins pipeline job after code pushed to github

I want to know how we can setup a jenkins pipeline job which gets triggered after each commit made github private repository.
I am able to do it using a freestyle job but not able to do it using a pipeline.
I did setup the gihub project url, GitHub hook trigger for GITScm polling and wrote a simple pipeline script of checking out the branch.
When I do a changes in the branch and commit it the build wont get triggered.
Can I get a solution on this please?
It works when we add a timestamp block in the pipeline code.
I m able to trigger the pipeline by Adding a GitHub Webhook in Jenkins Pipeline.
I have followed steps mentioned in this blog.
In my case jenkins is running on localhost. Replacing localhost with your jenkins_url should work.
Also, I did not found GitHub Pull Requests mentioned in the blog, so I skipped that step.
After completing the configuration you have to build the pipeline manually once, after that everytime a developer commits a code to GitHub, pipeline build will be triggered.

Resources