Jenkins Within Vagrant Box

- 3 mins

Objective:

To get same versioned jenkins application running within a team in order to mitigate the fail over, vagrant box is built up in which Jenkins instance will be running.

Description:

While working in a team, every developer wants to test his code in sandbox environment. We do test our code continuously, for that we use Jenkins instance. After few days we realized that just to test the code , we needed to hop on to the central server where jenkins instance was running. But this jenkins was being used by other teams also which was a big confusion and mess. Then we decided to use local jenkins instance deployed on our own laptop. After few days we again realized that jenkins version varies from developer to developer. This does not matter in most of the cases. But being working in a security company. Trust me everything matters. What is being used ? what version is running ? What extra plugins has been deployed ? On and On. Then jenkins in vagrant has been opted out. In this blog , I tried to pen down the process that I had followed to build jenkins inside vagrant box.

Steps performed to get jenkins vagrant box:

vagrant init centos/7
#!/usr/bin/env bash
set -e
yum update -y 
yum install wget gcc kernel-devel -y 
cd /opt
wget http://download.virtualbox.org/virtualbox/5.2.26/VBoxGuestAdditions_5.2.26.iso 
mount VBoxGuestAdditions_5.2.26.iso -o loop /mnt 
sh /mnt/VBoxLinuxAdditions.run --nox11
unmount /mnt 
rm -f VBoxGuestAdditions_5.2.26.iso
vagrant package —output jenkins.box 
vagrant box add milinddhoke/jenkins jenkins.box 

Usage

config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "private_network", ip: "192.168.33.10"
vagrant up 

Once this command get through , your jenkins application is running on http://192.168.33.10:8080

Note: Initial log in to jenkins would be:

Username : admin

Password: jenkins

Vagrant box Link:

comments powered by Disqus
rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora