Home

Jenkins setup on EC2, Github integration, job to clone, build, and test a repo.

Jenkins Setup

To setup jenkins, i used an ubuntu server. The t2.small instance was too small to run jenkins properly thus i had to use t2.medium. Then i installed the dependencies, including common elements docker and golang.

I created a main.tf file and cloud-init.sh file, using the previous week's terraform modules. Now i can reproduce the instance with just a single command! The main.tf and cloud-init.sh files can be found on: https://codeberg.org/boink/cloud-scripts/src/branch/master/week-5

Jenkins plugins

To use docker, you'll need the docker and docker pipeline plugins. Docker must also be installed on the host system.

Automatic https and domain mapping

I used my previous work on ec2 instances where it automatically addresses the ip-address and gets a domain mapping. Then, using caddy and letsencrypt, the certificates are downloaded and served over https! You can find the site on https://ec2.ashwink.com.np

Github setup

You can use jenkins without an api from github, but if you're working with github, then the api limits become really painful really quick. Thus, it's better to setup a github app and use it's api. It also enables you to get automatic updates when you push to a repo, creating seamless experienec! The guide to integrate jenkins with github is on: https://github.com/jenkinsci/github-branch-source-plugin/blob/master/docs/github-app.adoc