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

Cannot use environment variables in Projects to build

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • Jenkins 2.52
      Parameterized Trigger Plugin 2.33

      I'm having trouble using the Parameterized trigger post-build action when used with an environment variable within the Projects to build section. Here's my configuration:

      Environment variable:

      DOWNSTREAM_JOB=Net
      

      Projects to build:

      CD_${DOWNSTREAM_JOB}_Cut
      

      When I run the build, the downstream build is correctly queued up, but the calling build doesn't actually complete. I see the following error in the logs:

      Apr 03, 2017 5:43:37 PM hudson.remoting.ExportTable unexportByOid
      SEVERE: Trying to unexport an object that's already unexported
      java.util.concurrent.ExecutionException: Invalid object ID 166 iota=1832
      at hudson.remoting.ExportTable.diagnoseInvalidObjectId(ExportTable.java:449)
      at hudson.remoting.ExportTable.unexportByOid(ExportTable.java:487)
      at hudson.remoting.Channel.unexport(Channel.java:691)
      at hudson.remoting.Channel.unexport(Channel.java:680)
      at hudson.remoting.UnexportCommand.execute(UnexportCommand.java:43)
      at hudson.remoting.Channel$1.handle(Channel.java:527)
      at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:83)
      Caused by: java.lang.Exception: Object appears to be deallocated at lease before Mon Apr 03 15:26:31 CEST 2017
      at hudson.remoting.ExportTable.diagnoseInvalidObjectId(ExportTable.java:445)
      ... 6 more
      
      Apr 03, 2017 5:43:37 PM hudson.remoting.ExportTable unexportByOid
      SEVERE: 2nd unexport attempt is here
      Command hudson.remoting.UnexportCommand@5148ff35 created at
      at hudson.remoting.Command.<init>(Command.java:67)
      at hudson.remoting.Command.<init>(Command.java:50)
      at hudson.remoting.UnexportCommand.<init>(UnexportCommand.java:33)
      at hudson.remoting.RemoteInvocationHandler.finalize(RemoteInvocationHandler.java:221)
      at java.lang.System$2.invokeFinalize(Unknown Source)
      at java.lang.ref.Finalizer.runFinalizer(Unknown Source)
      at java.lang.ref.Finalizer.access$100(Unknown Source)
      at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
      

      I then have to manually kill the build to complete it. Which then raises the following error:

      Apr 03, 2017 5:37:54 PM hudson.model.AbstractBuild$AbstractBuildExecution report
      Error
      WARNING: Step ‘Trigger parameterized build on other projects’ aborted due to exc
      eption:
      java.lang.InterruptedException
              at java.lang.Object.wait(Native Method)
              at java.lang.Object.wait(Object.java:502)
              at hudson.remoting.AsyncFutureImpl.get(AsyncFutureImpl.java:73)
              at hudson.plugins.parameterizedtrigger.BuildTrigger.perform(BuildTrigger.java:111)
              at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
              at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
              at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
              at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.cleanUp(MavenModuleSetBuild.java:1091)
              at hudson.model.Run.execute(Run.java:1780)
              at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
              at hudson.model.ResourceController.execute(ResourceController.java:97)
              at hudson.model.Executor.run(Executor.java:405)
      

      If I replace the environment variable with the actual job name, it runs without error. i.e.
      Projects to build:

      CD_Net_Cut
      

      Any ideas on how to resolve this?

            huybrechts huybrechts
            bengineer Ben Middleton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: