Bitbucket Server - How to get the Bitbucket Server instance - jenkins

I'm new to Bitbucket Server.
Currently, I'm trying to configure a Jenkins job to build my repository, which is located in my personal space of Bitbucket Server (I'm not admin of BitBucket Server).
I followed the video here: https://www.youtube.com/watch?v=0-FugzVYJQU.
Inside Jenkins setting, I have put the URL to my company bitbucket server, personal access token, Credentials as per hint from Video... But the connection still fails.
My question is:
1 - Do I need the admin right of Bitbucket Server to setup these procedures or did I configure something wrong?
2 - If possible, how to get the Bitbucket Server instance when I don't have the
admin right of Bitbucket Server?
Sorry English not my native language.
Thank you for your help :)
Jenkins Setting - Bitbucket Server instances entry

Regarding your question 1,you don't need any admin access to bitbucket server to setup this procedure.If you are cloning from any repository, you need to make sure that the credential you are using, should have at least read access to particular repository.
For your second question, if you are setting up any jenkins job and Bitbucket team is different, you need to ask them for url or IP. Even you dont know ip, bitbucket server URL should be fine to connect with as long you are using correct credentials.
There can be multiple issue like firewall/no connectivity/security rules if jenkins is not able to connect though you are using correct credentials.

1 - Do I need the admin right of Bitbucket Server to set up these
procedures or did I configure something wrong?
You do not need admin rights of Bitbucket Server. You can add your own personal access token(PAT). Make sure your PAT has admin access.
If possible, how to get the Bitbucket Server instance when I don't have the admin right of Bitbucket Server?
You have to configure your Bitbucket instance manually. Its explained from here in the video.
If your repository is in your personal space, make sure while creating a job, the project name is ~<yourusername>. Example ~jsmith. Repository name will be populated using this.
Regards,
Bitbucket Server Developer

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

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).

ghprbActualCommitAuthorMail returns wrong mail address

I am using the GitHub pull request builder plugin in Jenkins to make pull requests on GitHub automatically trigger Jenkins jobs.
I am using GitHub Enterprise and when I try to get the values of environment vars ghprbActualCommitAuthor and ghprbActualCommitAuthorMail, I get incorrect values:
ghprbActualCommitAuthor : GitHub Enterprise
ghprbActualCommitAuthorEmail : noreply#github.***.com
Please help, thanks!
This behavior is seen in GitHub Enterprise when users commit changes directly using the web UI or they have not set their email addresses.
According to GHE support:
This is by design, since the commit is actually done by the GitHub Enterprise instance. This is because we do not impersonate users when creating commits.
You can fix this by ensuring that users make commits only through the Git clients using their own SSH credentials or Personal Access Tokens.

Is it possible to have required merge checks on Bitbucket Server

I have managed to set up some custom checks on Bitbucket server and they work ok.
However I seemingly need Bitbucket Premium to make them required, but I don't think there is a Premium option for Bitbucket Server. So how do I setup required merge checks for Bitbucket Server?
You've linked to a Bitbucket Cloud document, but you're asking about Bitbucket Server.
You need to have your custom merge checks return RepositoryHookResult.rejected(String summaryMessage, String detailedMessage) (or the equivalent in your language of choice) to Bitbucket Server upon failure. https://developer.atlassian.com/server/bitbucket/tutorials-and-examples/controlling-when-pull-requests-can-be-merged/ has some example code.

Blue Ocean Pipeline editor doesn't start as can't connect to git

On this tutorial, I am stuck at first page where I am supposed to connect to a Git repository. I have tried Github and Bitbucket. For both when I press ok after inputing my credentials, it waits for a few seconds then nothing happens. Not even an error message. I am sure that my bitbucket credentials are correct.
Any idea why?
By the way, I am behind a proxy, which I have setup as usual in the plugns section. I can download plugins so the proxy is correctly setup.
The tutorial does use an access key, that is a PAT (Personnal Access Token): that means it should net require username/password for GitHub.
Try that (using a key) first.
On BitBucket, the same notion of access token applies.

Resources