how to configure 'send email' in jenkins by proxy - jenkins

My Jenkins machine cannot connect to the internet. I want to configure Jenkins to work with a proxy server to send email. The startup parameter is:
-Dhttp.proxyHost=172.16.0.10 -Dhttp.proxyPort=3128
But it doesn't work.

Jenkins proxy settings are configured on the Manage Jenkins > Manage Plugins > Advanced tab.
If you can't get to that page in your Jenkins instance you will need to ask the person with Admin access to that Jenkins instance.

I configured the proxy by appending the below string in 'JAVA_ARGS' setting in '/etc/default/jenkins' and restart the Jenkins server.
-Dhttp.proxyHost=172.16.0.10 -Dhttp.proxyPort=3128-Dhttps.proxyHost=172.16.0.10 -Dhttps.proxyPort=3128

You can configure the proxy properties on Manage Jenkins > System configurations. In this page you can find "Global Properties" configuration and in this part you have to push the "add" button and put there the HTTP_PROXY, HTTPS_PROXY and NO_PROXY properties. These proxy properties should contain the proxy configuration like in the operating system. You can see an example of this configuration in the next image:
You should replace the properties:
<$PROTOCOL> -> Proxy address protocol (http, https, ...)
<$USER> -> Proxy user authorization (If the proxy require it)
<$PASS> -> Proxy password (If the proxy require it)
<$PROXY_DNS> -> Proxy URL or Proxy IP
<$PORT> -> Proxy port
<$DNS1>,<$DNS2>,... -> URL where the proxy don't should be used

Related

Jenkins - Plugin Manager Configuration

I'm new to Jenkins and I'm not sure about what info should in --> Server "[ ]"
Should i paste the Jenkins url ?, my computer ip ?, ipv4, ipv6?
I'm getting an error probably because that configuration is not ok.
I try to paste url Jenkins localhost info but I'm getting error.
I presume you mean on /pluginManager/advanced, "Manage Jenkins > Manage Plugins > Advanced. HTTP Proxy Configuration | Server".
If you can click on "Check Now" on the Plugins page it it updates the plugins list, then you don't need to do anything.
Assuming you are behind a firewall, enter a Proxy Configuration (1) value. It can be an IP address, a hostname or a PAC file. Port is necessary, other fields optional as needed.
]
After adding a value, click on the "Advanced" button; there is a Validate Proxy option. Make sure the "Server" value omits the "http://", but the "Test URL" includes the full url (it can be any external url you choose; eg: https://google.com or https://github.com).
The Server (?) help option also notes:
If your Jenkins server sits behind a firewall and does not have the
direct access to the internet, and if your server JVM is not
configured appropriately (See JDK networking properties for more
details) to enable internet connection, you can specify the HTTP proxy
server name in this field to allow Jenkins to install plugins on
behalf of you. Note that Jenkins uses HTTPS to communicate with the
update center to download plugins.
Leaving this field empty means
Jenkins will try to connect to the internet directly.
If you are unsure about the value, check the browser proxy
configuration.
Note: There is a field under the configure "Manage Jenkins > Configure System" page for:
Jenkins Location
Jenkins URL "[ ]"
That would be your localhost name / IP if necessary
This value is used to let Jenkins know how to refer to itsel
(1) No idea why this wiki page was not migrated to the new wiki.

Jenkins pointing server to domain created

Good Morning
I have created a Jenkins server in AWS I am able to access the platform using the IP of the server
however, I want to access it more securely.
I have set up a subdomain on my hosting service and I set the IP of the server as an A record
I have also defined this in the configuration section of Jenkins
however, when I access the URL https://domainname I get nothing
but if I add 8080 at the end of it it takes me to the Jenkins platform
what am I missing here?
Thanks
I recommend you to use AWS Application Load Balancer to access to you jenkins web server.
I will host https certificat (if you are using AWS Certificate Manager) and you will be able configure DNS to redirect to ALB name.

JNLP port is missing from Configure Global Security in Jenkins

I'm creating a windows slave in Jenkins and for that, I need to use the Java Web Start as a launch method in slave configuration.
I'm aware that to view this option in slave configuration, we need to change the setting in Manage Jenkins>Configure global security>Agents>TCP JNLP AGents to Random from disabled.
But in my case, I'm not able to see the JNLP port agent, the option visible is "TCP port for inbound agents" instead of "TCP port for JNLP agents".
I've installed JDK in Manage Jenkins>Global tool Configuration, but after this as well it's not giving an option for JNLP agents.
Can someone please help with this, where I can view the "TCP port for JNLP agents" option under Jenkins>Configure global security>Agents
The 'TCP port for JNLP agents' setting seems to be not available anymore in the 'Configure Global Security' settings. Instead of that modify your agent's settings and set Launch method as 'Launch agent by connecting it to master'. It works similarly to the option that you are looking for:
Agents communicate through each other over TCP.In my case i couldnt find "TCP port for JNLP agents".Solution for it is,before creating an agent ,go to Configure global security ->section labeled "Agents" and the line that says "TCP port for inbound agents". Insert a valid port value for the TCP port for inbound agents. Apply that change.
Then goto Configure Jenkins -> Manage Nodes -> create new node or configure node
Choose the setting "Launch agent by connecting it to the controller" under Launch Method.
The phrasing has been improved significantly in the user interface by removing the references to "JNLP". The key difference between the agent protocols is not the underlying transport, but rather which end initiates the connection. The agent launch method that was formerly called "JNLP" is a launch method that initiates the agent connection from the agent to the master. The launch method called "ssh" initiates the connection from the master to the agent.

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

Trigger remote Jenkins job on GCE VM

I am currently running Jenkins on a GCE VM. As a build step, I want to trigger a Jenkins job on another VM in the same project. The problem is, HTTP and HTTPS access to the VMs is disabled, and I cannot use curl to trigger it remotely. An SSH tunnel remains the only option. But SSH onto a VM requires a google_compute_engine private key file, which helps you log in to a particular user..I was confused about how to use this file for the Jenkins user, which does not have a separate shell and was hoping for some advice. Thanks in advance!
The easiest way is to apply the default firewall rules to allow HTTP and HTTPS traffic to the instance by setting the Allow HTTP traffic and Allow HTTPS traffic checkboxs on in its detailed view at Developers Console, or adding the http-server and https-server tags manually by using gcloud command: "
gcloud compute instances add-tags INSTANCE --tags http-server https-server".
Setting up an SSH tunnel to Jenkins port of service is a possibility and it doesn't require using google_compute_engine key necessarily. You can configure and additional key and copy the public part for that key into Jenkins user's authorized_keys file directly, as you would with any other server. See this link for more details. If you use a custom SSH key, remember to specify the related private key when setting up the tunnel.
Another more straight-forward option would be creating new firewall rules for Jenkins ports and applying them to the Jenkins instance.

Resources