Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### cat Jenkinsfile-rescan-MBPs
- import jenkins.model.*
- import hudson.model.*
- import hudson.util.PersistedList
- import jenkins.branch.*
- @NonCPS
- def parallelSubtasks(String verbose) {
- def subbuilds = [:]
- def jobs = Jenkins.instance.getAllItems()
- jobs.each { j ->
- //EMPTYRESULT-1// for (j in jobs) {
- //EMPTYRESULT-2// for (int i = 0; i < jobs.size(); i++) {
- //EMPTYRESULT-2// def j = jobs[i];
- if (j instanceof com.cloudbees.hudson.plugins.folder.Folder) {
- if (verbose.equals("true")) {
- echo 'Ignoring JOB which is a com.cloudbees.hudson.plugins.folder.Folder : ' + j.fullName
- }
- return
- }
- if (j instanceof jenkins.branch.OrganizationFolder) {
- if (verbose.equals("true")) {
- echo 'Ignoring JOB which is a jenkins.branch.OrganizationFolder : ' + j.fullName
- }
- return
- }
- if (! (j instanceof org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject) ) {
- if (verbose.equals("true")) {
- echo 'Ignoring JOB which is not an MBP: ' + j.fullName
- }
- return;
- }
- if ( ! j.fullName.contains("/") ) {
- echo 'Ignoring MBP JOB which is not under a (organization) folder, so has and hopefully honours a schedule of its own: ' + j.fullName
- return;
- }
- // TODO: Determine that MBP's schedule and only fire below if it is "once a day" (hardcoded)?
- subbuilds["${j.fullName}"] = {
- stage("Scan ${j.fullName}") {
- steps {
- echo "Rescanning '${j.fullName}' ..."
- //DEBUG// build job: "${j.fullName}", quietPeriod: 0, wait: true, propagate: true
- }
- }
- } // end of def subbuilds[j.fullName]
- } // jobs.each() clause
- // Unleash hell, wait for results
- parallel subbuilds
- }
- pipeline {
- options {
- /*
- 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.")
- */
- disableConcurrentBuilds()
- disableResume()
- durabilityHint('PERFORMANCE_OPTIMIZED')
- buildDiscarder(logRotator(numToKeepStr: '10'))
- skipDefaultCheckout true
- }
- triggers {
- cron('H/15 * * * *')
- }
- agent {label "master||master-real||master-worker"}
- parameters {
- booleanParam (
- defaultValue: false,
- description: 'Print found and skipped items?',
- name: 'JOBLIST_VERBOSE'
- )
- }
- stages {
- stage('Scan MBP jobs') {
- steps {
- milestone 1
- script {
- parallelSubtasks( "${params.JOBLIST_VERBOSE}" )
- } // script clause
- } // steps clause
- }
- }
- }
- ===== LOGS ====
- ...
- [Pipeline] parallel
- [Pipeline] [42ity-github/cxxtools] { (Branch: 42ity-github/cxxtools)
- [Pipeline] [42ity-github/cxxtools] stage
- [Pipeline] [42ity-github/czmq] { (Branch: 42ity-github/czmq)
- [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...
- ...
- [Pipeline] [42ity-github/cxxtools] { (Scan 42ity-github/cxxtools)
- [Pipeline] [42ity-github/cxxtools] }
- [Pipeline] [42ity-github/czmq] { (Scan 42ity-github/czmq)
- [Pipeline] [42ity-github/czmq] }
- ...
- [Pipeline] [42ity-github/cxxtools] }
- [42ity-github/cxxtools] Failed in branch 42ity-github/cxxtools
- [Pipeline] [42ity-github/czmq] }
- [42ity-github/czmq] Failed in branch 42ity-github/czmq
- ...
- [Pipeline] End of Pipeline
- an exception which occurred:
- in field groovy.lang.Reference.value
- in object groovy.lang.Reference@55af5912
- in field WorkflowScript$_parallelSubtasks_closure1$_closure2.j
- in object WorkflowScript$_parallelSubtasks_closure1$_closure2@709a1d08
- in field groovy.lang.Reference.value
- in object groovy.lang.Reference@18d1ef42
- in field WorkflowScript$_parallelSubtasks_closure1.subbuilds
- in object WorkflowScript$_parallelSubtasks_closure1@3fec8a95
- in field groovy.lang.Closure.delegate
- in object WorkflowScript$_parallelSubtasks_closure1$_closure2@cb96be0
- in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.closures
- in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@362c71dc
- in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@362c71dc
- Caused: java.io.NotSerializableException: org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:860)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
- at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
- at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
- at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
- at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
- at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
- at java.util.LinkedHashMap.internalWriteEntries(LinkedHashMap.java:333)
- at java.util.HashMap.writeObject(HashMap.java:1363)
- at sun.reflect.GeneratedMethodAccessor933.invoke(Unknown Source)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:498)
- at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
- at org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
- at org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
- at org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
- at org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
- at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
- at java.util.HashMap.internalWriteEntries(HashMap.java:1790)
- at java.util.HashMap.writeObject(HashMap.java:1363)
- at sun.reflect.GeneratedMethodAccessor933.invoke(Unknown Source)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:498)
- at org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:273)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:976)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
- at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
- at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
- at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
- at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
- at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
- at org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
- at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:467)
- at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:443)
- at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:430)
- at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:367)
- at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:82)
- at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:243)
- at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:231)
- at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
- at java.util.concurrent.FutureTask.run(FutureTask.java:266)
- at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
- at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
- at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
- at java.util.concurrent.FutureTask.run(FutureTask.java:266)
- at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
- at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
- at java.lang.Thread.run(Thread.java:748)
- Finished: FAILURE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement