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

Empty Parameter replaced with Parameter literal

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • gradle-plugin
    • OS : Windows 10
      Jenkins version : 2.68
      Gradle Plugin : 1.27

      When empty Job Parameter passed though jenkins to invoke gradle script, it do not evaluate to empty but takes parameter name in gradle script.

       

      Steps to reproduce: 

      1. Passing empty parameter to jenkins job

      2. Executing gradle script using Job parameter 

      3. Job execution takes job parameter to be literal, while expected empty

       

      Might be a regression from : https://issues.jenkins-ci.org/browse/JENKINS-42573

          [JENKINS-45300] Empty Parameter replaced with Parameter literal

          Tim Preston added a comment -

          Also an issue in 1.27.1.

          Tim Preston added a comment - Also an issue in 1.27.1.

          Alexander Komarov added a comment - - edited

          Another effect of this bug:

          Gradle step with Tasks: "task1 task2 $PARAM_1"

          In 1.26 this worked even if PARAM_1 was empty, gradle received an empty string in its place.  

          in 1.27.1 this fails (unknown task "$PARAM_1")

          Same for the Switches field, I have jobs with $PARAM_1 either set to "" or to "-i", for example.  This no longer works.

           

          All of the above used to work in 1.26.  I know that Token Macro Plugin is not the problem here because all of the above still works great in Maven Steps.

          Alexander Komarov added a comment - - edited Another effect of this bug: Gradle step with Tasks: "task1 task2 $PARAM_1" In 1.26 this worked even if PARAM_1 was empty, gradle received an empty string in its place.   in 1.27.1 this fails (unknown task "$PARAM_1") Same for the  Switches field, I have jobs with $PARAM_1 either set to "" or to "-i", for example.  This no longer works.   All of the above used to work in 1.26 .  I know that Token Macro Plugin is not the problem here because all of the above still works great in Maven Steps.

          Code changed in jenkins
          User: Stefan Wolf
          Path:
          src/main/java/hudson/plugins/gradle/Gradle.java
          src/test/groovy/hudson/plugins/gradle/AbstractIntegrationTest.groovy
          src/test/groovy/hudson/plugins/gradle/GradlePluginIntegrationTest.groovy
          src/test/groovy/hudson/plugins/gradle/PropertyPassingIntegrationTest.groovy
          http://jenkins-ci.org/commit/gradle-plugin/e64b4dd9e90fe365fa5f190f05f587d5f0ac0a9b
          Log:
          Don't remove empty build vars

          By utilizing the EnvVars.overrideAll(Map) method, it internally removes keys where the value is null or an empty string. This results in those parameters not being rewritten to empty properties as expected and the properties instead have the jenkins replacement string in them instead.

          [FIXES JENKINS-45300]

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stefan Wolf Path: src/main/java/hudson/plugins/gradle/Gradle.java src/test/groovy/hudson/plugins/gradle/AbstractIntegrationTest.groovy src/test/groovy/hudson/plugins/gradle/GradlePluginIntegrationTest.groovy src/test/groovy/hudson/plugins/gradle/PropertyPassingIntegrationTest.groovy http://jenkins-ci.org/commit/gradle-plugin/e64b4dd9e90fe365fa5f190f05f587d5f0ac0a9b Log: Don't remove empty build vars By utilizing the EnvVars.overrideAll(Map) method, it internally removes keys where the value is null or an empty string. This results in those parameters not being rewritten to empty properties as expected and the properties instead have the jenkins replacement string in them instead. [FIXES JENKINS-45300]

          Stefan Wolf added a comment -

          Closing since I released 1.28 which contains a fix for this issue.

          Stefan Wolf added a comment - Closing since I released 1.28 which contains a fix for this issue.

            wolfs Stefan Wolf
            mohitjain1311 Mohit Jain
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: