Skip to main content

Source Control Polling

Updated May 15, 2020 ·

Lab Environment

In this lab, we have the following Linux machines, and we will use a local computer (laptop) to connect to them.

  • jenkinsmaster

You can choose to set up a virtual machine on your computer or create instances in the cloud. In this case, EC2 instances are used.

Note that for this lab, we'll only be using jenkinsmaster and you can disregard the other tstsvrs and jenkinsslave1 for now.

Setting Up Jenkins

If you have your Jenkins server already setup, you can skip this section. There's an option to manually install Jenkins on a Linux machine or you can also use Ansible playbooks to perform the entire installation of Jenkins on this machine.

To setup Jenkins:

Polling

This is continuation of the Maven-based Jenkins lab.

In this scenario, Jenkins is polling the source code repository for nay changes. If it detects updates, it will trigger a build. This can be configured in the Build Triggers section. Tick the checkbox for Poll SCM then put in the cron schedule (how frequest Jenkins will poll the repsitory.)

As a recap, each line in cron consists of 5 fields separated by TAB or whitespace.

In our example, we'll set it to poll every minute.

A new tab should appear on the panel on the left. After a minute, click Git polling log.