Advertisement
jimklimov

Rescan MBPs - failed attempt (serialization exception)

Feb 22nd, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.53 KB | None | 0 0
  1. ### cat Jenkinsfile-rescan-MBPs
  2.  
  3. import jenkins.model.*
  4. import hudson.model.*
  5. import hudson.util.PersistedList
  6. import jenkins.branch.*
  7.  
  8. @NonCPS
  9. def parallelSubtasks(String verbose) {
  10. def subbuilds = [:]
  11. def jobs = Jenkins.instance.getAllItems()
  12.  
  13. jobs.each { j ->
  14. //EMPTYRESULT-1// for (j in jobs) {
  15. //EMPTYRESULT-2// for (int i = 0; i < jobs.size(); i++) {
  16. //EMPTYRESULT-2// def j = jobs[i];
  17.  
  18. if (j instanceof com.cloudbees.hudson.plugins.folder.Folder) {
  19. if (verbose.equals("true")) {
  20. echo 'Ignoring JOB which is a com.cloudbees.hudson.plugins.folder.Folder : ' + j.fullName
  21. }
  22. return
  23. }
  24. if (j instanceof jenkins.branch.OrganizationFolder) {
  25. if (verbose.equals("true")) {
  26. echo 'Ignoring JOB which is a jenkins.branch.OrganizationFolder : ' + j.fullName
  27. }
  28. return
  29. }
  30. if (! (j instanceof org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject) ) {
  31. if (verbose.equals("true")) {
  32. echo 'Ignoring JOB which is not an MBP: ' + j.fullName
  33. }
  34. return;
  35. }
  36. if ( ! j.fullName.contains("/") ) {
  37. echo 'Ignoring MBP JOB which is not under a (organization) folder, so has and hopefully honours a schedule of its own: ' + j.fullName
  38. return;
  39. }
  40. // TODO: Determine that MBP's schedule and only fire below if it is "once a day" (hardcoded)?
  41.  
  42. subbuilds["${j.fullName}"] = {
  43. stage("Scan ${j.fullName}") {
  44. steps {
  45. echo "Rescanning '${j.fullName}' ..."
  46. //DEBUG// build job: "${j.fullName}", quietPeriod: 0, wait: true, propagate: true
  47. }
  48. }
  49. } // end of def subbuilds[j.fullName]
  50.  
  51. } // jobs.each() clause
  52.  
  53. // Unleash hell, wait for results
  54. parallel subbuilds
  55. }
  56.  
  57.  
  58. pipeline {
  59. options {
  60. /*
  61. description("This job runs regularly to find and rescan multibranch pipeline jobs (e.g. generated via organization folders) to add monitoring of new PRs (and disable monitoring of merged PRs) in a timely fashion.")
  62. */
  63. disableConcurrentBuilds()
  64. disableResume()
  65. durabilityHint('PERFORMANCE_OPTIMIZED')
  66. buildDiscarder(logRotator(numToKeepStr: '10'))
  67. skipDefaultCheckout true
  68. }
  69. triggers {
  70. cron('H/15 * * * *')
  71. }
  72. agent {label "master||master-real||master-worker"}
  73. parameters {
  74. booleanParam (
  75. defaultValue: false,
  76. description: 'Print found and skipped items?',
  77. name: 'JOBLIST_VERBOSE'
  78. )
  79. }
  80. stages {
  81. stage('Scan MBP jobs') {
  82. steps {
  83. milestone 1
  84. script {
  85. parallelSubtasks( "${params.JOBLIST_VERBOSE}" )
  86. } // script clause
  87. } // steps clause
  88. }
  89. }
  90. }
  91.  
  92.  
  93. ===== LOGS ====
  94.  
  95. ...
  96. [Pipeline] parallel
  97. [Pipeline] [42ity-github/cxxtools] { (Branch: 42ity-github/cxxtools)
  98. [Pipeline] [42ity-github/cxxtools] stage
  99. [Pipeline] [42ity-github/czmq] { (Branch: 42ity-github/czmq)
  100. [Pipeline] [42ity-github/cxxtools] stage <<<<< looking at logs, this is a fishy one, all "stage" reports are tagged the same; other lines are per-repo...
  101. ...
  102.  
  103. [Pipeline] [42ity-github/cxxtools] { (Scan 42ity-github/cxxtools)
  104. [Pipeline] [42ity-github/cxxtools] }
  105. [Pipeline] [42ity-github/czmq] { (Scan 42ity-github/czmq)
  106. [Pipeline] [42ity-github/czmq] }
  107.  
  108. ...
  109.  
  110. [Pipeline] [42ity-github/cxxtools] }
  111. [42ity-github/cxxtools] Failed in branch 42ity-github/cxxtools
  112. [Pipeline] [42ity-github/czmq] }
  113. [42ity-github/czmq] Failed in branch 42ity-github/czmq
  114. ...
  115.  
  116. [Pipeline] End of Pipeline
  117. an exception which occurred:
  118. in field groovy.lang.Reference.value
  119. in object groovy.lang.Reference@55af5912
  120. in field WorkflowScript$_parallelSubtasks_closure1$_closure2.j
  121. in object WorkflowScript$_parallelSubtasks_closure1$_closure2@709a1d08
  122. in field groovy.lang.Reference.value
  123. in object groovy.lang.Reference@18d1ef42
  124. in field WorkflowScript$_parallelSubtasks_closure1.subbuilds
  125. in object WorkflowScript$_parallelSubtasks_closure1@3fec8a95
  126. in field groovy.lang.Closure.delegate
  127. in object WorkflowScript$_parallelSubtasks_closure1$_closure2@cb96be0
  128. in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
  129. in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@362c71dc
  130. in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@362c71dc
  131. Caused: java.io.NotSerializableException: org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject
  132. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
  133. at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
  134. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
  135. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
  136. at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
  137. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
  138. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
  139. at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
  140. at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
  141. at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
  142. at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
  143. at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
  144. at java.util.LinkedHashMap.internalWriteEntries(LinkedHashMap.java:333)
  145. at java.util.HashMap.writeObject(HashMap.java:1363)
  146. at sun.reflect.GeneratedMethodAccessor933.invoke(Unknown Source)
  147. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  148. at java.lang.reflect.Method.invoke(Method.java:498)
  149. at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273)
  150. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
  151. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
  152. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
  153. at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
  154. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
  155. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
  156. at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
  157. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
  158. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
  159. at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
  160. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
  161. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
  162. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
  163. at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
  164. at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
  165. at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
  166. at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
  167. at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
  168. at java.util.HashMap.internalWriteEntries(HashMap.java:1790)
  169. at java.util.HashMap.writeObject(HashMap.java:1363)
  170. at sun.reflect.GeneratedMethodAccessor933.invoke(Unknown Source)
  171. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  172. at java.lang.reflect.Method.invoke(Method.java:498)
  173. at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273)
  174. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
  175. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
  176. at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
  177. at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
  178. at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
  179. at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
  180. at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
  181. at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
  182. at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
  183. at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
  184. at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:467)
  185. at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:443)
  186. at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:430)
  187. at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:367)
  188. at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:82)
  189. at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:243)
  190. at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:231)
  191. at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
  192. at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  193. at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
  194. at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
  195. at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  196. at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  197. at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  198. at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  199. at java.lang.Thread.run(Thread.java:748)
  200. Finished: FAILURE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement