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

Empty Parameter replaced with Parameter literal

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: gradle-plugin
    • Labels:
    • Environment:
      OS : Windows 10
      Jenkins version : 2.68
      Gradle Plugin : 1.27
    • Similar Issues:

      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

          Hide
          tpreston Tim Preston added a comment -

          Also an issue in 1.27.1.

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

          Show
          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.
          Hide
          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]

          Show
          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]
          Hide
          wolfs Stefan Wolf added a comment -

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

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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: