jenkins - Jenkinsfile 脚本并行导致 shell 语句失败
问题描述
在我的脚本 Jenkinsfile 中,我有一行运行parallel deployments
. 我省略了其他阶段和安全代码。
当我运行它时,它找不到reportUrl
并且我得到错误:groovy.lang.MissingPropertyException: No such property: teamsUrl for class: groovy.lang.Binding
。
但是,如果我在没有parallel deployments
它的情况下运行,并且我能够达到reportUrl
. 我用回声语句进行了测试。有什么想法吗?
我没有正确退出并行语句吗?
stage("Deploy") {
def deployments = [:]
// Code here not pasted
parallel deployments
echo "Deployed to clusters"
}
stage('Reporting') {
def reportUrl = 'https://testurl'
echo "${reportUrl}"
sh """
./my-tool report deploy \
--report-url "${reportUrl}" \
--force
"""
}
编辑 6/22
reportUrl 来自一个 groovy 文件:example.groovy
example = load("deploy/example.groovy")
def reportUrl = example.REPORT_URL['report']
//I can see the url being pulled correctly here
echo "${reportUrl}"
解决方案
推荐阅读
- python - 在这我想做一个像 setchannel 这样的命令,然后它检查 channel.id 是否与我们在 setchannel 中得到的相同
- asp.net-core - 何时使用以下瞬态、作用域和单例
- reactjs - 如何在地图中编写 if 语句以做出反应?
- html - 关于具有绝对内容的 flexbox 的初学者问题
- python - 如何按列值过滤和定义新的数据框?
- ruby-on-rails - Rails,数据表创建问题
- python - 我无法使用我的第一个 Web 套接字,因为它返回一个关闭的连接
- vb.net - 选择 DataTable 中的非重复元素
- r - 在 R 中选择带点的列(嵌套对象)
- javascript - 如何在 VUE JS 项目中通过 npm 正确安装 vue-owl-carousel?