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

Better handle environment with empty key on Windows

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None
    • Jenkins version: 1.650
      OS: Windows 2008 server

      First encounter this issue, when someone accidentally removed key value of one global properties. Suddenly all jobs started failing with exception message say "Parameter is incorrect" without detail information. Aware of the property change, spent a few hours to track down this issue.

      It turned out, not just global properties, a parameterized build job which has one parameter with empty key value, could cause the same error.

      Ideally, global properties, parameterized build config, should not allow key as empty in the first place. But there are many plugins could set properties which end up to environment properties passed to windows process.

      Could Jenkins do one of the following steps:
      1) after consolidate all environment properties, do a validation, if found empty key, break and print out all details
      Or
      2) after empty key found, skip it

      Steps to re-produce:
      1) create a free style job
      2) config it as parameterized build, add a String parameter, with key left as empty, value equals to "xyz"
      3) add build step, execute windows shell script with just one command:
      echo %path%

      output:

      [TestCmd] $ cmd /c call C:\Users\xyz\AppData\Local\Temp\hudson2947220984372050691.bat
      The parameter is incorrect
      FATAL: command execution failed
      java.io.IOException: Cannot run program "cmd" (in directory "c:\workspace\TestCmd"): CreateProcess error=87, The parameter is incorrect
      	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
      	at hudson.Proc$LocalProc.<init>(Proc.java:244)
      	at hudson.Proc$LocalProc.<init>(Proc.java:216)
      	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
      	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
      	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:95)
      	at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:64)
      	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
      	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:534)
      	at hudson.model.Run.execute(Run.java:1738)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
      	at java.lang.ProcessImpl.create(Native Method)
      	at java.lang.ProcessImpl.<init>(ProcessImpl.java:385)
      	at java.lang.ProcessImpl.start(ProcessImpl.java:136)
      	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
      	... 15 more
      
      

            Unassigned Unassigned
            kongs Shijun Kong
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: