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条)