如何仅将Jenkinsfile / Groovy中命令输出的数字作为列表返回?

我们需要在此Jenkinsfile上仅返回来自k8s应用程序的修订号作为选项,但是该命令返回整个输出,并且我在该命令上执行的所有正则表达式和转义符均未使用。这是代码:

                    choiceType: 'PT_SINGLE_SELECT',description: 'Revision of the application on kubernetes',name: 'revision',omitvalueField: false,randomName: 'choice-parameter-5633384460832177',referencedParameters: 'namespaces,deployment',script: [
                        $class: 'GroovyScript',script: [
                            classpath: [],sandbox: true,script: """
                                if (namespaces.equals("Select")){
                                    return["Nothing to do - Select your deployment"]
                                } else {
                                    def revResult = null
                                    def kubecmd0 = "kubectl rollout history deploy --kubeconfig=${kubefilePrd} -n " + namespaces + " " + deployment + " "
                                    def kubecmd1 = kubecmd0.execute().in.text.split().toList()
                                    return kubecmd1

                                }
                            """

                        ]

在詹金斯的工作上:

printscreen

是否有任何函数或魔术正则表达式可以解决此问题?

wuzhijunxx 回答:如何仅将Jenkinsfile / Groovy中命令输出的数字作为列表返回?

问题已解决:

.onChange({ [weak self] row in
      self?.view.layoutIfNeeded() //or self?.tableView.layoutIfNeeded()
})

基本上,有必要调用bash,而不是直接使用groovy。为我工作。 :)

本文链接:https://www.f2er.com/3148098.html

大家都在问