Webhook execution failed: execution expired - jenkins

I am trying to trigger jenkins build whenever there is a push to GitLab.
I am referring to https://github.com/jenkinsci/gitlab-plugin.
When I test the connection for webhook it shows execution expired.
I am using:
Jenkins ver. 2.60.1
GitLab version 9.4.0-rc2-ee
Git lab plugin 1.4.6

The exact error message, clicking "Test setting" from GitLab:
We tried to send a request to the provided URL but an error occurred: execution expired
As mentioned in issue 128:
This looks and sounds like a configuration or network error.
Maybe your machine is not publicly available on the webhook address (firewall etc).
For instance, on Digital Ocean server, you would need to open up the port (mentioned in git-auto-deploy.conf.json) in the firewall:
sudo ufw allow 8866/tcp
Double-check though what you put in Manage Jenkins > Configure in term of Gitlab information (connection name, host url, credentials), as mentioned in jenkinsci/gitlab-plugin issue 391.
See GitLab Integration Jenkins: Configure the Jenkins server

It means issues in between jenkins server and gitlab or github server.
Like what I did:
I have set my local-IP:port/project/jenkins_project_name
http://192.168.1.21:8080/project/jenkins_project_name
and set the above URL in the gitlab webhook, it shouldn't work - right?
Because it's an IP that's private and not routable.
SO later I realized and set the public-IP and then hook worked.
http://public_IP:8080/project/jenkins_project_name
Note: To routable public-IP, you should expose port in your router [e.g. 8080 was for me or anything want ]
Hope this works.

I have faced the same issue.
In my case Jenkins is running in an AWS EC2 instance. I have resolved the issue by whitelisting the Public IP addresses of Gitlab on port 443 into the instance security group.

Related

github webhook fails to connect to jenkins with public ip

I am trying to configure github webhooks with my jenkins server but I keep getting "failed to connect". Note that I am using a public ip and not a private or localhost address, At first, icmp protocol was blocked on my firewall but even after allowing it, it still doesn't work.
However, when I proxy my server (using smee client) and use the proxied url in the webhook instead, it works fine, so I thought the problem was jenkins url (in system configuration of jenkins) so I changed that to the public ip but it doesn't have any effect, now I'm clueless.
It might be relevant to mention that jenkins is running on a docker container,
Apparently the webhook must pass through a web server and not to jenkins directly, So I configured nginx as a reverse proxy to jenkins server and it worked fine.

Jenkins integration in Gitlab, "Jenkins url can't be blank"

When I try to link a jenkins project to my gitlab project, I have the following error :
Here is the form and the error message.
The jenkins project "test" does exists and the credentials are good.
The issue is probably not about the credentials but that gitlab seem to not be able to read the fields.
I tried with both chrome and Firefox.
I also tried to use webhook, but for services hosted on the same network, doc says it may be hazardous. So I'd rather use the first method.
Some information about my environment:
Linux Centos 7
jenkins and gitlab are built by docker-compose
hosted on localhost
jenkins and gitlab use different ports (8080 and 8081)
I found only one thread on the internet about it here but no answer were given.
Any ideas?
Thanks
This is my first post, I hope I did not make any mistake.\

Github jenkins webhook integration failed

I am trying to configure webhooks in github so that it will build every time I do a new push, I have added web hooks in github and given the address of jenkins which is http://localhost:8080/github-webhook/ but it did not work and I found out that we need to find our IP address and I added it as follows: http://"my IPV4":8080/github-webhook/ and it still didn't work. I have even tried using ngrok to port forward, but it didn't work as well. It constantly throws the We couldn’t deliver this payload: Failure when receiving data from the peer error.
You need a public IP address for Github to point to detect a push request. localhost is on your local machine. You can configure jenkins on EC2 if you want to set it up for some testing.
You can use a proxy agent Ngrok.
Command :
ngrok http 8080
It will generate http://{some-number}.ngrok.io, copy the generated public address and put in your github repository webhook http://{some-number}.ngrok.io/github-webhook
At this point when you save it, it will send a post request to ngrok server, got redirected to localhost and you will see a green tick.
You can refer to this document for configuring the whole process.

How to fix "We couldn’t deliver this payload: Couldn't connect to server" in github webhook while setting up a jenkins trigger?

I'm setting up a Web-hook in GitHub to trigger a Jenkins build for every push event. I'm running Jenkins from a Blue Ocean Docker container.
https://imgur.com/bNf5dMd
I'm able to access jenkins from http://192.168.99.101:32771/ , as specified in the docker container.
I have specified the git repository and checked "GitHub hook trigger for GITScm polling" checkbox.
I am able to manually kick off the build process after a commit, but when I setup the webhook in github with the payload url http://192.168.99.101:32771/github-webhook/ and commit something,
I get the error "We couldn’t deliver this payload: Couldn't connect to server"
Other solutions I've looked at.
Using ngrok. But I'm not running this on localhost.
I tried using a Personal Access Token and created an automatic webhook from Jenkins to Github. And I got the same error.
What am I missing, or what am I doing wrong?
Github will never reach to your Jenkins Server as your server is only accessible with-in network.
The error is very clear.
We couldn’t deliver this payload: Couldn't connect to server
http://192.168.99.101:32771 this is the same as your local host in term of access it from outside of the network.
Possible solution.
Run jenkins on some remote server with Internet access and give that IP in the webhook of the Github
Pass your public IP to Github, maybe you still issue with define port forwarding if there is any issue with access.
For anyone who's jenkins server is in a Ec2 instance of AWS and if it is in a private subnet, you can do two things:
Move your private ec2 into a public subnent
Create a Load balancer (ALB) within a public subnet and attach your private ec2 instance to that Load Balancer. Then use the address of ALB for you github hook.

Cannot access Jenkins Master URL on slave machine

I'm trying to configure the Jenkins Master/Slave on our AWS windows server. I looked at other posts and researched online and followed the steps. I installed Jenkins on the server, and changed the jenkins url to the ip address of the server by command ipconfig: http://x.x.x.x:8080/. On the Jenkins xml file, I added the line to the argument: --httpListenAddress=0.0.0.0.
I followed the online tutorial step by step guide to set up master and agent. On the agent computer, when i try to access the url, it shows This site can’t be reached. I added the port 8080 to the firewall. I also tried to ping from the agent to the master and it failed, said lost 4 100%. I am not sure how can I access jenkins master url outside of the server. Any help is appreciated.
The root cause is hidden in the comments, so for clarity posting it as an answer - looks like the problem was that the agent is running on a users laptop and it's trying to connect on a private IP of the jenkins server running in AWS. Things should hopefully work after connecting the agent on a public IP of the master instead.

Resources