Team,
I am learning groovy and created a simple one but getting this error running pipeline on jenkins. not sure what it really means
+ 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)
my library is
checkoutGit.groovy
def call(Map config) {
println "Starting the script...1"
}
Jenkinsfile is
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'
)
}
}
}
}
You need to quote this string, otherwise it looks like you are subtracting variable ssh
from variable git
credentialsId: 'git-ssh',