How to Install Jenkins CI on Cloud Foundry for Continuous Delivery
interesting article
Summary importants things
Linux academy course
Best practice
- backup at least jenkis home
- building from source console generate build clean
- integrate with an help system
- take an advantage from automate java builds
- install jenkins in the disk with moost of storage it
- before delete a job have an archive copy
- better not delete job but move to an archive
- don't create a job to build production, dev, test one job for one environment
- email jobs to developer
- use jenkins for run multiple process for many server
- tag, merge or baseline your source code
- keep your jenkins updated at least on the latest LTS version
- keep up to date the plugins
- don't build on master
Prerequisites
install java download the jdk from oracle website
define the alternative
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000
tell us which configuration we are using
alternatives --config java
add the env variable
vi /etc/rc.d/rc.local
export JAVA_HOME="/usr/java/latest"
others to report
Configuration tour
at creation time is created a jenkins user , but if you look inside the /etc/passwd file you can see that there is like shell /bin$
cd /var/lib/jenkins
is the main directory
in the subdirectory jobs there in xml format all the jobs , created. At the begining is empty
userContent subdir is where we can insert documentation and see the html from the tomcat
cd /var/cache/war
is the dir with the war of tomcat
in WB-INF there are all the plugins for jenkins
all the changes in this directory will be lost at the jenkins upgrade
Securing Jenkins
Manage Jenkins ==> Configure Global Security and enable security
Managing Credentials
- it is necessary have passwordless channel for other machines
- first of all change the shell of the jenkins user from /bin/false to /bin/bash
- do a ssh-keygen and see if the key is generated in /var/lib/jekins/.ssh or something similar
- from the web interface in Credentials enable the new key
- try from bash to copy the keys and login to other machines
Plugin Management
- After the installation of a plugin you need to restart the jenkins
- test in a not production instance because every time can create problems, they are java program so can throw exception
- we can downgrade , disable or remove plugin
Lecture: Jenkins Backup - Using Plugins to Manage Your System
- Backup Plugins (Backup Manager), for jekins home directory where the jekins process are
- thinBackup: it is possible schedule
Builds
"Build Executor Status" how many builds we can run before the them go to a queue
To install a plugin , "Manage Jenkins" => "Manage Pluging"
the plugin for git
- Git Client pluging
- git Pluging
- git server pluging
- github api pluging
- github pluging
you don't need to keep all the previous build if you manage your jobs with git
Link builds
check the option "Build after other project are build" specify the other project name , so in the main project you will see "Upstream Project" in the other one "Downstream project".
It is possible specify to active the main project only if the other project run succefully
Maven
"Manage Jenkins" ==> "Configure Jenkins" go the maven section