Pipeline流水线及流水线发布PHP项目

Jenkins的Pipeline流水线

主机名IP地址备注
Git 192.168.200.70 Git服务器
Jenkins 192.168.200.91 Jenkins服务器

cat /etc/redhat-release

uname -r

systemctl stop firewalld

systemctl disable firewalld

systemctl stop NetworkManager

systemctl disable NetworkManager

image_1cvga4o1d1nhr1bm16gh2b21mq79.png-19kB


image_1cvga5f0r1lp81p1c15461um716mbm.png-20.8kB

 

Pipeline流水线介绍

 

创建一个基于Pipeline流水线的项目

image_1cvgahs3go0dd91ob29f1jh113.png-171.8kB

 

添加项目Git参数化构建

Git Parameter插件不支持流水线,版本过低

image_1cvgal86u14461pbi1qlt4631hiu1g.png-128.6kB


image_1cvgcrd9l1fvk1ff9117d80l1asn4b.png-133kB

 

Pipeline脚本语法架构介绍

 
  1. #Pipeline脚本语法架构
  2. node 'slave节点名' { #被操控的节点服务器
  3. def 变量 #def可以进行变量声明
  4. stage'阶段名A'){ #流水线阶段一
  5. 执行步骤A
  6. 执行步骤B
  7. 执行步骤C
  8. }
  9. stage'阶段名B'){ #流水线阶段二
  10. 执行步骤A
  11. 执行步骤B
  12. 执行步骤C
  13. }
  14. stage'阶段名C'){ #流水线阶段三
  15. 执行步骤A
  16. 执行步骤B
  17. 执行步骤C
  18. }
  19. }

图片说明image_1cv23in37uhlu6vkevi8j1blf36.png-52.3kB

 

流水线模板脚本

 
  1. node {
  2. def mvnHome
  3. stage('Preparation') { // for display purposes
  4. // Get some code from a GitHub repository
  5. git 'https://github.com/jglick/simple-maven-project-with-tests.git'
  6. // Get the Maven tool.
  7. // ** NOTE: This 'M3' Maven tool must be configured
  8. // ** in the global configuration.
  9. mvnHome = tool 'M3'
  10. }
  11. stage('Build') {
  12. // Run the maven build
  13. if (isUnix()) {
  14. sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package"
  15. } else {
  16. bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean package/)
  17. }
  18. }
  19. stage('Results') {
  20. junit '**/target/surefire-reports/TEST-*.xml'
  21. archive 'target/*.jar'
  22. }
  23. }
 
  1. node {
  2. //def mvnHome
  3. stage('checkout') { // for display purposes
  4. checkout([$class: 'GitSCM', branches: [[name: '${branch}']],
  5. doGenerateSubmoduleConfigurations: false,
  6. extensions: [], submoduleCfg: [],
  7. userRemoteConfigs: [[credentialsId: '9f98962f-1a82-4da1-8a0f-bc906e92d998',
  8. url: 'git@192.168.200.70:/home/git/repos/app.git']]])
  9. }
  10. stage('maven Build') {
  11. echo "maven build ..."
  12. }
  13. stage('deploy') {
  14. echo "deploy..."
  15. }
  16. stage('test') {
  17. echo "test..."
  18. }
  19. }
 

利用Pipeline Syntax,编写Pipeline Script并构建

 

(1)进入Pipeline Syntax

 
  1. node {
  2. //def mvnHome
  3. stage('checkout') { // for display purposes
  4. }
  5. stage('maven Build') {
  6. echo "maven build ..."
  7. }
  8. stage('deploy') {
  9. echo "deploy..."
  10. }
  11. stage('test') {
  12. echo "test..."
  13. }
  14. }

图片说明image_1cv23khv119hv1d1c1pohpqc1c573j.png-78.2kB

image_1cvgbi1e01suc1ne71u4j114r187t2n.png-130.9kB

 

(2)通过脚本代码生成器,生成Pipeline脚本代码

图片说明image_1cv23ndii1ros1j6i1tjhial12j6l.png-129.9kB

image_1cvgb6ankcseng11voa1ckm1ku1t.png-178.8kB


图片说明image_1cv23nom2180fjbt1r1c1nl615lq72.png-74.8kB

image_1cvgbck6o17drisgidj1cdk19st2a.png-171.3kB

 

(3)将生成的代码复制到流水线脚本相应步骤的stage函数里

 
  1. checkout([$class: 'GitSCM', branches: [[name: '${branch}']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '9f98962f-1a82-4da1-8a0f-bc906e92d998', url: 'git@192.168.200.70:/home/git/repos/app.git']]])

图片说明image_1cv23o98i15glmos1tqh1iib1u5h7f.png-57.8kB

image_1cvgbli8813tm1h736c1sco1b6134.png-145.5kB

 

(4)开始构建Pipeline项目

image_1cvgcme0nl7i1jc52ni646to53u.png-98.3kB


image_1cvgd0cbghea1ejpi9h32rh9t4o.png-83.7kB


图片说明image_1cv23peer1p3b1cj917fk3ire4f89.png-66.6kB

image_1cvgd1iv41mge1qs2g26iad17m55l.png-115.4kB

 

(5)在Jenkins本地服务器查看拉取结果

cd /var/lib/jenkins/workspace

ls

image_1cvgda5jds8o1a29p3q1v95hfo62.png-25.7kB

 

从远程仓库下载Pipeline Script,并构建

 

(1)在Git服务器上创建一个存放Pipeline脚本的仓库

su - git

cd /home/git/repos/

pwd

ls

mkdir jenkinsfile #创建存放Pipeline脚本的仓库

cd jenkinsfile/

git --bare init #初始化仓库

image_1cvgehc7c1vsjt5u1aj18hq1fub6f.png-46.3kB

 

(2)在jenkins服务器上,往远程仓库提交一个Pipeline脚本。

mkdir /test

cd /test

git clone git@192.168.200.70:/home/git/repos/jenkinsfile

ls

cd jenkinsfile/

mkdir itemA

vim itemA/jenkinsfile

cat itemA/jenkinsfile

 
  1. node {
  2. //def mvnHome
  3. stage('checkout') { // for display purposes
  4. checkout([$class: 'GitSCM', branches: [[name: '${branch}']],
  5. doGenerateSubmoduleConfigurations: false,
  6. extensions: [], submoduleCfg: [],
  7. userRemoteConfigs: [[credentialsId: '9f98962f-1a82-4da1-8a0f-bc906e92d998',
  8. url: 'git@192.168.200.70:/home/git/repos/app.git']]])
  9. }
  10. stage('maven Build') {
  11. echo "maven build ..."
  12. }
  13. stage('deploy') {
  14. echo "deploy..."
  15. }
  16. stage('test') {
  17. echo "test..."
  18. }
  19. }

image_1cvgekhgirmqpmb4h714o91rq96s.png-76kB

 

将脚本推送到远程仓库的master分支

git add *

git commit -m "jenkinsfile"

git push -u origin master

image_1cvgelf9a19ir1hb7s3jg17mdi79.png-49.3kB

 

(3)利用远程仓库里的Pipeline脚本,进行流水线的构建

图片说明image_1cv23rlmghd9kv118un13f3dks8m.png-62.1kB

image_1cvgeoqovqcm1609ban1dd31s7g7m.png-118.2kB


image_1cvgeqll71heq67md121vv7t0783.png-103.4kB


image_1cvgercqr12r41e0hagl1da1tkv8g.png-87.8kB

 

(4)在jenkins服务器上查询拉取代码结果(之前清空过jenkins下的workspace工作目录)

cd /var/lib/jenkins/workspace/

ls

cd A-PHP

image_1cvgf32g7enk82f13191fnf12q18t.png-25.1kB

 

项目案例一:Jenkins+Pipeline+Git+PHP博客项目流水线自动发布

image_1cv240tou7h18b1b3683jc1e0.png-149.3kB


主机名IP地址备注
Git 192.168.200.70 Git服务器
Jenkins 192.168.200.91 Jenkins服务器
Web 192.168.200.101 Web服务器
 

所有服务器进行如下操作

cat /etc/redhat-release

uname -r

systemctl stop firewalld

systemctl disable firewalld

systemctl stop NetworkManager

systemctl disable NetworkManager

image_1cvgfkkgkpmd12bb1c5gcbd10ev9a.png-22.9kB

 

创建一个Pipeline流水线项目并进行参数化构建

image_1cv24249k10gv1j66h6v44mdr7f0.png-178kB


