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

parameterized job with string having default 0 breaks groovy postbuild reading property

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Minor Minor
    • None
    • jenkins: 1.625.3
      groovy-postbuild: 1.8

      Summary
      When jenkins runs a parameterized job, if one of the string parameters has a value of 0 and the groovy postbuild task attempts to read that parameter, it will show up as null.

      To Reproduce

      1. Create a Jenkins Job
      2. 'This Build is parameterized'
      3. Add one string parameter (eg: name some-param) with default value 0
      4. Add a post-build action for groovy postbuild
      5. Add the following code:
        ```
        def varName = "some-param";
        def tempVal = manager.build.buildVariables.get(varName )
        if(tempVal == null || tempVal.equals("")){
        manager.listener.logger.println("${varName} not found: '${tempVal}'")
        }
        ```
      6. Run the parameterized build, leaving the default value
      7. View the console and note the log output of the empty param

            blaskovicz Zach Auclair
            blaskovicz Zach Auclair
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: