Installation and use of Jenkins

Posted by MishaPappa on Thu, 02 Jan 2020 12:29:43 +0100

What is Jenkins?

Similar to Travis CI, it is simply an online code building platform

Official website

https://jenkins.io/

install

The server

Service provider: Tencent cloud
 System: CentOS 6.8 64bit
 CPU: 1 core 1G
 Memory: 2G
 Hard disk: 50G

Environmental configuration

In this article, I mainly configure Java, Maven, Gradle and Android SDK. For the installation of these four software, I use the following methods: Download zip package, manually decompress, configure environment variables, OK

Example:

//Download decompression
wget https://xx.xx.xx
tar -zxvf xx.tar.gz

//Configure environment variables
vim /etc/profile
export JAVA_HOME=[Uncompressed file path]
export PATH=$JAVA_HOME/bin:$PATH  
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
//Basic template:
export XXX_HOME=[Uncompressed file path]
export PATH=$XXX_HOME/bin:$PATH

//Configuration effective
source /etc/profile

//If you have problems configuring environment variables, for example:
//-bash: XX: No such file or directory
//resolvent:
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
source /etc/profile
//My configuration: [home - > unzipped folder path]
#Java
export JAVA_HOME=/home/java/jdk1.8.0_181
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

#Maven
export MAVEN_HOME=/home/maven/apache-maven-3.3.9
export PATH=$MAVEN_HOME/bin:$PATH

#Gradle
export GRADLE_HOME=/home/gradle/gradle-4.4
export PATH=$GRADLE_HOME/bin:$PATH

#AndroidSDK
export ANDROID_HOME=/home/androidSdk/android-sdk-linux
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH

Software installation

sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins 

//start-up
service jenkins start/stop/restart

//Boot from boot
chkconfig jenkins on

//Browser open
http://ip:8080 -> Follow the prompts to configure

software configuration

Software environment configuration
System management - > system settings - > global properties

Mailbox configuration
Please refer to the email provider's instructions for related mailbox configuration
System management - > system settings - > mailbox notification & & Advanced
System management - > system settings - > extended e-mail notification & & Advanced

Test example

structure

Post build operations

After the construction, there are many operations, such as uploading to fir.im, notifying tools like Worktile and TAPD

The following shows the mail operation:

Topics: jenkins Maven Gradle Java