从 AWS s3 存储桶中获取 jar 文件并显示在 Jenkins 选择参数中
Fetch jar files from AWS s3 bucket and display in Jenkins choice parameter
我是 Jenkins 的新手,我正在尝试从 S3 存储桶中获取所有 jar 文件并显示在 Jenkins 的选择参数中 UI。所以我们可以选择 select 特定的 jar 文件并部署。
我在 运行 脚本中使用以下命令进行测试,它有效。
aws s3 ls company-bucketname/test/
我已经在 groovy 脚本下面安装了 "Extensible choice plugin to achive this" 和 运行ning,但没有成功。
def command = 'aws s3 ls company-bucketname/test/ --output text'
def proc = command.execute()
proc.waitFor()
def output = proc.in.text
def exitcode= proc.exitValue()
def error = proc.err.text
if (error) {
println "Std Err: ${error}"
println "Process exit code: ${exitcode}"
return exitcode
}
//println output.split()
return output.tokenize()
如果有更好的方法在 Jenkins 选择参数中显示 S3 值,请告诉我。
根据 this blog post,您可以使用 "Extended Choice Parameter Plugin" 并创建一个脚本,其中 returns 一个字符串数组将用作您对参数的选择。
看起来你已经完成了获取 jar 文件名称的工作,所以你只需要那个插件和一个返回选项列表的方法。
我是 Jenkins 的新手,我正在尝试从 S3 存储桶中获取所有 jar 文件并显示在 Jenkins 的选择参数中 UI。所以我们可以选择 select 特定的 jar 文件并部署。
我在 运行 脚本中使用以下命令进行测试,它有效。
aws s3 ls company-bucketname/test/
我已经在 groovy 脚本下面安装了 "Extensible choice plugin to achive this" 和 运行ning,但没有成功。
def command = 'aws s3 ls company-bucketname/test/ --output text'
def proc = command.execute()
proc.waitFor()
def output = proc.in.text
def exitcode= proc.exitValue()
def error = proc.err.text
if (error) {
println "Std Err: ${error}"
println "Process exit code: ${exitcode}"
return exitcode
}
//println output.split()
return output.tokenize()
如果有更好的方法在 Jenkins 选择参数中显示 S3 值,请告诉我。
根据 this blog post,您可以使用 "Extended Choice Parameter Plugin" 并创建一个脚本,其中 returns 一个字符串数组将用作您对参数的选择。
看起来你已经完成了获取 jar 文件名称的工作,所以你只需要那个插件和一个返回选项列表的方法。