How to set up an Azure DevOps service connection or endpoint to my localhost Jenkins install - jenkins

I have Jenkins installed on an Ubuntu 18.04.3 LTS desktop PC on my localhost.
I also have an AzureDevOps repo on which I can successfully run a build, through a Jenkins pipeline job, connecitivity achieved via my AzureDevOps personal access token (PAT).
I am now trying to set up a Jenkins service connection or endpoint in AzureDevOps, to enable me trigger an Azure DevOps pipeline release whenever a Jenkins build completes successfully.
To achieve this in AzureDevOps, I am trying to set up access to Jenkins via a Jenkins service endpoint. The endpoint configuration requires among others, a Jenkins "Server URL" (screenshot below). Not surprisingly, AzureDevOps is unable to connect to my Jenkins instance as it's running on my local machine and therefore not publicly accessible.
Any suggestions on how I can overcome this hurdle would be most appreciated.

How to set up an Azure DevOps service connection or endpoint to my localhost Jenkins install
As we know, in order to receive the service hook notifications, you'll need to expose a port to the public internet.
To expose a port to the public internet, you can try to use the tool ngrok:
ngrok exposes local servers behind NATs and firewalls to the public
internet over secure tunnels.
Please check the document Configure a service hook for PR events for some more details.
Hope this helps.

Related

How to configure TFS build agent with web proxy

We noticed that one of our task started failing with the following error after using a new proxy:
Error: connect ETIMEDOUT 102.33.19.18:443
If we remove the proxy, everything back to the track. However, we already configured proxy for our build agent.
Are there something special we missed?
When your self-hosted agent requires a web proxy, you can inform the agent about the proxy during configuration. This allows your agent to connect to Azure Pipelines or TFS through the proxy. This in turn allows the agent to get sources and download artifacts. Finally, it passes the proxy details through to tasks which also need proxy settings in order to reach the web.
To enable the agent to run behind a web proxy, pass --proxyurl, --proxyusername and --proxypassword during agent configuration.
For example:
./config.cmd --proxyurl http://127.0.0.1:8888 --proxyusername "myuser" --proxypassword "mypass"
Note: It applies to agent version 2.122 and newer. Do not forget to restart your agent and give it a try again.

Webhook for local Jenkins and hosted Gitlab?

I want to make a webhook for when I push something to Git lab. Git lab is hosted by school and I've installed Jenkins locally. Now when I want to make a webhook http://localhost:8080/project/timely-frontend
Gitlabs says: "URL is blocked: Requests to localhost are not allowed". Are there any other possible ways to make a push webhook?
If Jenkins and Gitlab are both installed on the same internal (school) network, try using the internal private IP address of Jenkins as the webhook URL instead of localhost.
On the Jenkins host, this can be obtained using a command line ip addr show on Ubuntu and put that in the Gitlab webhook.
Keep in mind that especially if Jenkins is running on a non-standard port (8080), other firewalls outside your control could still block the connection.

Trigger Jenkins build using slack (Jenkins hosted in enterprise server without internet)

How can I use Slack trigger a Jenkins build for which Jenkins is hosted in a enterprise server without Internet connectivity?
I tried slash command in Slack, but when slack is trying to reach the Jenkins URL error is returned since its not accessible in internet.

Connection issue with Jenkins within Docker on RaspberryPi 3 (rpi-jenkins) when cloning a Bitbucket Git Repo

I'm currently playing around with Jenkins on Raspi within Docker (using dilgerm/rpi-jenkins image).
Now I have a problem with connecting to a Bitbucket Git repository.
When entering the repository url, I get (the commonly known) "Failed to connect to repository"
When using https and providing credentials (via Jenkins Credentials store), I get the error.
When using ssh and configuring the keys properly, I get the same error.
Now I am wondering if I have to configure the ssh-key withing the docker container (for the Jenkins user?). Currently, I have implemented the key on the hosting Raspi itself.
Or may it be required to configure/publish the ssl port of the Docker container on startup (-p parameter)?
Any help appreciated.

Is there any way to integrate Bitbucket on cloud and Jenkins On premise

I am trying to integrate Bitbucket on cloud and Jenkins on premise, but once I enter the IP of my local Jenkins in Bitbucket cloud it show error URL not valid.
Is there a way to solve this, or do I need to buy Jenkins cloud license?
Your local Jenkins server is not seen by a cloud Bitbucket server because it is an internal server.
You can solve it in one of those alternatives:
Ask your system administrator to expose your Jenkins server with a global IP address along with the Jenkins port (e.g. 8080) so the Bitbucket server will be able to access it. This is not totally secure due.
Activate the Jenkins job that pulls from the remote BitBucket server on time internal - in the Job 'Build Triggers' section check the 'Poll SCM' checkbox and set the cron setting (for example: 'H/15 * * * *' for building every 15 minutes. Notice that it will not build if there were no code changes)

Resources