Jenkinsfile中when语句的内置条件以及使用脚本方式判断

Jenkinsfile中when语句的内置条件以及使用脚本方式判断

2023年7月7日发(作者:)

Jenkinsfile中when语句的内置条件以及使⽤脚本⽅式判断例1stage('Master Branch Tasks') { when { branch "master" } steps { sh '''#!/bin/bash -l Do some stuff here ''' }}例2 (not)stage('Example (Not master nor staging)') { when { not { anyOf { branch 'master'; branch 'staging' } } } steps { sh '' }}使⽤脚本⽅式也可以stage('Example') { steps { script {

if (_NAME != 'master' && _NAME != 'staging') { echo 'This is not master or staging' } else { echo 'things and stuff' } } }}判断⾃定义参数的值stage('Example') { when { expression { NMENT == "PROD" } }

steps { echo "deplpoyment prod" }}

发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1688701217a163689.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信