5/12/2017

Setup Jenkins on Ubuntu


Installation
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

Upgrade

Once installed like this, you can update to the later version of Jenkins (when it comes out) by running the following commands:
sudo apt-get update
sudo apt-get install jenkins

Setting
Add user jenkins to your username group to allow it to read and write the your folder
sudo usermod -a -G YOUR_USERNAME jenkins
If you would like to change the port, you can edit the /etc/default/jenkins to replace the line
HTTP_PORT=8080
by
HTTP_PORT=8880
sudo service jenkins restart 
Then, try to open 0.0.0.0:8880, you will see authentication page. Now, you need to enter the password, you should get /var/libs/jenkins/secrets/ to see the password.


After that, you can go to a configuration page to set up your env variable.
http://localhost:8880/configure

For example, if you are using Android and gradle to build, you should setup ANDROID_HOME, ANDROID_NDK_HOME,  and JAVA_HOME as env variable.
  ANDROID_HOME : /home/darrenl/tools/android-sdk-linux
ANDROID_NDK_HOME
JAVA_HOME = /usr/lib/jvm/java-1.8.0-openjdk-amd64

Extra nice plugins

* Locale Plugin
* Email Extension Plugin
* Role Strategy Plugin

Run Jenkins with Do

Please refer to
https://github.com/tzutalin/docker/tree/master/Jenkins
https://github.com/jenkinsci/docker/blob/master/Dockerfile
https://github.com/maxfields2000/dockerjenkins_tutorial/tree/master/tutorial_07


Other references
Jenkins: Change Workspaces and Build Directory Locations
How to change build periodic
Jenkis pipeline with docker
Use email-plugin
Use email-plugin2
Create a test smtp server 
Simple project which use travis

No comments:

Post a Comment