团队
我正在学习 groovy 并创建了一个简单的,但在詹金斯上运行管道时出现此错误。不确定这到底是什么意思
+ echo inside MAIN in stage Formatting
inside MAIN in stage Formatting
[Pipeline] }
[Pipeline] // container
Post stage
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: c454d67d-2abf-4f99-aa8b-281ea186c072
groovy.lang.MissingPropertyException: No such property: git for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:285)
at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:375)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:379)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:355)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:355)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:355)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
at WorkflowScript.run(WorkflowScript:181)
at ___cps.transform___(Native Method)
我的图书馆是
签出Git.groovy
def call(Map config) {
println "Starting the script...1"
}
Jenkinsfile 是
pipeline {
agent {
label 'stuff1'
}
options {
ansiColor('xterm')
parallelsAlwaysFailFast()
buildDiscarder(logRotator(artifactDaysToKeepStr: '30'))
throttleJobProperty(
throttleEnabled: true,
throttleOption: 'project',
maxConcurrentPerNode: 1,
maxConcurrentTotal: 30,
)
}
stages {
stage('Formatting and Style') {
agent {
label 'stuff2'
}
when { expression { !params.Refresh } }
steps {
container('main') {
sh 'echo "inside MAIN in stage Formatting"'
checkoutGit(
credentialsId: git-ssh,
remoteUrl: 'ssh://git.t.com:123',
refspec: '+$GERRIT_REFSPEC:$GERRIT_REFSPEC',
branch: 'main'
)
}
}
}
}
您需要引用该字符串,否则看起来像是从变量
ssh
中减去变量
git
credentialsId: 'git-ssh',