jenkins-pipeline - 通过 groovy 脚本创建 pipelineJob 环境变量的问题
问题描述
这https://jenkinsci.github.io/job-dsl-plugin/#path/pipelineJob-environmentVariables-groovy真的有效吗?
可能更多是插件问题。
设置环境变量的常规脚本似乎适用于自由式工作。但我不能让他们从事管道工作。它们不会导致任何错误,但也不会设置环境变量。
其他人玩过它吗?
pipelineJob('example') {
environmentVariables {
env('ONE', '1')
env('TWO', '2')
groovy('''
def a = 1
return [THREE: 3 * a]
''')
}
definition {
cps {
script('''
pipeline {
agent any
stages {
stage('Env') {
steps {
sh 'env'
}
}
}
}
''')
}
}
}
谢谢
解决方案
推荐阅读
- r - 量化ggplot行之间相似性的方法
- python - Shutil 查找和删除文件
- android - Jetpack compose:更改 Composable 的布局方向
- apache-spark - Spark-NLP 函数在使用 map 时会出现酸洗错误
- python - 键盘内联键盘选择后获取用户输入 Telegram Bot Python
- html - 文字没有在手机上展开 td 元素
- html - 来自 Bootstrap 的 HTML 搜索栏表单中的单独行
- c# - 为什么过滤此 IEnumerable 会引发 NullReferenceException?
- python - 为什么我生成 19edo 音阶的 python 代码使第一个八度音阶非常短?
- html - 如何在悬停时将装载机从左向右移动?