Upon restart, the date parameter plugin is losing the date value.

       

      Reproduction Scenario

      1. Create a job with a date parameter and use it (for instance in a shell script).

      2. Put Jenkins in quiet mode

      3. Trigger a build of the job

      4. Restart

      5. After restart, the job will fail with:

       

      ERROR: Build step failed with exception java.lang.IllegalArgumentException: Null value not allowed as an environment variable: DATE at hudson.EnvVars.put(EnvVars.java:356) at hudson.model.StringParameterValue.buildEnvironment(StringParameterValue.java:56) at me.leejay.jenkins.dateparameter.DateParameterValue.buildEnvironment(DateParameterValue.java:81) at hudson.model.ParametersAction.buildEnvVars(ParametersAction.java:89) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:947) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:90) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537) at hudson.model.Run.execute(Run.java:1744) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:374)
      

      Explanation

      The class DateParameterValue inherits from StringParameterValue but its value field shadows a field of StringParameterValue. Upon restart, only the DateParameterValue field is populated, resulting in this error. Removing the shadow field fixes the issue. I made a PR with this fix.

          [JENKINS-54166] Date parameter is lost upon restart

          There are no comments yet on this issue.

            pierrebtz Pierre Beitz
            pierrebtz Pierre Beitz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: