zoukankan      html  css  js  c++  java
  • pipeline的使用示例

       搭建就不说了,直接示例如何使用pipeline.

    一、以下输入参数:版本号为字符参数,按文档更新的是文本参数。

     

     

     

     

     二、脚本对更新内容的处理如下:

    file_update_list="/home/www/html/yhzinclude.conf"

    ##接收传递过来的文件列表,处理不需要的字符后,存放到file_update_list文件

    echo "$3" | grep -q '/trunk';if [ $? -ne 0 ];then echo "未找到trunk字段,请检查待更新文件列表是否规范";exit 3;fi

    echo "$3" | grep '/trunk' | awk -F '/trunk' '{print $2}' >> "$file_update_list"

    ##tg更新需要权限

    chmod 777 $file_update_list

    ##流水线脚本如下( input部分可去掉,'Online'是自定义的,stage可多个):

    pipeline {

                agent {

                           label 'master' /* 执行节点 */

                }

                stages {

                           stage('Online') {

                                       steps {

                                               input "Are you sure to commit?"

                                                   sh "/bin/bash /data/shell/yhz_online_update.sh '$Comment' '$Version' '$Content'"

                                       }

                           }

                }

                post {

                           always {

                                       echo 'One way or another, I have finished'

                                       deleteDir() /* clean up our workspace */

                           }

                           success {

                                       echo 'I succeeeded!'

                           }

                           unstable {

                                       echo 'I am unstable :/'

                           }

                           failure {

                                       echo 'I failed :('

                           }

                           changed {

                                       echo 'Things were different before...'

                           }

                }

    }

    ##官网参考:https://jenkins.io/doc/book/pipeline/

  • 相关阅读:
    JS中的constructor与prototype
    HTTP状态码
    CSS HACK 及常见问题
    js常见怪异
    js深拷贝和浅拷贝
    浏览器渲染
    google全球地址大全
    从function前面的!想到的
    2048
    js判定IE
  • 原文地址:https://www.cnblogs.com/liulvzhong/p/11475653.html
Copyright © 2011-2022 走看看