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

Active Choices Reactive Reference Parameters don't parse equals character ('=') properly.

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Case 1

      • Given an Active Choices Parameter called "LIST"
        • Groovy script
          return ["A=1","B=2","C-3"]
          
      • Given an Active Choices Reactive Reference Parameter called "LIST_SELECTION"
        • Groovy script
          return LIST
          
        • Choice Type = "Formatted HTML"
        • Referenced parameters = LIST
      • When I run this job selecting any value in LIST cointaining equals character ("=") , LIST_SELECTION parameter is always empty. Otherwise, LIST_SELECTION parameter shows selected LIST value if it doesn't include "=" character.

      Case 2

      • Given a String Parameter called "FOO"
      • Given an Active Choices Reactive Reference Parameter called "FOO_VALUE"
        • Groovy script:
          return FOO
          
        • Choice Type = "Formatted HTML"
        • Referenced parameters = FOO
      • When I run this job and introducing some value cointaining equals character ("=") in FOO parameter, FOO_VALUE parameter don't show FOO value. Otherwise, FOO_VALUE parameter shows FOO parameter value if it doesn't include "=" character

        Attachments

          Activity

          Hide
          ioannis Ioannis Moutsatsos added a comment -

          I have also run into this issue and I remember having to write 'equals' instead of '=' as a workaround.

          Show
          ioannis Ioannis Moutsatsos added a comment - I have also run into this issue and I remember having to write 'equals' instead of '=' as a workaround.
          Hide
          jmcubel Jose Maria Cubel added a comment -

          Yes, as a workaround I'm encoding problematic characters as '=' or ',' (see JENKINS-38570) and decoding them when necessary.

          Show
          jmcubel Jose Maria Cubel added a comment - Yes, as a workaround I'm encoding problematic characters as '=' or ',' (see JENKINS-38570 ) and decoding them when necessary.
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Found an easy way to fix this issue. When the code splits the parameters, we are now considering only the first '='.

          The way the plug-in (JS + Java) works, is that your LIST parameter gets eval'd, which by default will be A=1, before the user selects anything.

          Then this value gets sent to the Java code via JavaScript, with a value such as LIST=A=1. That's where the value was discarded, as we accepted only single values, or key+value values.

          Now it will interpret the value in a way that we will have

          {LIST: A=1}

          (used a different syntax just to demonstrate the LIST is the key).

          Tested locally, wrote units test, all other tests pass. But will probably release to experimental update center in the next days, so people can play with it before a release to Jenkins update center (probably one week before x-mas).

          Thanks for reporting
          Bruno

          Show
          kinow Bruno P. Kinoshita added a comment - Found an easy way to fix this issue. When the code splits the parameters, we are now considering only the first '='. The way the plug-in (JS + Java) works, is that your LIST parameter gets eval'd, which by default will be A=1, before the user selects anything. Then this value gets sent to the Java code via JavaScript, with a value such as LIST=A=1. That's where the value was discarded, as we accepted only single values, or key+value values. Now it will interpret the value in a way that we will have {LIST: A=1} (used a different syntax just to demonstrate the LIST is the key). Tested locally, wrote units test, all other tests pass. But will probably release to experimental update center in the next days, so people can play with it before a release to Jenkins update center (probably one week before x-mas). Thanks for reporting Bruno
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/main/java/org/biouno/unochoice/AbstractCascadableParameter.java
          src/main/java/org/biouno/unochoice/AbstractScriptableParameter.java
          http://jenkins-ci.org/commit/active-choices-plugin/cc764d6776b5ad0186f60a13b0f66c90326ecbd2
          Log:
          JENKINS-38532 When the user supplies parameters with equals separator, rebuild the remaining string

          Compare: https://github.com/jenkinsci/active-choices-plugin/compare/a3b413575912...cc764d6776b5

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/main/java/org/biouno/unochoice/AbstractCascadableParameter.java src/main/java/org/biouno/unochoice/AbstractScriptableParameter.java http://jenkins-ci.org/commit/active-choices-plugin/cc764d6776b5ad0186f60a13b0f66c90326ecbd2 Log: JENKINS-38532 When the user supplies parameters with equals separator, rebuild the remaining string Compare: https://github.com/jenkinsci/active-choices-plugin/compare/a3b413575912...cc764d6776b5
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Bruno P. Kinoshita
          Path:
          src/test/java/org/biouno/unochoice/issue38532/TestParameterValuesWithEquals.java
          src/test/java/org/biouno/unochoice/issue38532/package-info.java
          http://jenkins-ci.org/commit/active-choices-plugin/528443a89bd66c9d39258eaec0313eb0b6b29dc2
          Log:
          [FIXED JENKINS-38532] Add unit tests

          Compare: https://github.com/jenkinsci/active-choices-plugin/compare/cc764d6776b5...528443a89bd6

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Bruno P. Kinoshita Path: src/test/java/org/biouno/unochoice/issue38532/TestParameterValuesWithEquals.java src/test/java/org/biouno/unochoice/issue38532/package-info.java http://jenkins-ci.org/commit/active-choices-plugin/528443a89bd66c9d39258eaec0313eb0b6b29dc2 Log: [FIXED JENKINS-38532] Add unit tests Compare: https://github.com/jenkinsci/active-choices-plugin/compare/cc764d6776b5...528443a89bd6
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Released in 1.5.3

          Show
          kinow Bruno P. Kinoshita added a comment - Released in 1.5.3

            People

            Assignee:
            kinow Bruno P. Kinoshita
            Reporter:
            jmcubel Jose Maria Cubel
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: