【发布时间】:2019-06-12 09:29:02
【问题描述】:
非常欢迎对这个小问题提出任何建议! :)
下载最新版本可以正常工作,但该对象不包含任何属性。 是否可以从下载的版本中获取属性?
最好的方法是获取一个带有预定义值的输入框,显示以前的版本,即“R1G”,并为用户提供将值编辑为 R2A 或任何其他值或仅中止的选项(中止意味着将有没有版本)。 用户还可以选择什么都不做,否则会导致超时并最终中止。
我想要
- 从 Artifactory repo 下载最新版本
- 将 build.number 存储在“def prev_build”中
- 在输入中显示 prev_build 供用户更新(自定义编号)
'''一些代码
echo 'Publiching Artifact.....'
script{
def artifactory_server_down=Artifactory.server 'Artifactory'
def downLoad = """{
"files":
[
{
"pattern": "reponame/",
"target": "${WORKSPACE}/prev/",
"recursive": "false",
"flat" : "false"
}
]
}"""
def buildInfodown=artifactory_server_down.download(downLoad)
//Dont need to publish because I only need the properties
//Grab the latest revision name here and use it again
echo 'Retriving revision from last uploaded build.....'
env.LAST_BUILD_NAME=buildInfodown.build.number
//Yes its a map and I have tried with ['build.number'] but the map is empty
}
echo "Previous build name is $env.LAST_BUILD_NAME" //Will not contain the old (latest)
''' 片段结束
输出为 null 或我给 var 的默认值,而不是预期的版本号。
【问题讨论】:
标签: jenkins-pipeline artifactory jenkins-groovy jfrog-cli