Jenkins Slave node. how to display server URL in slave command line? - jenkins

I created a slave for jenkins. when I access the node from slave machine it shows
Run from slave command line:
javaws http://localhost:8080/computer/Dimantha/slave-agent.jnlp
how to display IP address of master server instead of 'localhost'?

I have encountered this issue before and here is the solution:
Manage Jenkins-->Configure System-->Jenkins Location
Then change the Jenkins URL to actual IP or hostname.

Your master's configuration is probably set wrong.
In the Jenkins master configuration, you should edit Jenkins URL to the actual IP or hostname so it will be resolved correctly when accessing from a browser like in your example.
I hope this helps.

Not sure what you're asking - since this is a command line, you just edit the command and replace localhost with your master server name.

Related

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.

How to give a meaningful hostname (XYZ.com), replacing "localhost:8080" in Jenkins

I recently started working with Jenkins for CI/CD for ASP.net applications.
I have built a Jenkins server and created the required jobs with appropriate plugins.
My Jenkins is configured with localhost:8080 initially.
Later I was asked to give a meaningful host name (xyz.com), so that with in the organization all IT employees can access without logging in to the server to access Jenkins.
I have already tried to change the configurations under manage Jenkins -> Configure -> Jenkins Location (Jenkins URL), changed it to "localhost:80" and added "127.0.0.1 xyz.com" in the host file.
I have changed the port number in Jenkins.xml file even.
It didn't work for me because I had to browse "xyz.com:8080"
My final result should be "xyz.com" and should be accessible for the entire team.(I will take care of DNS).
Any help would be appreciated.
Thanks in advance.

There is no "Launch agent via Java Web Start" option in my jenkins when I adding a windows slave node

I have already configured the java enviroment and installtion
path
This is a duplicate question from Server Fault: Answer Here
Java Web Start utilizes TCP so it has to be enabled and configured in Jenkins...
Login to Jenkins as admin
Manage Jenkins > Configure Global Security > TCP port for JNLP agents
Do yourself a favor and pick a static port assignment...
As of Jenkins version 2.176.3, there is option enabled when "Launch agent by connecting it to the master" which is same as "launch agent via java web start" once you enable the "Manage Jenkins => Configure Global Security => Agents => TCP port for inbound agents" as mentioned above.
e.g. Fixed: 50000
Make sure that you've enabled a JNLP port in Manager Jenkins -> Configure Global Security. If no JNLP port is specified, then the JNLP slave option will not appear.
I had similar issue after updating my Jenkins, I then used "Launch agent by connecting it to the master" method to launch and my port "TCP port for inbound agents" under
- Manage Jenkins => Configure Global Security => Agents => TCP port for inbound agents got changed to 8888. I have updated it back to 50000 and that resolved the issue. Hope it helps.
On some systems I used to get a button to download the agent's JNLP. On my new linux mint system, I instead get the "JNLP not available" message. So was lost as to where to get the JNLP file. However, looking in the command below I saw the URL for downloading it, eg:
http://127.0.0.1:8080/computer/build_slave/jenkins-agent.jnlp
Go to the slave machine, paste the URL in the browser to download it!
This might also be due to missing permissions for the user trying to setup the agent via java web start, at least that was the case in my scenario;
To verify this, try to download the jnlp directly; URL would be of the form [jenkins url]/computer/[agent name]/slave-agent.jnlp, if there is a permissions issue you will get something along the lines of:
Access Denied
xxxx is missing the Agent/Connect permission

How to access / share Jenkins from another computer?

I installed jenkins (localhost:8080) on RHEL and I am able to build code successfully
Now, I want to setup master / slave agent.
My laptop will act as 'Master Jenkins' and my colleague's will be 'Slave'
However, my colleague could not connect to 'Master Jenkins' and we both are on SAME LAN and able to ping each other
I tried the following but nothing worked
(a) Changed --httpListenAddress=0.0.0.0
(b) Changed --httpListenAddress=<my laptop ip>
(c) Changed --httpListenAddress=<my colleague's laptop ip>
and my colleague tried 'telnet <my laptop ip> 8080' from his laptop and did not work
Please help me to resolve this issue and I am new to Jenkins
Jenkins should host it's own service, so that is probably not the problem. Is your firewall open on port 8080?
Issue has been resolved by adding the port no '8080' in firewall
Goto 'Computer --> More Applications (or) Control Center --> Firewall --> Other Ports --> Add'
For all Mac Users. None of the above worked for me I installed Jenkins using HomeBrew.
go to
~/Library/LaunchAgents/homebrew.mxcl.jenkins.plist
and Change the httpListenAddress value from 127.0.0.1 to 0.0.0.0.
Since this homebrew.mxcl.jenkins.plist file in placed in LaunchAgents you need to restart your machine to make this effective.
Open the POrt 8080 via firewall and then change the URL of jenkins from "Manage Jenkins>Config Sys>Jenkins Location>" to "http://yourIP:8080" and then access it from other machine on same network domain.
I found that, after upgrading the local Java instance, Jenkins was no longer accessible over the domain. The fix was to update the path to the new java.exe, in the Programs and Services tab, in the Properties of the Jenkins rule, in Windows Firewall Advanced settings. You may also use the "All programs that meet the specified conditions" setting, but I do not know the impact that choice would have on the security of the server.

What does "Jenkins URL" means in configuration settings?

On Jenkins configuration page in section "Jenkins URL" I've set this option to "http://name_of_my_machine.jenkins:8080/"
Usually I open jenkins by: "http://localhost:8080/"
But this new option did not work for me - Jenkins does not open. So what does it mean?
Jenkins can't determine its URL on its own. So when it needs to create full links that's where the URL is taken from. In general even if you specify the wrong URL it should not affect the way Jenkins works in any significant way. It certainly has no effect on the URL that you enter in your browser to connect to Jenkins server. You can either specify http://localhost:8080 (when connecting from your machine and assuming that you started Jenkins on port 8080) or http://<machine_hostname>:8080 when connecting from anywhere.
So no matter what you specify it has no effect on connecting to Jenkins, therefore http://name_of_my_machine.jenkins:8080/ won't work, as .jenkins is not part of the name (e.g. ping name_of_my_machine.jenkins won't find the host).
Whenever Jenkins needs to create a URL that points to itself, Jenkins picks it up from the "Jenkins URL" setting in the global configuration.
Jenkins could try to guess the URL by e.g. getting the hostname and combining that with the port it is running on. But sometimes the hostname is not the same as the DNS name. And what if you have placed a front-end or proxy before Jenkins that e.g. terminates SSL connections and you would really like people to use Jenkins at https://company.com/jenkins/. Jenkins running in port 8080 cannot know about the front-end. The only reliable way for Jenkins to get the URL to itself is for an administrator setting it in Jenkins configuration.
Jenkins needs to know it's own URL when it is creating links that point back to itself. It does this e.g. when it sends out emails containing direct links to build results. Also, if you have a JNLP type slave, the slave initiates the connection to the master and the master returns a message which contains a link back to Jenkins for downloading the slave agent software.
Do you mean the option in the E-mail configuration section? This is only to generate the links in emails Jenkins sends (see the help for the option -- click the symbol with the question mark). If after changing it you cannot access your server anymore, it must be something else.

Resources