Jenkins parameters 在pipeline中的shell中使用
parameters中的参数在sh中是无法直接读取的。所以先通过environment读取,再在sh中使用。pipeline {agent {label 'java'}parameters {string(name: 'DEPLOY_ENV', defaultValue: 'staging', description: '')}environment {unit_test = "$param
·
parameters中的参数在sh中是无法直接读取的。所以先通过environment读取,再在sh中使用。
pipeline {
agent any
parameters {
string(name: 'DEPLOY_ENV', defaultValue: 'staging', description: '')
}
environment {
unit_test = "$params.DEPLOY_ENV"
}
stages {
stage('Example') {
steps {
script {
sh "echo $unit_test"
}
}
}
}
}
更多推荐
已为社区贡献27条内容
所有评论(0)