首页 > 其他 > 详细

pipeline模板

时间:2020-08-26 22:33:21      阅读:102      评论:0      收藏:0      [点我收藏+]

 

  • always 无论流水线或者阶段的完成状态。
  • changed 只有当流水线或者阶段完成状态与之前不同时。
  • failure 只有当流水线或者阶段状态为"failure"运行。
  • success 只有当流水线或者阶段状态为"success"运行。
  • unstable 只有当流水线或者阶段状态为"unstable"运行。例如:测试失败。
  • aborted 只有当流水线或者阶段状态为"aborted "运行。例如:手动取消。
pipeline {
    agent any
    stages {
        stage(‘Example‘) {
            steps {
                echo ‘Hello World‘
            }
        }
    }
    post { 
        always { 
            echo ‘I will always say Hello again!‘
        }
    }
}

 

 

pipeline {
    agent any
    stages {
        stage(‘build‘) {
            steps {
                sh ‘mkdir build21‘
            }
        }
        stage(‘test‘) {
            steps {
                sh ‘touch test.txt‘
            }
        }
        stage(‘deploy‘) {
            steps {
                echo ‘发布‘
            }
        }
    }
}

 

 

pipeline {
    agent any
    environment { 
        CC = ‘clang‘
    }
    stages {
        stage(‘Example‘) {
            environment { 
                AN_ACCESS_KEY = credentials(‘my-prefined-secret-text‘) 
            }
            steps {
                sh ‘printenv‘
            }
        }
    }
}

 

pipeline模板

原文:https://www.cnblogs.com/hanshengli/p/13568085.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!