image_1cvgftk6i1neo1pbc17ut1941pum9n.png-113.2kB

由于我们仍旧打算将pipeline脚本放在远程Git仓库里,因此我们需要从远程Git仓库拉取Pipeline脚本,所以,参数化构建不支持Git的参数化。我们只能使用字符结构的参数化构建。


图片说明image_1cv2456s8i48sct6eoigh1hmnhd.png-68.4kB

image_1cvgg10k8hpbn6e13k61uor1d9sa4.png-127.3kB

 

下载用于自动化发布的PHP源码wordpress源码包,并上传远程git仓库

 

在Git服务器上创建用于存放源码的Git仓库

hostname -I

cd /home/git/repos/

ls

mkdir wordpress

cd wordpress/

git --bare init

cd ..

ll

chown -R git.git wordpress

image_1cvgj133816a2mr616jb1usc1jogau.png-66.9kB

 

在jenkins服务器上,克隆创建好的远程Git仓库

mkdir /php-app

cd /php-app

git clone git@192.168.200.70:/home/git/repos/wordpress

ls

image_1cvgj7pju5sp8h0s1te076v3bb.png-26.5kB

 

在jenkins服务器上,下载wordpres源代码

链接:https://pan.baidu.com/s/1hGyd1xFuL0oPBsFeROuUYQ 
提取码:tmgk --->wordpress百度云下载地址

wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz

cd /php-app/wordpress/

ls

tar xf wordpress-4.9.4-zh_CN.tar.gz

ls

mv wordpress-4.9.4-zh_CN.tar.gz /tmp/

ls

mv wordpress/* .

rm -rf wordpress/

ls

image_1cvgjr957o991qlvq1tfh1v7tcl.png-58kB

 

在jenkins上提交代码到远程Git仓库

git add *

git commit -m "第一次提交"

git push -u origin master

image_1cvgjsnp41g8c11in1e3t1noo1pbud2.png-138kB

 

设置分布式构建Web服务器的slave管理节点

我们计划利用分布式构建的方式,启动pipeline的流水线项目发布 
slave管理节点就设置为需要用于发布项目的Web服务器

 

添加用于连接slave代理节点的SSH证书(上文已经设置过了)

image_1cv246l5dr761scer71olmtcghq.png-29.5kB

 

添加并设置Web服务器的slave管理从节点

image_1cvgk1kdnefd1i3sot49gdibedf.png-136.8kB


image_1cvgk5eut17fn1nvl1ap81vpq1v3fds.png-93.7kB


图片说明image_1cv247u2p1k8111e0cg0186b1rb9j7.png-74.2kB

image_1cvgl404n1cdq1c461t7615eh3ssft.png-145.3kB


图片说明image_1cv248kug19ut1m8t1b8h11bm4lvkj.png-65.9kB

image_1cvgl4qb5pfh6uq1bto1m5p1pekga.png-96.1kB

 

Web服务器slave从节点安装java环境,并启动jenkins的slave管理节点

链接:https://pan.baidu.com/s/1EXO2hSetnkapR29ojJIGTg 
提取码:ixgn --->jdk百度云下载地址

 

解压安装jdk

tar xf jdk-8u60-linux-x64.tar.gz -C /usr/local/

cd /usr/local

mv jdk1.8.0_60/ jdk

/usr/local/jdk/bin/java -version

image_1cvgklc2f6qpl0h1j6j4hon39f3.png-39.2kB

 

配置java环境

sed -i.org '$a export JAVA_HOME=/usr/local/jdk/' /etc/profile

sed -i.org '$a export PATH=$PATH:$JAVA_HOME/bin' /etc/profile

sed -i.org '$a export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar' /etc/profile

tail -3 /etc/profile

source /etc/profile

java -version

image_1cvgknlommbp1saf1a7s38p199sfg.png-60kB

 

重新启动Slave从节点

图片说明image_1cv249esq1p75ijsrlevdgg0jl0.png-65.1kB

image_1cvgl8riq1mdq1d6s6je18861muogn.png-99.3kB

 

Web服务器安装LNMP环境,并手动拉取代码模拟访问

yum -y install epel-release

yum -y install nginx php-fpm php-mysql

image_1cvglls5ol43hc9rgu16051jjghk.png-132.7kB


image_1cvglogqb1mhm1jvk15ad1d5p1b7uih.png-156.7kB

 

修改nginx配置文件

cd /etc/nginx/

ls

cp nginx.conf{,.bak}

egrep -v "#|^$" nginx.conf.bak > nginx.conf

cat nginx.conf

 
  1. user nginx;
  2. worker_processes auto;
  3. error_log /var/log/nginx/error.log;
  4. pid /run/nginx.pid;
  5. include /usr/share/nginx/modules/*.conf;
  6. events {
  7. worker_connections 1024;
  8. }
  9. http {
  10. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  11. '$status $body_bytes_sent "$http_referer" '
  12. '"$http_user_agent" "$http_x_forwarded_for"';
  13. access_log /var/log/nginx/access.log main;
  14. sendfile on;
  15. tcp_nopush on;
  16. tcp_nodelay on;
  17. keepalive_timeout 65;
  18. types_hash_max_size 2048;
  19. include /etc/nginx/mime.types;
  20. default_type application/octet-stream;
  21. include /etc/nginx/conf.d/*.conf; #include了一个配置文件目录
  22. server {
  23. listen 80 default_server; #默认的server配置(如果用IP访问就进入这个server)
  24. listen [::]:80 default_server;
  25. server_name _;
  26. root /usr/share/nginx/html; #默认的网页目录
  27. include /etc/nginx/default.d/*.conf;
  28. location / {
  29. }
  30. error_page 404 /404.html;
  31. location = /40x.html {
  32. }
  33. error_page 500 502 503 504 /50x.html;
  34. location = /50x.html {
  35. }
  36. }
  37. }

image_1cvglq5bh148h10ko411fkd1291iu.png-109.9kB

 

由于默认的配置文件include了/etc/nginx/conf.d/*.conf因此我们增加一个server配置文件即可

vim /etc/nginx/conf.d/wp.conf

cat /etc/nginx/conf.d/wp.conf

 
  1. server {
  2. listen 80;
  3. server_name www.yunjisuan.com;
  4. root /usr/share/nginx/html/www.yunjisuan.com;
  5. location / {
  6. index index.php index.html;
  7. }
  8. location ~\.php {
  9. fastcgi_index index.php;
  10. fastcgi_pass 127.0.0.1:9000;
  11. include fastcgi.conf;
  12. }
  13. }

image_1cvglv1ktatm1f601r7j1f65eumjb.png-34.7kB

 

创建网页目录

cd /usr/share/nginx/html/

ls

mkdir www.yunjisuan.com

cd www.yunjisuan.com

ls

image_1cvglvtfm1c6310jvgt1e8klt0jo.png-26.8kB

 

克隆Git仓库代码到本地网页目录

yum -y install git

git init

git clone git@192.168.200.70:/home/git/repos/wordpress

ls

mv wordpress/* .

ls

rm -rf wordpress/

image_1cvgm14l5bn51nlp176h2s21a80k5.png-132kB


image_1cvgm3vu65ghamgiri18m2lkbki.png-108.9kB

 

将网页目录权限授权给apache程序用户

cd ..

ll

id apache

chown -R apache.apache /usr/share/nginx/html/www.yunjisuan.com

image_1cvgm5h3jbmi1f0e1bn41u116lpkv.png-70.8kB

 

启动nginx服务和php-fpm服务

systemctl start nginx

systemctl start php-fpm

ss -antup | egrep "80|9000"

systemctl enable nginx

systemctl enable php-fpm

image_1cvgm82vv1jjd2rg1gna1gvk7ilc.png-64.3kB

 

做好宿主机的域名映射后,浏览器访问测试

image_1cvgmb9d786kqob2e2mme18d1lp.png-99.9kB

 

在远程Git仓库中创建一个用于构建的Pipeline脚本

 

在jenkins服务器上进行如下操作

rm -rf /test

mkdir /test

cd /test

git clone git@192.168.200.70:/home/git/repos/jenkinsfile

ls

cd jenkinsfile/

ls

ls itemA/

image_1cvgml4uvqrlduu1knkr1mv9tm6.png-50.1kB

 

通过流水线脚本生成器生成如下脚本内容

vim itemA/jenkinsfile-php-wp

cat itemA/jenkinsfile-php-wp

 
  1. node ("PHP-slave1-192.168.200.101") {
  2. stage('git checkout') {
  3. checkout([$class: 'GitSCM',
  4. branches: [[name: '${branch}']],
  5. doGenerateSubmoduleConfigurations: false, extensions: [],
  6. submoduleCfg: [], userRemoteConfigs: [[credentialsId: '9f98962f-1a82-4da1-8a0f-bc906e92d998',
  7. url: 'git@192.168.200.70:/home/git/repos/wordpress']]])
  8. }
  9. stage('code copy') {
  10. sh '''rm -rf ${WORKSPACE}/.git
  11. [ -d /data/backup ] || mkdir -p /data/backup
  12. mv /usr/share/nginx/html/www.yunjisuan.com /data/backup/www.yunjisuan.com-$(date +%F_%T)
  13. cp -rf ${WORKSPACE} /usr/share/nginx/html/www.yunjisuan.com'''
  14. }
  15. stage('test') {
  16. sh 'curl http://www.yunjisuan.com/status.html'
  17. }
  18. }

image_1cvgngriq1ap7ufh1g8hq8jgeo0.png-67.7kB

 

推送到Git远程仓库

git add *

git commit -m "xxx"

git push -u origin master

image_1cvgnkr081sj6pkqt6sum21qs2od.png-47.6kB

 

通过流水线脚本生成器生成的阶段代码示例(这里只生成了url部分,具体内容自定义)

image_1cvgmvvpn1ebd1udq18qs1p591qfsn6.png-51.1kB


image_1cv24cfj3hbk15d51h3e1qms13nvlq.png-43.8kB


image_1cvgncqvdlb1oioqadq141d3fnj.png-168.9kB


image_1cv24crc99bf18i6bme17981ijtm7.png-76.8kB


image_1cv24e2i7k00oq61oglh626vtnu.png-58kB

 

在Web服务器上PHP项目代码里增加Pipeline验证用的测试页面

 

在项目代码里加入一个健康检查测试页面,并推送到远程Git仓库

cd /var/lib/jenkins

git clone git@192.168.200.192:/home/git/repos/wordpress

ls

cd wordpress/

ls

echo "OK-version V2.0" >> status.html

image_1cvgo38a61mq31pv0p7v19eb1mo2oq.png-74kB

 

将测试用页面提交到远程Git仓库

git add *

git commit -m "version V2.0"

git config --global user.email "112340"

git config --global user.name "Mr.sun"

git push -u origin master

image_1cvgo7a5r1oqd2n31vgio981t8lp7.png-84.5kB

 

在web服务器做域名映射(因为要进行curl验证)

echo "`hostname -I` www.yunjisuan.com" >> /etc/hosts

cat /etc/hosts

image_1cvgo8djc1f73fmvce9qta1j5tpk.png-24.3kB

 

浏览器访问jenkins进行PHP项目流水线发布构建

image_1cvgo9ggl3os9n7aun1sc31qm6q1.png-95.8kB


image_1cvgoaetu40s1kqj110o133i1ru0qe.png-71.8kB


图片说明image_1cv24fi131qilk8o1rpm18s2lgpoo.png-114.5kB

image_1cvgoc25hp4l1tsp16um1406f0qr.png-155.8kB

 

流水线项目发布多节点需要注意的事项

所需要修改的部分如下

 

脚本需要在流水线脚本写出多节点,比如

 
  1. node ("PHP-slave1-192.168.200.101") {
  2. stage('git checkout') {
  3. checkout([$class: 'GitSCM',
  4. branches: [[name: '${branch}']],
  5. doGenerateSubmoduleConfigurations: false, extensions: [],
  6. submoduleCfg: [], userRemoteConfigs: [[credentialsId: '9f98962f-1a82-4da1-8a0f-bc906e92d998',
  7. url: 'git@192.168.200.70:/home/git/repos/wordpress']]])
  8. }
  9. stage('code copy') {
  10. sh '''rm -rf ${WORKSPACE}/.git
  11. [ -d /data/backup ] || mkdir -p /data/backup
  12. mv /usr/share/nginx/html/www.yunjisuan.com /data/backup/www.yunjisuan.com-$(date +%F_%T)
  13. cp -rf ${WORKSPACE} /usr/share/nginx/html/www.yunjisuan.com'''
  14. }
  15. stage('test 200.101-php') {
  16. sh 'curl http://www.yunjisuan.com/status.html'
  17. }
  18. }
  19. node ("PHP-slave1-192.168.200.xxx") {
  20. stage('git checkout') {
  21. checkout([$class: 'GitSCM',
  22. branches: [[name: '${branch}']],
  23. doGenerateSubmoduleConfigurations: false, extensions: [],
  24. submoduleCfg: [], userRemoteConfigs: [[credentialsId: '9f98962f-1a82-4da1-8a0f-bc906e92d998',
  25. url: 'git@192.168.200.70:/home/git/repos/wordpress']]])
  26. }
  27. stage('code copy') {
  28. sh '''rm -rf ${WORKSPACE}/.git
  29. [ -d /data/backup ] || mkdir -p /data/backup
  30. mv /usr/share/nginx/html/www.yunjisuan.com /data/backup/www.yunjisuan.com-$(date +%F_%T)
  31. cp -rf ${WORKSPACE} /usr/share/nginx/html/www.yunjisuan.com'''
  32. }
  33. stage('test' 200.xxx-php) {
  34. sh 'curl http://www.yunjisuan.com/status.html'
  35. }
  36. }
 

假如是克隆的机器需要把hosts文件里的映射修改一下

 

在浏览器进入jenkins主用户来添加新节点信息(有几点节点就添加几个)

image_1cvgpcsj5jio6kir291ioq1hb39.png-98.3kB

 

所有的修改都完事以后,在进行构建测试就可以了

 

让ssh支持流水线,需要安装插件SSH Pipeline Steps

image_1cvgq1v4d1m8l13bhbll1dlf1b3p16.png-136.6kB


image_1cvgq51fa1sch1mbh1nbgi3015hc1j.png-138.2kB

 

以ssh方式分发流水线脚本模板详解

image_1cvgqtrmv11iepal1rboeut1blo20.png-152.6kB

 
  1. def remote = [:] #定义变量不需要改
  2. remote.name = 'test' #远程主机的名字
  3. remote.host = 'test.domain.com' #远程主机的IP
  4. remote.user = 'root' #远程主机的用户
  5. remote.password = 'password' #远程主机的密码
  6. remote.allowAnyHosts = true #照着超就可以
  7. stage('Remote SSH') { #阶段名称
  8. writeFile file: 'abc.sh', text: 'ls -lrt' #把后面的命令,让如abc.sh脚本里
  9. sshScript remote: remote, script: "abc.sh" #把脚本分发自定义的主机
  10. }
 

以ssh方式分发流水线脚本语法样式

 
  1. node ("PHP-slave1-192.168.200.101") {
  2. def remote = [:]
  3. remote.name = 'test'
  4. remote.user = 'root'
  5. remote.allowAnyHosts = true
  6. stage('git checkout') {
  7. sh `echo "`hostname -I`"`
  8. checkout([$class: 'GitSCM',
  9. branches: [[name: '${branch}']],
  10. doGenerateSubmoduleConfigurations: false, extensions: [],
  11. submoduleCfg: [], userRemoteConfigs: [[credentialsId: '9f98962f-1a82-4da1-8a0f-bc906e92d998',
  12. url: 'git@192.168.200.70:/home/git/repos/wordpress']]])
  13. }
  14. stage('SSH 200.xxx') {
  15. remote.host = '192.168.200.xxx'
  16. remote.password = 'linyaonie'
  17. writeFile file: 'ssh01.sh', text:'echo "`hostname -I`"'
  18. sshScript remote:remote, script: "ssh01.sh"
  19. }
  20. stage('SSH 200.xxx') {
  21. remote.host = '192.168.200.xxx'
  22. remote.password = 'linyaonie'
  23. writeFile file: 'ssh02.sh', text:```
  24. echo "`hostname -I`"
  25. echo "`hostname -I`"
  26. echo "`hostname -I`"
  27. ``` --->这里需要注意要定格写
  28. sshScript remote:remote, script: "ssh02.sh"
  29. }
  30. }
 

重新把新修过的内容添加到远程仓库并构建测试在查看logs日志的结果

git add *

git commit -m "测试SSH"

git push -u origin master

 

生产环境流水线自动项目发布思路

image_1cvgil4mbolapms1f0qkf5i4kah.png-502.6kB

posted @ 2019-07-24 15:32  L1n  阅读(2111)  评论(0编辑  收藏  举报