Omr*_*mri 5 groovy jenkins-groovy
我正在尝试为詹金斯管道编写一个常规方法。该方法获取两个变量,将它们放入一个字符串中,并将该字符串作为 shell 命令执行。
方法如下:
def method(A, B) {
test = "cp app/scripts/" + A + "config." + B + "js app/scripts/config.js"
def rc = sh(script: test, returnStatus: true)
if (rc != 0) {
error "Failed, exiting now..."
}
}
Run Code Online (Sandbox Code Playgroud)
这是我执行此代码时收到的错误:
The current scope already contains a variable of the name rc
@ line 148, column 13.
def rc = sh(script: """
^
Run Code Online (Sandbox Code Playgroud)
有谁知道可能是什么问题?
| 归档时间: |
|
| 查看次数: |
9120 次 |
| 最近记录: |