Jenkins says: Error: connect ECONNREFUSED 127.0.0.1:80 while trying to list jenkins jobs on slack using hubot - jenkins

I wanted to have a bot integrated with slack, using which my team can run Jenkins builds. I tried doing it using hubot, following the steps here: https://slack.dev/hubot-slack/
I mentioned all the variables (jenkins_url, jenkins auth -username:password, slack token) in .bashrc and sourced it. The bot connected to slack and when run #hunot help, it will list all the options. So far so good.
I also included jenkins.coffee script in hubot-scripts.json, to reach jenkins however, I'm unable to connect to jenkins. When I run #hubot help, it lists jenkins commands as well. The problem arises when I actually run one of those jenkins commands. When I run #hubot jenkins list, it returns Jenkins says: Error: connect ECONNREFUSED 127.0.0.1:80
I'm not sure what the issue is. On my jenkins host, I'm using nginx, reverse proxy (so that I don't have to use 8080 in url while accessing jenkins). Is there something obvious I'm missing?
Also, how can I access jenkins without user and password?

Related

gitlab plugin test connection issue on jenkins

Im having issue with gitlab plugin test connection on jenkins. it gives error when I hit the "test connection" button with the given values.
GitLab user is maintainer and has full access on it. GitLab API token belongs to this user.
unfortunately it seems no way to track this error. I checked the logs files in jenkins machine as well.
GitLab Plugin Version is -> 1.5.27
you may see screenshot of the page here
alternative link:
https://gyazo.com/2b81c4310c7a144651fda54c6b1462c1

Jenkins - Master Slave set up questions

I followed tutorial to get Jenkins set up on Windows.
What i have is:
Jenkins running with recommend plugins installed
Jenkins URL changed to http:// my ipv4:8080/
A project with a simple command [echo hi]
For nodes i currently have just the Master node which is tied to my main PC
My goal is have one computer send a command to all the slave PC's so they run a python script i created.
I create a windows VM and connected to the Jenkins server. I logged in with the admin account and created a new node.
I cant find anything useful to help me figure out what to put in launch command. When i launch my node on the VM without the launch command specified, it fails to launch.
Is the batch script i wrote in the project, what's sent to all the slave machines or do I have this all wrong?
Thank you!
EDIT
I got it working thanks to the answer posted here. I wrote up a doc on how i got Jenkins working from installation to deployment. There are other resources out there but i hope this will help someone.
Jenkins Master/Agent Setup
If you want to have the option Launch slave agents via Java Web Start you should specify the TCP port for slaves.
It is done through Manage Jenkins > Configure Global Security > TCP port for JNLP agents. You can select fixed port 50000. More info here.

Automatic build with Jenkins and GitLab

I deploy Jenkins and GitLab using Docker (locally), both are connected with each other.
One of the problems (not very important) is with SSH. I create ssh key inside Jenkins container and set it to GitLab, but when Jenkins try to checkout the repository throws "Permission Denied". So, executing Jenkins bash, try to run git command and what's happen? GitLab container needs a password for access. Searching, and trying to do as a virtualized server, no works. Whatever, I solved using user and password (I don't like, but works).
The important problem. I don't have any problem creatin, and running, a job (using pipelines). The job download the world from GitLab and send the result to GitLab. The problem, after add a webhook with Jenkins URL to GitLab, push something but nothing happens in Jenkins, not trigger the job.
Anyone can help me?
Thanks!!
Is your webhook working correctly ?? are you able to send/receive request and response, if not refer to
Github webhook URL config issue? How to fix it?
When you push does it trigger a request ? can you try hitting it with postman if you do have a request. If you can provide more information, then it will be helpful :)

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.

hooking gitlab with jenkins

I'm trying to connect Gitlab CE 8.16 with Jenkins 2.46.1 using the GitLab hook plugin 1.4 to trigger builds when push or merge.
So I checked "Build when a change is pushed to GitLab", copied the GitLab CI Service URL: http://server:port/project/my-project and the security token, to gitlab webhook, disabled ssl verification and when I clicked on Test, I got this error :
Hook execution failed: execution expired
What am I doing wrong, please? How can I make it work?
There are a few things that are needed to make it work, there is documentation here:
https://github.com/jenkinsci/gitlab-plugin#global-plugin-configuration
So:
Make sure the jenkins user that you use on the GitLab side has the proper permissions - it needs project access and the APITOKEN needs to be there
Create the webhook on the project in GitLab that corresponds to the project in Jenkins (the Jenkins project that uses the git repo you are working with)
In GitLab, when you create webhooks to trigger Jenkins jobs, use this format for the URL and do not enter anything for 'Secret Token': https://USERID:APITOKEN#JENKINS_URL/project/YOUR_JOB
You can use a non-https link too and skip SSL verification if the certificate is not valid. Either way, the gitlab server has to be able to connect to the name and port you are using there.
Hit test and it should work, if not, you might not be able to connect to the server. Make sure your Jenkins server is listening on the URL and port that you are using, the error seems to be related to that not being right.
It's possible that GitLab server is not allowed to connect to the internet, or to the network you have the Jenkins server on, or there might be a firewall blocking the port you try to connect to (80/443) on the local Jenkins machine.
Try to do for example a curl to the Jenkins server and see what comes back:
curl http://you.jenkins.fqdn/
If you don't get something like:
<html><head><meta http-equiv='refresh' content='1;url=/loginEntry?from=%2F'/><script>window.location.replace('/loginEntry?from=%2F');</script></head><body style='background-color:white; color:white;'>
Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Read
... which is implied by: hudson.security.Permission.GenericRead
... which is implied by: hudson.model.Hudson.Administer
-->
</body></html>
then you cannot connect.
If it's not the Jenkins server where the issue is, you need to ask the network people that manage the server about it.
Hope that helps, good luck!
Make sure to use the latest 1.4 GitLab hook plugin (1.4.3, March 2016)
Look into your GitLab production.log, as in this issue, and see if this is a proxy configuration problem.
You should at least the context of that error message.
Here is what worked for me:
Ensure there is a merge request, even if you don't intend to actually merge any branches.
Go to branches -> select 'merge request' for a branch to merge -> create the request
Now try to test the integration.

Resources