Jenkins GitHub disable auto commit status - jenkins

I'm using Jenkins with GitHub plugin. Everything works great except one thing.
How can I get rid of automatic commit statuses, like this one
Desired behavior:
Push commits to GitHub (works!)
Trigger job (works!)
Set commit statuses via GitHub API (works!)
DO NOT set automatic commit statuses (NOT working)
GitHub plugin configuration

There's a plugin for Jenkins to add a setting for disabling commit statuses: Disable GitHub Multibranch Status.

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

How to trigger Jenkins job automatically when new tag is added to a remote branch

These days I am trying to configure a Jenkins job which will be triggered by tag added to remote branch. Following are the steps what I did:
Added hook on github side and set the event to "Branch or tag creation" (I can see the hook is correctly triggered on github (enterprise version)).
Create freestyle jenkins job (pipeline should be similar), in the git section configure git as below.
Check "triggers "GitHub hook trigger for GITScm polling" in Build triggers section
Then I try to change something and add tag to branch, and push to remote.
But still cannot trigger the job run on Jenkins automatically. I have searched a lot but still cannot make this work.
But when I change the event to "Pushes" on github side (others keep the same), then the job can be triggered.
Anyone have the idea? Thanks.
And how about Jenkin2 pipeline? No git section in job configuration.

Bitbucket webhook to trigger Jenkins job

I'm having trouble getting my webhook in bitbucket server to start a Jenkins job. I've read through the other answered questions on here and can't get it going.
Bitbucket setup:
No special plugins installed
In repository settings I have a webhook set up
URL: http://[my jenkins url]/bitbucket-hook/ (yes I have the trailing slash)
Repo Push event selected
Jenkins setup:
Bitbucket plugin installed
Created new job
Set SCM to Git and added repo details
Set branches to build to either ** or refs/heads/rob-jenkins (a branch in git)
Build when a change is pushed to bitbucket selected
What I do:
I make a change to a file in rob-jenkins branch, push and the job is not started in Jenkins.
What I see:
In bitbucket, repo settings, webhooks I can see the webhook fired as soon as the commit is pushed. It has a 200 http status code, response body is empty.
In Jenkins I've set up a logger for
com.cloudbees.jenkins.plugins.BitbucketHookReceiver
com.cloudbees.jenkins.plugins.BitbucketJobProbe
com.cloudbees.jenkins.plugins.BitbucketPayloadProcessor
com.cloudbees.jenkins.plugins.BitBucketTrigger
And when I look at those logs I can see only 1 entry from com.cloudbees.jenkins.plugins.BitbucketHookReceiver
Received commit hook notification : {"eventKey":"repo:refs_changed","date":"2018-05-22T12:18:11+1000","actor":{"name":"xxxxxx","emailAddress":"xxxxxx#xxxxxx.com","id":53,"displayName":"xxxxxx","active":true,"slug":"xxxxxxx","type":"NORMAL"},"repository":{"slug":"xxxxx","id":1,"name":"xxxxx","scmId":"git","state":"AVAILABLE","statusMessage":"Available","forkable":true,"project":{"key":"SS","id":2,"name":"xxxxx","description":"xxxxxx","public":false,"type":"NORMAL"},"public":false},"changes":[{"ref":{"id":"refs/heads/rob-jenkins","displayId":"rob-jenkins","type":"BRANCH"},"refId":"refs/heads/rob-jenkins","fromHash":"1d9ad42fa404c893853094b0072e5b839f787589","toHash":"9bf7dc873f355259e4338ee80afbd246ecbb48a9","type":"UPDATE"}]}
There are no other entries in the log.
In the job itself, the BitBucket Hook Log screen just says "Polling has not run yet."
No idea why it isn't triggering the Jenkins job... what am I missing?
I've tried setting the Poll SCM manually and that didn't make a difference.
I've done a manual build and it works fine
as commented by #tomas-bjerre the resolution was to use a different plugin
I would recommend using thie plugin instead: github.com/jenkinsci/generic-webhook-trigger-plugin – Tomas Bjerre yesterday
No plugin needed. Just add a post-recieve hook under your repo in Bitbucket. On Jenkins, under Build Triggers, Trigger builds remotely (e.g., from scripts) Trigger builds remotely (e.g., from scripts) and specify an Authentication Token. A bash or python script can be used for the hook. Anytime a git push is run (not just a commit), you trigger a build!

Jenkins: GitHub hook trigger for GITScm polling

I try to configure Jenkins. I want a simple behavior: trigger a build on new pull request.
So, I created a job and configured it, but I checked the checkbox for:
And as you can see nothing is dropped down.
If I click the question mark on the right side, I see:
If jenkins will receive PUSH GitHub hook from repo defined in Git SCM
section it will trigger Git SCM polling logic. So polling logic in
fact belongs to Git SCM.
But where is the "Git SCM section"?
You need to configure the webhook on your GitHub repository. Then, on every commit push, Jenkins will be notified.
So, open your repository in the browser, then go to Settings > Webhooks and add a new one.
Then, enter the URL of your Jenkins instance followed by /github-webhook and select the other options depending on your needs:
I was also frustrated with this topic, this was needed for me to get job triggering working from GitHub MERGE:
GitHub repo -> Settings -> Webhooks -> push type webhook with URL:
http(s)://host:<port>/github-webhook/
For me, last slash was REQUIRED, did not work without it
In Jenkins System Settings, add GitHub Server, credential for it and [x] Manage hooks
Use Test settings button to test it works
In Job configuration, Source Code Management -> Git, add repo and credentials
Under Build triggers: [x] GitHub hook trigger for GITScm polling
In GitHub webhook settings, click webhook and it shows logs how it worked under "Recent Deliveries" title
It is a source code management section (before triggering section),
uncheck "none" case and check git ou github case(depend to your version) and fill the input field with your git repo url and credential

Github Jenkins plugin with Github Enterprise

I have a Jenkins server with the following github plugins:
github-api
github
github-pull-request
I want to trigger a build after a merge (from a PR). This is because I have some build chains that I don't execute when building a PR so after a merge I need to create new deployment packages.
In the enterprise github there doesn't seem to be the same interface (as regular github) for webhooks I don't seem to be able define what events the github plugin (webhook) should listen for so I think its just the default 'push' event. Is this done somewhere else or is it a limitation of the enterprise version?
UPDATE
I have the github plugin working now but its builds for every push if I check the box. This disucssion https://groups.google.com/forum/#!topic/jenkinsci-users/gew5gWVDxw8 suggests that I should be able to use the git scm and github plugin together. Github plugin will register a change, scm plugin will poll server to determine if this change was tho the watched branch. I also tried this suggestion How can I make Jenkins CI with git trigger on pushes to master?
When I try and configure this no branch is ever built!
At least for me it's not exactly clear from your question what you actually exactly want.
It sounds like you only want builds to be triggered if there are some new commits on github on a specific branch.
If this is all you're looking for, you can just setup a webhook (Jenkins (Github Plugin)).
In you Jenkins job, just specify the branch you're tracking (Branches to build).
Assuming you setup github's hoock to jenkins correctly, this should trigger your build job on each commit on github enterprise.
If your hook doesn't seem to work: To check if and what your github server actually would send to your jenkins server, you can temporarily replace the url to your jenkins server in github's webhook with something like requestb.in (this will let you inspect github's hook payload)

Resources