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

Empty Parameter replaced with Parameter literal

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • gradle-plugin
    • OS : Windows 10
      Jenkins version : 2.68
      Gradle Plugin : 1.27

    Description

      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

      Attachments

        Activity

          mohitjain1311 Mohit Jain created issue -
          tpreston Tim Preston added a comment -

          Also an issue in 1.27.1.

          tpreston Tim Preston added a comment - Also an issue in 1.27.1.
          akom 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.

          akom 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_issue_link 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]
          scm_issue_link SCM/JIRA link daemon made changes -
          Field Original Value New Value
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          wolfs Stefan Wolf added a comment -

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

          wolfs Stefan Wolf added a comment - Closing since I released 1.28 which contains a fix for this issue.
          wolfs Stefan Wolf made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

              Created:
              Updated:
              Resolved: