How to configure jenkins on ec2 to run whenever there’s a new build in my project repository

I wanna set a jenkins CI for the first time in a linux EC2 (I’m working from windows). My jobs are in maven.

The thing is: how do I set jenkins to detect whenever there’s a new build in my remote ec2 repo, how do I connect them both?

I tried to look up online but all I could find were steps related to github.

By the way, I installed only jenkins (and related packages) on the linux ec2 server. I havent installed tomcat, not sure if that’s relevant to mention or not.

So, how to configure this?

Answer

Jenkins CI is a Java application, and as such, can be deployed as an standalone application and run via java -jar jenkins.war, or you can deploy the war file to a J2EE application container such as Tomcat.

To your question, you don’t provide specifics about what kind of code repository is this or how is it exposed to Jenkins, so I’ll just assume you can clone over HTTP(S) from Jenkins.

To do this, install a plugin for your type of repository (git, mercurial, subversion) and configure to point to your repository.

With regards triggering your maven jobs, this can be done in two ways:

  • push mode: create a hook on your repository to instruct Jenkins it needs to run a job. This is done through the Jenkins API.
  • pull/poll mode: configure the plugin in Jenkins to regularly check the repository for changes. This method is discouraged.

Attribution
Source : Link , Question Author : Luna Paglarelli , Answer Author : dawud

Leave a Comment