How receive hook from Bitbucket on JIRA and process this hook data? - triggers

How receive hook from Bitbucket on JIRA and process this hook data?
I can't figure out how to properly create a hook listener from Bitbucket to JIRA.
As I can see:
1) There is a branch in Bitbucket
2) A commit is added to the branch and a Pull Request is created.
3) The reviewer clicks Approve at Pull Request and at this moment a change in the status of the task should occur in JIRA, which in one of the fields contains the name of the branch
I understand how to send a hook from BitBucket, but how to get a hook and process it in JIRA
I do not understand how to implement this, have any ideas?

I figured it out, it's simple via WebHooks
I used the plugin JIRA Automation
Bitbucket sends the hook to the JIRA with the transfer of the secret
(basic authorization);
JIRA gets the hook and processes the hook
using the plugin
JIRA then sends a request to TeamCity to build a
specific branch using a plugin;
TeamCity is building a specific branch and sends the hook
to JIRA, and JIRA processes the hook from the
TeamCity and performs the actions

Related

How to Trigger a Jenkins Job on Pull Request Close Event from Webhook

We have an Enterprise Jenkins box with the GitHub Plugin that scans orgs and creates jobs for each branch/PR etc. Repos then have a webhook which send push/pull request events to the webhook, which builds them.
I'm trying to work out how to destroy ephemeral environments after a Ent. GitHub PR has been closed. I figured the best way to do this would be to have the webhook invoke the job and read the GH payload on the PR close event, however it doesn't appear like this is an option from any of the GH plugin settings on the org? The webhook simply disables job on the close event rather than building.
We don't have GitHub Actions available, so that's not an avenue. How else could I invoke a build upon PR close?

Jenkins with GitHub WebHooks trigger by Pull Requests

I'm trying to integrate Jenkins with GitHub using the GitHub Pull Request Builder plugin for Jenkins and GitHub WebHooks but there are some problems:
I have configured GitHub Server and GitHub Pull Request Builder and tested the connection to the GitHub Server and the specific repository.
I have configured the Jenkins Job with the GitHub project url (copied right from my URL) and the GitHub Pull Request Builder (only checked the check-box and the Use github hooks for build triggering).
I have configured the GitHub WebHook with Pull Request permissions only.
The issue is when I tried to Re-register hooks for all jobs in the Manage Jenkins sector the Logs prints this message:
GitHub webhooks activated for job git-test-webhook with [GitHubRepositoryName[host=github.com,username=<USERNAME>,repository=<REPO NAME>]] (events: [PUSH])
The result is when I push a new commit to the repo the Jenkins listens to it but when I open a new Pull Request or anything else with Pull Request the GitHub WebHook sends the message and gets a 200 response code but the Jenkins isn't listening to the hook.

Triggering Jenkins Multibranch Pipeline automatically if a PR is raised on GitHub

I am using Jenkins Multibranch pipeline.
I've configured the APIs (github-webhook and ghprbhook) on GitHub.
Currently, If I click on "Scan Repository Now/Scan Repository Log" in Jenkins, the Jenkins will go through the GitHub and creates a new PR job in Jenkins if there are any PR on GitHub.
So I need to trigger this Multibranch pipeline whenever there is a Pull Request raised on GitHub. I want this pipeline to trigger automatically when there is a PR on GitHub.
What do I need to do to achieve this approach?
Is it possible to trigger Multibranch pipeline automatically whenever a PR is raised on GitHub?
To achieve this, I have selected only "Push and Pull Request" under "Let me select individual events" section of GitHub Webhooks.
PS: The GitHub branches are automatically detected in Jenkins.
Du you use the GitHub pull request builder plugin?
This Jenkins plugin builds pull requests from GitHub and will report the results directly to the pull request via the GitHub Commit Status API
When a new pull request is opened in the project and the author of the pull request isn't whitelisted, builder will ask Can one of the admins verify this patch?. One of the admins can comment ok to test to accept this pull request for testing, test this please for one time test run and add to whitelist to add the author to the whitelist.
If an author of a pull request is whitelisted, adding a new pull request or new commit to an existing pull request will start a new build.
A new build can also be started with a comment: retest this please.

Showing Jenkins pipeline status against pull requests in GitHub

I have recently started using Jenkins Pipelines and have a multibranch job configured which is happily picking up Jenkinsfile on one of my branches.
I have seen in screenshots on posts\articles that Jenkins can report back to pull requests in GitHub the status of whether the branch has passed\failed checks performed in the pipeline.
I am not seeing any such feedback for my pull request I have opened, I can see in Jenkins it has triggered a pipeline build which has passed.
How can I get the notification to show the pipeline checks have passed in GitHub. Do I need to configure something else?
I found out this was simply down to me using the Git instead of GitHub sources option when configuring the multibranch pipeline job in Jenkins.
The docs for the GitHub Branch Source plugin gave me the clues!
I now get status messages on my pull requests showing whether pipeline checks are pending\failed\passed.
Check out the Github Pull Request Builder Plugin, it should do what you require: https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin

Setup rules/alerts before raising a PR in Github

Basically whenever somebody raises a PR on my repository, I want to ensure that the person raising the PR has performed some actions (running a script etc.)
So is there a way to set up some rule or some alert so as to remind the person to perform that action before raising the PR.
You should use something called integration. Here you can see the GitHub Integrations Directory.
My favorite is Travis CI–you set it up using a .travis.yml file and then after the commits are pushed the tests are run and Travis sends the status response which will be visible to in the Pull request.
However, this can't stop the user to submit the pull request.
Like I mentioned, you cannot stop the user to open pull requests but you can tell him/her the steps how to contribute using the CONTRIBUTING.md in your project. Then when somebody opens a pull request or issue will see this alert: