Vic*_*cky 4 groovy jenkins jenkins-pipeline jenkins-declarative-pipeline
获取No such field found: field java.lang.String sinput错误而运行我的Jenkinsfile。
我开发了一个 Jenkinsfile,它可以接受用户输入,并进一步在远程机器上运行一个命令,将用户输入作为变量
stages {
stage("Interactive_Input") {
steps {
script {
def apiinput
def userInput = input(
id: 'userInput', message: 'This is my project',
parameters: [
string(defaultValue: 'None',
description: 'Enter the name of the service',
name: 'sinput'),
])
// Save to variables. Default to empty string if not found.
apiinput = userInput.sinput?:''
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
小智 6
好吧...我遇到了这样的问题,就我而言,这是我使用变量的方式,当我确实喜欢$VARIABLE它不起作用时,我遇到了与此处描述的错误类似的错误。然而,当我这样做时${VARIABLE}->一切都有效了!