jenkins Git source code configuration management

jenkins Add git plugin plugin

Jenkins git plugin plug main achievement of the build process to interact with Git

Installation Method 1: System Administration -> Plugin Manager -> Optional plug-in find git plugin, otherwise can not find the need over the wall

Installation Method 2: Import the offline package, go to System -> Plugin Manager -> Advanced -> to upload the plugin

Plug Download: http: //updates.jenkins-ci.org/download/plugins/git/, download a file named git.hpi, wait for the installation successfully imported

     


jenkins configure git path

Go to System Management -> Global Configuration Tool


jenkins account configuration

1. Add a password to the account jenkins

sudo passwd jenkins

2. jenkins account does not need to add sudo permissions password

编辑/etc/sudoers
sudo vim /etc/sudoers

Add sudo permissions do not require a password, add:

Username ALL = (ALL: ALL) NOPASSWD: ALL

3. jenkins account to generate keys and configuration rights

# 切换jenkins账号:  
  sudo jenkins
# 生成公钥与私钥:    
  sudo ssh-keygen -t rsa -C "你的邮箱" -f ~/.ssh/jenkins
# 修改/var/lib/jenkins/.ssh文件所有权为jenkins
  sudo chown -R jenkins:jenkins /var/lib/jenkins/.ssh
# 修改/var/lib/jenkins/.ssh的权限为700
  sudo chmod 700 /var/lib/jenkins/.ssh
# 修改/var/lib/jenkins/.ssh/authorized_keys的权限为600
  sudo chmod 600 /var/lib/jenkins/.ssh/authorized_keys

4. jenkins public key added to git

cat /var/lib/jenkins/.ssh/jenkins.pub           查看公钥
vim /home/git/.ssh/authorized_keys              添加公钥到git

5. jenkins private credential added to jenkins-

cat /var/lib/jenkins/.ssh/jenkins    查看私钥

 

Add git source code management project

1. Create a new task, enter the task name, choose - to build free-style software project and save

2. Add Account and select a git repository path configuration

3. Add the Automated Test Run

4. Construction of automated test results

personal blog

Published 59 original articles · won praise 19 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_43507959/article/details/102689513