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

P4 trigger cause ClassCastException in multi-configuration projects

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • matrix-project-plugin

      I have two jobs running side by side, a "Freestyle" job and a Matrix or "Multi-Configuration Project" (MCP) configured to do the same simple tasks. For both jobs after a Perforce trigger is received, the jobs will execute a P4-sync of the workspace, then use Powershell to Write-Output a simple message, and finally make a Slack notification.

      When a P4 trigger is received the Freestyle job executes as expected. However after the Matrix/MCP job is notified by the same trigger event, it seems unable to process that a change has taken place and never starts the P4-sync or other steps.

      By examining the jenkins.err.log I can see an exception is being thrown when Jenkins tries to process the job.

      jenkins.err.log
      2022-09-15 17:29:26.301+0000 [id=12008]	WARNING	h.p.b.g.GlobalTimeOutConfiguration#timeOutFor: Tests_P4Trigger_NameVars#1 cannot allow individual jobs to overwrite timeout due to ClassCastException
      java.lang.ClassCastException: class hudson.matrix.MatrixProject cannot be cast to class hudson.model.Project (hudson.matrix.MatrixProject is in unnamed module of loader jenkins.util.URLClassLoader2 @ab11188; hudson.model.Project is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @33bc72d1)
      	at hudson.plugins.build_timeout.global.GlobalTimeOutConfiguration.timeOutFor(GlobalTimeOutConfiguration.java:91)
      	at hudson.plugins.build_timeout.global.GlobalTimeOutRunListener.setUpEnvironment(GlobalTimeOutRunListener.java:43)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:615)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:483)
      	at hudson.model.Run.execute(Run.java:1899)
      	at hudson.matrix.MatrixBuild.run(MatrixBuild.java:323)
      	at hudson.model.ResourceController.execute(ResourceController.java:107)
      	at hudson.model.Executor.run(Executor.java:449)
      2022-09-15 17:29:27.342+0000 [id=12008]	INFO	o.j.p.p.w.ManualWorkspaceImpl#setClient: P4: Creating manual client: jenkins-built-in-Tests_P4Trigger_NameVars--1
      2022-09-15 17:29:27.353+0000 [id=73]	INFO	o.j.p.p.w.ManualWorkspaceImpl#setClient: P4: Creating manual client: jenkins-BP-JNKND-VS19-6-Tests_P4Trigger_SlackPost-0
      2022-09-15 17:29:27.602+0000 [id=11722]	INFO	o.j.plugins.p4.trigger.P4Hook#probeJobs: P4: probing: DAFI_7-66-SIEI_CLI_VS19
      

      Note the Matrix/MCP job will run successfully if started manually or by a timer. The job only fails after it receives a P4 trigger event.

      Reproducibility: Always

      Steps to Reproduce:

      1. Setup a Jenkins server to receive P4 Triggers.
      2. Setup a Perforce server that triggers a Jenkins server.
      3. Create a Matrix/MCP project that has a workspace mapping from the Perforce server.
      4. Use the Manual P4 trigger to run job for the first time.
        • Note the first run will work.
      5. Next submit a change in the Perforce server that will send a trigger to the Jenkins server.

      Result:
      Jenkins will receive the P4 Trigger, but during the processing of the job the exception above will be thrown, and the Matrix/MCP job will not execute.

      Expected Result:
      That a Matrix/MCP job would function like a Freestyle job. When a P4 trigger is received the required processing would not throw an exception and instead continue through all the steps.

            kohsuke Kohsuke Kawaguchi
            jgorden_sie John
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: