<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                1、安裝插件 Git Parameter Plug-In 2、配置jenkins ![](https://box.kancloud.cn/a64d90851875227bab7c2f6a9fa43f3e_1231x623.png) ![](https://box.kancloud.cn/f1d3b131cd96c5cd68d67673227764ba_1185x637.png) ![](https://box.kancloud.cn/e36ad7d93d67d3457ae21130b04572bd_1209x575.png) ![](https://box.kancloud.cn/98a3e0753c01c4e42ac9e06c283f32f2_1078x626.png) 腳本如下 GITDIR="/var/lib/jenkins/workspace" PRONAME="t_yyg" DSTDIR="/opt/deploy" #DATE="`date +%F_%H-%M`" USER="www" cat > /home/www/ip.list <<EOF 10.2.11.237 10.2.11.233 EOF function deploy(){ cd ${GITDIR}/${PRONAME} && git pull origin tag ${Tag} && git checkout ${Tag} cd $GITDIR && tar zcf ${PRONAME}_${Tag}.tar.gz ${PRONAME}/* mv ${PRONAME}_${Tag}.tar.gz /opt/deploy/ for IP in `cat /home/www/ip.list`;do scp /opt/deploy/${PRONAME}_${Tag}.tar.gz ${USER}@${IP}:${DSTDIR} ssh ${USER}@${IP} "cd /opt/deploy && tar xf ${PRONAME}_${Tag}.tar.gz && mv ${PRONAME} ${PRONAME}_${Tag}" ssh ${USER}@${IP} "cd /var/www/html && rm -rf ${PRONAME} && ln -s /opt/deploy/${PRONAME}_${Tag} /var/www/html/${PRONAME}" ssh ${USER}@${IP} "chown -R www.www /var/www/html/${PRONAME}" done } function rollback(){ for IP in `cat /home/www/ip.list`;do ssh ${USER}@${IP} "cd /var/www/html && rm -rf ${PRONAME} && ln -s /opt/deploy/${PRONAME}_${Tag} /var/www/html/${PRONAME}" ssh ${USER}@${IP} "chown -R www.www /var/www/html/${PRONAME}" done } case $Operation in Deploy) deploy ;; Rollback) rollback ;; esac 三)測試: 1)在本地提交,然后push到遠程,登錄gitlab打tag為v1.1 [root@static yyg]# vim a.html [root@static yyg]# vim b.html [root@static yyg]# git add . [root@static yyg]# git commit . -m "add a b" [master c1af6ba] add a b 2 files changed, 2 insertions(+) create mode 100644 a.html create mode 100644 b.html [root@static yyg]# git push origin master Counting objects: 4, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (4/4), 325 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) To gitlab@git.91als.net:root/yyg.git 51d123f..c1af6ba master -> master 2)在本地提交,然后push到遠程,登錄gitlab打tag為v1.2 [root@static yyg]# vim test.html [root@static yyg]# git add . [root@static yyg]# git commit -m "add test.html" [master b793078] add test.html 1 file changed, 1 insertion(+) create mode 100644 test.html [root@static yyg]# git push origin master 然后通過jenkins發布版本 第一次發布v1.0版本 [root@static html]# ll total 0 lrwxrwxrwx. 1 www www 22 Jan 19 15:33 t_yyg -> /opt/deploy/t_yyg_v1.0 第二次發布v1.1版本 [root@static html]# ll total 0 lrwxrwxrwx. 1 www www 22 Jan 19 15:35 t_yyg -> /opt/deploy/t_yyg_v1.1 lrwxrwxrwx. 1 www www 23 Jan 18 17:14 yyg -> /opt/deploy/yyg_66f0c74 lrwxrwxrwx. 1 www www 10 Jan 18 13:34 zrlog -> /opt/zrlog [root@static html]# cd t_yyg/ [root@static t_yyg]# ll total 1624 -rw-r--r--. 1 www www 11 Jan 18 15:35 a.html drwxr-xr-x. 5 www www 4096 Jan 18 15:33 app drwxr-xr-x. 4 www www 4096 Jan 18 15:33 app2 -rw-r--r--. 1 www www 1172529 Jan 18 15:33 app.apk -rw-r--r--. 1 www www 11 Jan 18 15:35 b.html (發現多了a.html和b.html代碼) 第三次發布v1.2版本 [root@static html]# ll total 0 lrwxrwxrwx. 1 www www 22 Jan 19 15:37 t_yyg -> /opt/deploy/t_yyg_v1.2 lrwxrwxrwx. 1 www www 23 Jan 18 17:14 yyg -> /opt/deploy/yyg_66f0c74 lrwxrwxrwx. 1 www www 10 Jan 18 13:34 zrlog -> /opt/zrlog [root@static html]# cd t_yyg/ [root@static t_yyg]# ll|grep test.html -rw-r--r--. 1 www www 18 Jan 18 15:37 test.html (發現多了一個test.html) 此時發現代碼有問題,需要回退到上一個tag(或指定tag) 比如回退到v1.1 ![](https://box.kancloud.cn/4780f28a37e60bd85233aa7e958e9570_803x601.png) [root@static html]# ll total 0 lrwxrwxrwx. 1 www www 22 Jan 19 15:39 t_yyg -> /opt/deploy/t_yyg_v1.1 lrwxrwxrwx. 1 www www 23 Jan 18 17:14 yyg -> /opt/deploy/yyg_66f0c74 lrwxrwxrwx. 1 www www 10 Jan 18 13:34 zrlog -> /opt/zrlog [root@static html]# cd t_yyg/ [root@static t_yyg]# ll |grep test.html (發現沒有test.html,說明版本回退到v1.1咯)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看