> git rev-list --no-walk d6ca7916095bc6b95612d3cf663d57508ec08af3 # 
timeout=10 [Checks API] No suitable checks publisher found. Running in 
Durability level: MAX_SURVIVABILITY [Checks API] No suitable checks 
publisher found. 
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
failed: WorkflowScript: 132: Method definition not expected here. Please 
define the method at an appropriate place or perhaps try using a 
block/Closure instead. at line: 132 column: 1. File: WorkflowScript @ line 
132, column 1. void validateBranch(String sourceBranchName) { ^ 1 error at 
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
 
at 
org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:958)

I have already checked the indentation/ block closure but seems to have 
proper closure. The line with node(Testnode) and node(windowsnode) is added 
at line 138 and 147 and even further because without them I was getting an 
error that missing `*Perhaps you forgot to surround the code with a step 
that provides this, such as: node*`

96 if(retrigger == 'No') {

97 node(testNode) {

98 cCo()

99 aD()

100 if(successStatus == 'YES') {

101 mAR(sourceProject)

102 }

103 }

104

105 if((successStatus!='NO' && productionPipelineInvocationFlag=='YES')) {

106 node(windowsNode){

107 aRI(sourceProject)

108 }

109 echo 'ansible playbook is started'

110

111 node(testNode) {

112 gPC(sourceProject)

113 gC()

114 gSSM()

115 gPostC(sourceProject)

116 tbAC(sourceProject)

117 }

118

119 node(windowsNode) {

120 nslookup()

121 createEmailList()

122 stage('Sending Email notifications') {

123 if(successStatus=='NOTAPPLICABLE') {

124 echo 'Sending mail without attachment'

125 NotifyUserWithoutAttachment(sourceProject,emailList)

126 }

127 else {

128 echo 'Sending mail with attachment'

129 NotifyUserWithAttachment(sourceProject,attachmentFileName,emailList)

130 }

131 }

132 }

133 }

134 }

135

136 else if(retrigger == 'Yes') {

137 if(stageName.equals("MLP")) {

138 node(testNode) {

139 print "Rerun from MAR Playbook"

140 mAR(sourceProject)

141 aRI(sourceProject)

142 gPC(sourceProject)

143 gC()

144 gSSM()

145 gPostC(sourceProject)

146 tbAC(sourceProject)}

147 node(windowsNode) {

148 nslookup()}

149

150 }

151 else if(stageName.equals("GL")) {

152 node(testNode) {

153 print "Rerun from GConfiguration Playbook"

154 gPC(sourceProject)

155 gC()

156 gSSM()

157 gPostC(sourceProject)

158 tbAC(sourceProject)}

159 node(windowsNode) {

160 nslookup()}

161 }

162 else if(stageName.equals("TBA")) {

163 node(testNode) {

164 print "Rerun from TBA Configuration"

165 tbAC(sourceProject)}

166 node(windowsNode) {

167 nslookup()}

168 }

169 }

170

171 // Creating Functions for all stages

172

173 void validateBranch(String sourceBranchName) {

174 stage("Validating the input branches") {

175 print "Validating Branch"

176 try {

177 if (sourceBranchName == "master") {

178 error "Master branch has been entered as input"

179 }

180 } catch(def exception) {

181 echo "Catch error ${exception}"

182 currentBuild.result = 'FAILURE'

183 sendMail(sourceProject, emailList)

184 bat "exit 1"

185 }

186 }

187 }

I have pasted the code(also in https://pastebin.com/Lw7nh31J
) along with line numbers to correlate correctly. Could someone please help 
to tell if these functions should be called/defined somewhere else out of 
the block?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1ded3b06-6a62-4cf1-9641-79a0c7340509n%40googlegroups.com.

Reply via email to