Jenkins & Bitbucket: Build on link - jenkins

I'm trying to bring up the bitbucket -> jenkins link. But i've no change, tried it in different settings (see on the pictures)
it works if i call
http://URL/jenkins/job/PROJECTNAME/build?token=buildfromjenkins
May you know wheres the problem?
Jenkins Config (working)
Configured Link
Configured a Service

Do not add token parameter in the endpoint. Remove the parameters in the endpoint URL and add your token in Token box. Then It will work.

Related

can't connect webhooks bitbucket to Jenkins

I am configuring Jenkins and webhook like this but my web-hooks are not working.
here is my webhook configuration
but I have errors like
enter image description here
what i do?
Did you generate the credentials from bitbucket? if so, then you must give it all the permissions and generate your job with those credentials
In the image I give access to everything to the user for the repository, try to do something similar and validate the url

Credentials not available in Jenkins Pull Request Builder plugin

I have added global credentials in Jenkins.
However when I try to add then in my Pull Request builder plugin configuration, they don't seem available.
Any suggestions?
Using Jenkins 2.303.1
(the arrow on the left of the Add drop-down does not do anything)
The instructions in the GitHub pull request builder plugin documentation says that you need to "select Kind -> Secret text". Based on the icon in your credentials list, I think you have defined a credential type "Private key".
The pull request builder likely uses the GitHub API's to perform many of its operations. GitHub API's rely on a username and a personal access token. They generally do not support a private key as the credential.
Define a secret text credential as described in the online help.

Is it possible to use Jenkins Webhooks with Github when the github account uses 2 factor auth

I am using the latest docker image for jenkins (jenkins/jenkins:lts JENKINS_VERSION 2.208). I have started the container, configured jenkins and can manually build against a public repo. However, on my github account I have 2FA, which must remain. I have created a personal access token in Github, and used this in my jenkins config for github server section. I have validated that the connection is working by pressing the test connection link (I added secret text that used my personal access token from github):
In Github, I have wekhook settings with the IP address for where jenkins is hosted (the IP for the docker container) follwed by github-webhook (I have also tried using a dns mapped address for jenkins as well, e.g., http://jenkins-local/github-webhook), content type is application/json:.
I have github polling enabled in jenkins as well, however, it does not work on push requests to the repo. I see failure logs in Github within the webhooks section, this increases each time I make a push (the request keeps failing). I have searched wide across the internet and found documentation of suggestions on what to do, including this link here: securing your webhooks, but nothing is giving me the desired polling effect when a push is initiated and a build triggered. So my question is, is it possible to use 2FA and github webhooks? If it is possible, then what are the exact steps to do it?
If you have 2FA enabled, you cannot authenticate with a login/pass from your tools anymore. You need to create a token that you will use in place of your password.
The official documentation should get you there in almost no time.
In the end the solution was to download ngrok. The IP address that the I had previously tried and the dns mapped address were not publicly available. I tried using my public ip address as well, but that also didn't work. In the end, downloading ngrok gave me a publicly accessible ip address (the address will look like the following: http://1212344a.ngrok.io). If you also plan to use ngrok then ensure that when you start it from the command line/terminal that you also pass the same port for the application that is running locally, if one is required. Next, in github - settings - webhooks set the payload url to the url that ngrok provides in the terminal output, but also append /github-webhook/ on to the end of the address to complete the payload url (in my case this was http://1212344a.ngrok.io/github-webhook/ as the full payload url).

Addition of webhooks in Gitlab

I want to do automatic build in Jenkins when code gets pushed into the Gitlab.
For the same doing webhooks configuration in Gitlab, but getting error :
Url is blocked: Requests to the local network are not allowed.
Even not able to do the activity mentioned in the image :
I am not able to go to the admin area.
if you have the gitlab server locally
from doc
This behavior can be overridden by enabling the option “Allow requests to the local network from web hooks and services” in the “Outbound requests” section inside the Admin Area > Settings (/admin/application_settings/network):
url to the entire article here
Use the root login and check the outbound option, you should be good.
Let me know if you get any other error.
I had faced the same issue yesterday, but all good now.

How can I set the jenkins authentication token?

On my Jenkins build server, I want to set an Authentication Token so that only users that know the token can fire off builds. (As described here.)
This doc page says that it should be configurable under my job's "Build Triggers" configuration.
However, my server has no such fields, and I'm running the latest version (1.546). Mine looks like this:
.
As you can see, this doesn't really look like the docs say it should.
How can I set this token?
You're missing the Trigger builds remotely (e.g., from scripts) Build Trigger:
This is only visible with Security enabled. To get this option from a freshly downloaded 1.546 WAR, I changed Configure Global Security from Anyone can do anything to at least Logged-in users can do anything. For ease/speed of testing, under Security Realm I selected Jenkins’ own user database and Allow users to sign up:
You can go to http://Jenkins-IP/jobs/me/configure to check and change your API access token. Also check whether the user you intend to use has necessary permissions to execute the builds in Manage Jenkins>Configure Global Security
Each jenkins user gets an authentication token - applicable since version 1.426 (more).
You can see yours, provided you are logged in your jenkins server, at http://your.jenkins.server/me/configure
(press 'show API token' button)
Then you can copy and paste it in your scripts (e.g. see here for an example usage).

Resources