Error: groovy.lang.MissingPropertyException: No such property: master for class: groovy.lang.Binding 16:31:47 at groovy.lang.Binding.getVariable(Binding.java:63) 16:31:47 at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:271) 16:31:47 at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:353) 16:31:47 at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:357) 16:31:47 at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:333) 16:31:47 at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:333) 16:31:47 at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:333) 16:31:47 at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29) 16:31:47 at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20) 16:31:47 at WorkflowScript.run(WorkflowScript:71) 16:31:47 at cps.transform(Native Method) 16:31:47 at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74) 16:31:47 at com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30) 16:31:47 at com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66) 16:31:47 at jdk.internal.reflect.GeneratedMethodAccessor335.invoke(Unknown Source) 16:31:47 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 16:31:47 at java.base/java.lang.reflect.Method.invoke(Method.java:566) 16:31:47 at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) 16:31:47 at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) 16:31:47 at com.cloudbees.groovy.cps.Next.step(Next.java:83)
pipeline
{
agent {label 'maven36'}
environment
{
BUILD_USER_ID="${specificCause.userId[0]}"
GIT_CREDS=credentials('DEVOPS')
encodedPass=URLEncoder.encode(GIT_CREDS_PSW, "UTF-8")
user="$GIT_CREDS_USR"
}
stages
{
stage('Clone')
{
steps
{
dir("${env.WORKSPACE}")
{
git credentialsId: 'DEVOPS', url: gitUrl
}
}
}
stage('Build')
{
steps
{
echo "================Build===================="
dir("${env.WORKSPACE}")
{
sh 'ls -lrt'
}
sh 'echo "======Build success======"'
}
}
stage('Publish Artifacts to UCD') {
steps {
script {
node (master) {
try {
echo "Publishing"
withCredentials([usernamePassword(credentialsId: "${UCD_CREDENTIAL_ID}", usernameVariable: 'UCD_USER', passwordVariable: 'UCD_PASSWORD')]){
step([$class: 'UCDeployPublisher',
siteName: 'UCD - Production',
altUser: [
altPassword: hudson.util.Secret.fromString(env.UCD_PASSWORD),
altUsername: env.UCD_USER
],
component: [
$class: 'com.urbancode.jenkins.plugins.ucdeploy.VersionHelper$VersionBlock',
componentName: " EUX0_DS",
delivery: [
$class: 'com.urbancode.jenkins.plugins.ucdeploy.DeliveryHelper$Push',
pushVersion: "${UCD_PUBLISH_VERSION}",
baseDir: "${WORKSPACE}/toucd",
fileIncludePatterns: '**/*',
fileExcludePatterns: '',
pushProperties: '',
pushDescription: '',
pushIncremental: false
]
]
])
}
}
catch (Exception errorlogs) {
println(errorlogs)
currentBuild.result = 'FAILED'
echo "Stage Status is ${currentBuild.result}"
error 'Exiting CI Pipeline'
}
}
}
}
}
stage('Deploy to UCD') {
steps {
script{
withCredentials([usernamePassword(credentialsId: 'DEVOPS', passwordVariable: 'password', usernameVariable: 'username')]) {
try {
hudson.util.Secret pass = hudson.util.Secret.fromString("${env.password}")
//env.ProjectName=sh(script: 'echo $JOB_BASE_NAME | sed "s/DN00_//"' | tr -d "\r\n" ', returnStdout: true)
//env.Deploy_env=sh(script: 'DEPLOY_DEV=DEV;DEPLOY_QA=QA;ROLLBACK_DEV=DEV;ROLLBACK_QA=QA;BUGFIX_QA=DEV;eval ENVR=\'\$\'$TASK; echo $ENVR | tr -d "\r\n" ', returnStdout: true)
//env.Deploy_process=sh(script: 'ROLLBACK_DEV=Rollback_"${env.ProjectName}";DEPLOY_DEV=Deploy_"${env.ProjectName}";DEPLOY_QA=Deploy_"${env.ProjectName}";ROLLBACK_QA=Rollback_"${env.ProjectName}";BUGFIX_QA=Deploy_"${env.ProjectName}";eval PRO=\'\$\'$TASK; echo $PRO | tr -d "\r\n"', returnStdout: true)
step([
$class: 'UCDeployPublisher',
siteName: 'UCD - Production',
altUser: [
$class: 'com.urbancode.jenkins.plugins.ucdeploy.UCDeployPublisher$UserBlock',
altUsername: "${env.username}",
altPassword: pass
],
deploy: [
$class: 'com.urbancode.jenkins.plugins.ucdeploy.DeployHelper$DeployBlock',
deployApp: "EUX0_Retail_Credit_Operational_Datastore_DATASTAGE",
deployEnv: "DEV",
deployProc: "Deploy",
deployVersions: "${EUX0_DS}:${JENKINS_VER_CD}-${BUILD_NUMBER}",
deployOnlyChanged: false
]
])
currentBuild.result = 'SUCCESS'
} catch (Exception e) {
throw(e)
}
}
}
}
}
}
post {
always {
deleteDir()
}
}
}
You have to use single quote for the node name
node (master) -> node ('master')