Jenkins used in two ways
Simplify, from the initial understanding of Jenkins', to use Jenkins landed, found there will be two kinds of ideas:
-
重 Jenkins
, Jenkins control the entire update process. such as:- Pulling code, compiled
- Production docker image, upload warehouse
- Remote mirroring open Docker containers, etc.
Heavy Jenkins, will inevitably lead to specific projects done in accordance with Jenkins docking specification, increase the number of additional workload
-
轻 Jenkins
, Jenkins only as a layout controller does not participate update details- Jenkins is responsible Around: control panel, update history, mail notification, automatic triggering and more
- Project update provided by the server script
- The project parties need to know Jenkins. Jenkins project no party can also perform a manual update server script
This article describes 轻 Jenkins
Jenkins update server method
Jenkins notes under the first deployment environment, and finally how 轻 Jenkins
Installation Jenkins
The official document:
Centos7 installation script is as follows:
#!/bin/bash
set -ex
yum install -y java-1.8.0-openjdk
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install -y jenkins
systemctl enable jenkins
systemctl restart jenkins
First Run
The official document: https://jenkins.io/doc/book/installing/#unlocking-jenkins
The article mentions the following things:
- It will be prompted to enter the token.
View token as follows:sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- You will be prompted to install the plugin. Click Custom installation, ssh relevant search plug-in and hook on
- You will be prompted to create an administrator account. We can create the next
- (Optional) Chinese plug-in installation, installation of
Localization: Chinese (Simplified)
plug-ins
Set up凭证
Jenkins 凭证
means that all kinds of password, such as:
- GIT account password
- SVN account password
- SSH account password
- SSH private key account etc.
The official document: https://jenkins.io/doc/book/using/using-credentials/
Figure exemplified below:
1, a left click on the main interface 凭证
:
2, a click on the left main interface 凭证-系统
:
Figure 3, click 全局凭据 (unrestricted)
- 添加凭证
:
Fill out information, you can add the next
Set SSH remote hosts
Jenkins disposed remote manipulation更新机
Click on the main interface 系统管理
-系统设置
Setting example:
After setting, 轻
Jenkins method has completed 90% of the
The last update took the script to specific projects
轻 Jenkins
principle
Timing diagram analysis:
- Jenkins just need to know:
- Linux SSH account
凭证
- Linux SSH remote hosts
- Script commands to be executed
- Linux SSH account
- specific project
- According to their own circumstances, to deploy a variety of ways:
- Can Docker
- Can K8S
- Be an executable file, and so on
- Direct local deployment, update
- Project update service can manipulate project aims clothes, etc.
- According to their own circumstances, to deploy a variety of ways:
The last presentation, Jenkins was how SSH script execution project update service
New Task
Directly on the map Description
1, a click on the left of the main screen 新建任务
, FIG fill information, click OK.
2, fill in the 构建
information, point 保存
to
the above