Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-62606

Jobs created with JCASC using Job dsl are not queued on start up.

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Jobs created with JCASC using Job DSL are not queued on startup.

      Jcasc config added for creating a freestyle Job and queue it for run the JOb on startup. Jenkins has the Job created but the Job dint run on startup even after queuing.

      // code placeholder
      
      jobs:
          - script: >
              freeStyleJob('Seed_job') {
                  scm {
                      git{
                          branch('master')
                          remote{
                              credentials('github_e_token')
                              url('https://github.com/jenkins_bootstrap.git')
                                  }                 
                              }
                          }
                  triggers {
                       githubPush()
                           }
                  steps {
                      dsl {
                          external('seedJob.groovy')
                          removeAction('DELETE')
                      }
                      }
                  }
          - script: queue('Seed_job')
      

       

        Attachments

          Activity

          Hide
          santhu3064 santhosh ruttala added a comment -

          There is an issue opened in JCASC plugin which is closed to create an issue under Job DSL plugin.

           

          https://github.com/jenkinsci/configuration-as-code-plugin/issues/876

          Show
          santhu3064 santhosh ruttala added a comment - There is an issue opened in JCASC plugin which is closed to create an issue under Job DSL plugin.   https://github.com/jenkinsci/configuration-as-code-plugin/issues/876
          Hide
          jansohn Robin Jansohn added a comment -

          I second this report. Here's the startup log where we can see that it schedules a build according to the logs but somehow the job is never run.

          2020-06-09 06:01:05.134+0000 [id=1]     INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
          2020-06-09 06:01:05.507+0000 [id=1]     INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@df5f5c0{Jenkins v2.222.3,/jenkins,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war}
          2020-06-09 06:01:05.567+0000 [id=1]     INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@6025e1b6{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
          2020-06-09 06:01:05.568+0000 [id=1]     INFO    org.eclipse.jetty.server.Server#doStart: Started @2904ms
          2020-06-09 06:01:05.568+0000 [id=23]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
          2020-06-09 06:01:06.137+0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
          2020-06-09 06:01:09.132+0000 [id=29]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
          2020-06-09 06:01:17.931+0000 [id=34]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
          2020-06-09 06:01:22.100+0000 [id=32]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
          2020-06-09 06:01:22.125+0000 [id=31]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
          2020-06-09 06:01:23.656+0000 [id=35]    INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
          2020-06-09 06:01:25.581+0000 [id=31]    WARNING i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration#metaClass: type is abstract but not Describable.
          2020-06-09 06:01:27.131+0000 [id=31]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@5cc69bc4: display name [Root WebApplicationContext]; startup date [Tue Jun 09 08:01:27 CEST 2020]; root of context hierarchy
          2020-06-09 06:01:27.131+0000 [id=31]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@5cc69bc4]: org.springframework.beans.factory.support.DefaultListableBeanFactory@56f193fe
          2020-06-09 06:01:27.142+0000 [id=31]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@56f193fe: defining beans [authenticationManager,activeDirectory]; root of factory hierarchy
          2020-06-09 06:01:27.280+0000 [id=31]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@1d219850: display name [Root WebApplicationContext]; startup date [Tue Jun 09 08:01:27 CEST 2020]; root of context hierarchy
          2020-06-09 06:01:27.280+0000 [id=31]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@1d219850]: org.springframework.beans.factory.support.DefaultListableBeanFactory@42f70773
          2020-06-09 06:01:27.280+0000 [id=31]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@42f70773: defining beans [filter,legacy]; root of factory hierarchy
          2020-06-09 06:01:28.020+0000 [id=31]    WARNING i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration#metaClass: type is abstract but not Describable.
          Processing provided DSL script
          2020-06-09 06:01:29.759+0000 [id=78]    WARNING j.t.i.j.MissingClassTelemetry#reportException: Added a missed class for missing class telemetry. Class: com.sun.jndi.url.java.javaURLContextFactory
          java.lang.ClassNotFoundException: com.sun.jndi.url.java.javaURLContextFactory
                  at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1387)
                  at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1342)
                  at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1089)
                  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
                  at hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch4(RemoteClassLoader.java:849)
                  at hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch3(RemoteClassLoader.java:893)
                  at jdk.internal.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
                  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                  at java.base/java.lang.reflect.Method.invoke(Method.java:566)
                  at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:931)
                  at hudson.remoting.Request$2.run(Request.java:369)
                  at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
                  at org.jenkinsci.remoting.CallableDecorator.call(CallableDecorator.java:18)
                  at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
                  at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
                  at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71)
                  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
                  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
                  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
                  at java.base/java.lang.Thread.run(Thread.java:834)
          2020-06-09 06:01:32.260+0000 [id=31]    INFO    j.j.plugin.JenkinsJobManagement#createOrUpdateConfig: createOrUpdateConfig for Seed-Job
          Processing provided DSL script
          2020-06-09 06:01:32.578+0000 [id=31]    INFO    j.j.plugin.JenkinsJobManagement#queueJob: Scheduling build of Seed-Job from Seed-Job
          2020-06-09 06:01:32.593+0000 [id=31]    INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
          2020-06-09 06:01:32.594+0000 [id=31]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
          2020-06-09 06:01:32.602+0000 [id=33]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
          2020-06-09 06:01:32.608+0000 [id=30]    INFO    j.util.groovy.GroovyHookScript#execute: Executing /var/jenkins_home/init.groovy.d/tcp-slave-agent-port.groovy
          2020-06-09 06:01:32.622+0000 [id=101]   INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata
          2020-06-09 06:01:32.625+0000 [id=101]   INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 2 ms
          2020-06-09 06:01:32.782+0000 [id=34]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@594400ec: display name [Root WebApplicationContext]; startup date [Tue Jun 09 08:01:32 CEST 2020]; root of context hierarchy
          2020-06-09 06:01:32.783+0000 [id=34]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@594400ec]: org.springframework.beans.factory.support.DefaultListableBeanFactory@38c5f983
          2020-06-09 06:01:32.783+0000 [id=34]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@38c5f983: defining beans [filter,legacy]; root of factory hierarchy
          2020-06-09 06:01:32.917+0000 [id=33]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
          2020-06-09 06:01:33.013+0000 [id=22]    INFO    hudson.WebAppMain$3#run: Jenkins is fully up and running
          

          Jenkins v2.222.3, job-dsl v1.77, configuration-as-code v1.41

          Show
          jansohn Robin Jansohn added a comment - I second this report. Here's the startup log where we can see that it schedules a build according to the logs but somehow the job is never run. 2020-06-09 06:01:05.134+0000 [id=1] INFO hudson.WebAppMain#contextInitialized: Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME") 2020-06-09 06:01:05.507+0000 [id=1] INFO o.e.j.s.handler.ContextHandler#doStart: Started w.@df5f5c0{Jenkins v2.222.3,/jenkins,file:///var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war} 2020-06-09 06:01:05.567+0000 [id=1] INFO o.e.j.server.AbstractConnector#doStart: Started ServerConnector@6025e1b6{HTTP/1.1, (http/1.1)}{0.0.0.0:8080} 2020-06-09 06:01:05.568+0000 [id=1] INFO org.eclipse.jetty.server.Server#doStart: Started @2904ms 2020-06-09 06:01:05.568+0000 [id=23] INFO winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled 2020-06-09 06:01:06.137+0000 [id=29] INFO jenkins.InitReactorRunner$1#onAttained: Started initialization 2020-06-09 06:01:09.132+0000 [id=29] INFO jenkins.InitReactorRunner$1#onAttained: Listed all plugins 2020-06-09 06:01:17.931+0000 [id=34] INFO jenkins.InitReactorRunner$1#onAttained: Prepared all plugins 2020-06-09 06:01:22.100+0000 [id=32] INFO jenkins.InitReactorRunner$1#onAttained: Started all plugins 2020-06-09 06:01:22.125+0000 [id=31] INFO jenkins.InitReactorRunner$1#onAttained: Augmented all extensions 2020-06-09 06:01:23.656+0000 [id=35] INFO jenkins.InitReactorRunner$1#onAttained: System config loaded 2020-06-09 06:01:25.581+0000 [id=31] WARNING i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration#metaClass: type is abstract but not Describable. 2020-06-09 06:01:27.131+0000 [id=31] INFO o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@5cc69bc4: display name [Root WebApplicationContext]; startup date [Tue Jun 09 08:01:27 CEST 2020]; root of context hierarchy 2020-06-09 06:01:27.131+0000 [id=31] INFO o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@5cc69bc4]: org.springframework.beans.factory.support.DefaultListableBeanFactory@56f193fe 2020-06-09 06:01:27.142+0000 [id=31] INFO o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@56f193fe: defining beans [authenticationManager,activeDirectory]; root of factory hierarchy 2020-06-09 06:01:27.280+0000 [id=31] INFO o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@1d219850: display name [Root WebApplicationContext]; startup date [Tue Jun 09 08:01:27 CEST 2020]; root of context hierarchy 2020-06-09 06:01:27.280+0000 [id=31] INFO o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@1d219850]: org.springframework.beans.factory.support.DefaultListableBeanFactory@42f70773 2020-06-09 06:01:27.280+0000 [id=31] INFO o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@42f70773: defining beans [filter,legacy]; root of factory hierarchy 2020-06-09 06:01:28.020+0000 [id=31] WARNING i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration#metaClass: type is abstract but not Describable. Processing provided DSL script 2020-06-09 06:01:29.759+0000 [id=78] WARNING j.t.i.j.MissingClassTelemetry#reportException: Added a missed class for missing class telemetry. Class: com.sun.jndi.url.java.javaURLContextFactory java.lang.ClassNotFoundException: com.sun.jndi.url.java.javaURLContextFactory at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1387) at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1342) at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1089) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch4(RemoteClassLoader.java:849) at hudson.remoting.RemoteClassLoader$ClassLoaderProxy.fetch3(RemoteClassLoader.java:893) at jdk.internal.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:931) at hudson.remoting.Request$2.run(Request.java:369) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at org.jenkinsci.remoting.CallableDecorator.call(CallableDecorator.java:18) at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21) at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46) at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:71) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) 2020-06-09 06:01:32.260+0000 [id=31] INFO j.j.plugin.JenkinsJobManagement#createOrUpdateConfig: createOrUpdateConfig for Seed-Job Processing provided DSL script 2020-06-09 06:01:32.578+0000 [id=31] INFO j.j.plugin.JenkinsJobManagement#queueJob: Scheduling build of Seed-Job from Seed-Job 2020-06-09 06:01:32.593+0000 [id=31] INFO jenkins.InitReactorRunner$1#onAttained: System config adapted 2020-06-09 06:01:32.594+0000 [id=31] INFO jenkins.InitReactorRunner$1#onAttained: Loaded all jobs 2020-06-09 06:01:32.602+0000 [id=33] INFO jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated 2020-06-09 06:01:32.608+0000 [id=30] INFO j.util.groovy.GroovyHookScript#execute: Executing /var/jenkins_home/init.groovy.d/tcp-slave-agent-port.groovy 2020-06-09 06:01:32.622+0000 [id=101] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata 2020-06-09 06:01:32.625+0000 [id=101] INFO hudson.model.AsyncPeriodicWork#lambda$doRun$0: Finished Download metadata. 2 ms 2020-06-09 06:01:32.782+0000 [id=34] INFO o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@594400ec: display name [Root WebApplicationContext]; startup date [Tue Jun 09 08:01:32 CEST 2020]; root of context hierarchy 2020-06-09 06:01:32.783+0000 [id=34] INFO o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@594400ec]: org.springframework.beans.factory.support.DefaultListableBeanFactory@38c5f983 2020-06-09 06:01:32.783+0000 [id=34] INFO o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@38c5f983: defining beans [filter,legacy]; root of factory hierarchy 2020-06-09 06:01:32.917+0000 [id=33] INFO jenkins.InitReactorRunner$1#onAttained: Completed initialization 2020-06-09 06:01:33.013+0000 [id=22] INFO hudson.WebAppMain$3#run: Jenkins is fully up and running Jenkins v2.222.3, job-dsl v1.77, configuration-as-code v1.41
          Hide
          jetersen Joseph Petersen added a comment -

          I suspect that JobDSL loads the script without waiting for the completion of the previous script.

          Show
          jetersen Joseph Petersen added a comment - I suspect that JobDSL loads the script without waiting for the completion of the previous script.
          Hide
          jtancer Jon Tancer added a comment - - edited

          I am having the same problem on my end.  Running latest versions of Jenkins LTS and all plugins.

           

          I also tried the following and although the job was successfully created, it was not queued.

          def myJob = job('my-job') {
            ... 
          };
          queue(myJob);
          
          Show
          jtancer Jon Tancer added a comment - - edited I am having the same problem on my end.  Running latest versions of Jenkins LTS and all plugins.   I also tried the following and although the job was successfully created, it was not queued. def myJob = job( 'my-job' ) { ... }; queue(myJob);

            People

            Assignee:
            daspilker Daniel Spilker
            Reporter:
            santhu3064 santhosh ruttala
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated: