Showing posts with label Jenkins. Show all posts
Showing posts with label Jenkins. Show all posts

Monday, March 5, 2018

Installing Jenkins on Windows with IIS. HTTPS configuration.

This post gives you an overview how to install Jenkins on Windows using IIS and reverse proxy.

Jenkins installation

Jenkins installation is pretty simple. Go to, download the latest version of Jenkins for Windows and install it.
By default, Jenkins will be available on 8080 port. Open your browser and navigate to http://localhost:8080. It is the address where Jenkins is running.

Setting up IIS

To setup reverse proxy you need to install the following IIS plugins:
Click on links above and you will be navigated to official installation source for both IIS plugins.

Reverse proxy for Jenkins

First of all, we need to create a new website. Create a new one with the name 'Jenkins'. After installation of IIS plugins, you should be able to configure a reverse proxy.

Follow the instructions from to setup HTTPS to HTTP reverse proxy for Jenkins.

HTTPS configuration

We will use Let’s Encrypt for certificate generation. Let’s Encrypt is a free, automated, and open Certificate Authority. And Certify tool to manage certificates.
  1. Download from and install it.
  2. Click 'New Certificate', choose your IIS site (which must have 1 or more hostname bindings set). Save your settings and click 'Request Certificate'
  3. All done! Click 'Configure Auto Renew' to set up the scheduled task for renewals.


Now we have a basic setup for Jenkins on IIS with HTTPS support.

Thursday, November 16, 2017

Fix Jenkins SMTPSendFailedException on Windows and Ubuntu 16.04


By default, Jenkins has disabled mail.smtp.starttls option and if you want to send notifications through any SMPT service which requires TLS, for example, through Gmail SMTP server, you need to enable this option. If the option is disabled you receive the following exception:

530 5.7.0 Must issue a STARTTLS command first. q15sm1393424wra.91 - gsmtp 

Fixing SMTPSendFailedException on Windows

1. Navigate to Jenkins installation folder. To find out exact installation folder you need to navigate to 'Manage Jenkins' page and check 'Home directory' property. By default home directory should be 'C:\Program Files (x86)\Jenkins'
2. Open 'jenkins.xml' and add '-Dmail.smtp.starttls.enable=true' to arguments. See XML-code snippet below:

<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dmail.smtp.starttls.enable=true -jar "%BASE%\jenkins.war" --httpPort=8080 --webroot="%BASE%\war"</arguments>

3. Restart Jenkins by navigating to {base_jenkins_url}/restart URL.

Fixing SMTPSendFailedException on Ubuntu 16.04

Basically, the steps are pretty the same as for Windows. First of all you need to figure out where Jenkins stores it configuration. By default, it should be '/etc/default/jenkins' file.

1. Open '/etc/default/jenkins' file.
2. Add '-Dmail.smtp.starttls.enable=true' to Java arguments.

# arguments to pass to java

# Allow graphs etc. to work even when an X server is present
JAVA_ARGS="-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true"

3. Restart Jenkins by navigating to {base_jenkins_url}/restart URL.

Wednesday, October 18, 2017

Configure Jenkins and Xvfb plugin on Ubuntu


Some build workflows in Jenkins require the display. If you run the build of Java application in console following exception might happen.
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using '' as the value of the DISPLAY variable.
I found a solution how to fix it using  Xvfb.

Installation of Xvfb

1. To install Xvfb run following command in terminal.
sudo apt-get update
sudo apt-get install xvfb

Installation of Xvfb Plugin

1. I have an assumption that Jenkins is installed and running on Ubuntu 16.04. Please follow installation instructions to install Jenkins in case you do not have running Jenkins. 
2. Install Xvfb plugin. Please follow instructions for plugins installation.

Configuration of Xvfb Plugin

If plugin configured incorrectly you might have the following exception:
ERROR: No Xvfb installations defined, please define one in the configuration. Once defined you’ll need to choose one under Advanced options for Xvfb plugin job settings and save job configuration.
To fix it:
1. Navigate to  Manage Jenkins → Global Tool Configuration → Xvfb installation
2. Set Name: Xvfb
3. Set Directory in which to find Xvfb executable: /usr/bin

Xvfb installation


1. In case you still have the issue, try to play with the configuration of 'Start Xvfb before the build, and shut it down after.' step. E.g.

'Start Xvfb before the build, and shut it down after' step