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

Support multi-line parameters in parameterized remote trigger plugin

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Minor Minor
    • None
    • Jenkins: 2.332.3
      OS: Linux - 5.4.188-104.359.amzn2.x86_64
      ---
      Parameterized-Remote-Trigger:3.1.5.1

      Currently, the parameters are passed as a big multi-line string that is parsed by the plugin line-by-line.

      This has a consequence: passing multi-line parameters for the remote Jenkins instance does not work, only the first line ends up in the parameter

      I fiddled with the code and opened a pull request with a suggestion for a fix.

       

      You can find a more detailed description of the problem there too.

      Note: While fixing the parsing, I also happened to stumble on another bug linked to it that I fixed in my PR too.

          [JENKINS-68737] Support multi-line parameters in parameterized remote trigger plugin

          KaiHsiang Chang added a comment - - edited

          I basically trusted the test result, and I saw the modification for backward compatible at least. (With limited resources.)

          And furthermore, it's a enhancement which I like to see, although there's some dummy code change like the import orders and some code style changes which are never defined by some config. files, it still a good improvement to sustain this plugin. 

          You definitely had your use case & test  scenario already, let's move it on. 

          Look forward to your contribution. 

           

          Will close the bug you mentioned. 

          KaiHsiang Chang added a comment - - edited I basically trusted the test result, and I saw the modification for backward compatible at least. (With limited resources.) And furthermore, it's a enhancement which I like to see, although there's some dummy code change like the import orders and some code style changes which are never defined by some config. files, it still a good improvement to sustain this plugin.  You definitely had your use case & test  scenario already, let's move it on.  Look forward to your contribution.    Will close the bug you mentioned. 

          As feared, I did screw up the migration
          It only works with file parameters currently since I'm checking for null where I should check for null or empty.
          Will open a fix PR ASAP.

          Cyprien Quilici added a comment - As feared, I did screw up the migration It only works with file parameters currently since I'm checking for null where I should check for null or empty. Will open a fix PR ASAP.

          Cyprien Quilici added a comment - - edited

          https://github.com/jenkinsci/parameterized-remote-trigger-plugin/pull/80 PR for the migration fix.
          I've just tested that the string parameters are migrated correctly.

          Both migrations work now.

           

          But I've discovered the transition isn't smooth at all in pipeline ATM.
          I'm working on a fix so that the migration is transparent in pipelines too.

          Cyprien Quilici added a comment - - edited https://github.com/jenkinsci/parameterized-remote-trigger-plugin/pull/80 PR for the migration fix. I've just tested that the string parameters are migrated correctly. Both migrations work now.   But I've discovered the transition isn't smooth at all in pipeline ATM. I'm working on a fix so that the migration is transparent in pipelines too.

          Cyprien Quilici added a comment - - edited

          The fix is done, everything is in the PR from previous comment and I'm testing it.

          UI

          1. migration with string parameters is OK
          2.  migration with file parameters is OK 

          Pipeline

          1. running with string parameters is OK
          2. running with map parameters is OK
          3. running with file parameters is OK

           

          Cyprien Quilici added a comment - - edited The fix is done, everything is in the PR from previous comment and I'm testing it. UI migration with string parameters is OK  migration with file parameters is OK  Pipeline running with string parameters is OK running with map parameters is OK running with file parameters is OK  

          Accepted in 3.1.6.1. 

          KaiHsiang Chang added a comment - Accepted in 3.1.6.1. 

          Noice.
          It looks like the plugin was released on the GitHub repository but not on the Jenkins registry.
          How does the release process work?

          Just so I know when I can use the new version on a legit Jenkins instance

          Cyprien Quilici added a comment - Noice. It looks like the plugin was released on the GitHub repository but not on the Jenkins registry. How does the release process work? Just so I know when I can use the new version on a legit Jenkins instance

          KaiHsiang Chang added a comment - - edited

          Should be already released as 3.1.6.1. 

          I can see the binary archieve here, https://plugins.jenkins.io/Parameterized-Remote-Trigger/ 

          Not sure if the replication is not done yet in your location ( ? ).

           

          KaiHsiang Chang added a comment - - edited Should be already released as 3.1.6.1.  I can see the binary archieve here, https://plugins.jenkins.io/Parameterized-Remote-Trigger/   Not sure if the replication is not done yet in your location ( ? ).  

          KaiHsiang Chang added a comment - - edited

          KaiHsiang Chang added a comment - - edited Or you can try this url. https://updates.jenkins.io/download/plugins/Parameterized-Remote-Trigger/3.1.6.1/Parameterized-Remote-Trigger.hpi

          Either the replication wasn't done or their was some cache on my browser, I can see it now, thank!

          Cyprien Quilici added a comment - Either the replication wasn't done or their was some cache on my browser, I can see it now, thank!

          Priyanka added a comment - - edited

          Can anyone please provide an example of passing multiline strings using this parameters? I need to pass in multiline string as this:

          triggerRemoteJob ( job: "job_name", 
                             parameters: [
                                text(name: 'Custom values', value: """\
                                     presets:
                                       - test-presubmit
                                     global:
                                       myImage:
                                         imageTag: test_${BUILD_ID}
                                     """,
                                  ),
                              ]
                          )

           

          But this gives me an error: 

          org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep.setParameters() expects class java.lang.String but received class java.util.ArrayList

          Priyanka added a comment - - edited Can anyone please provide an example of passing multiline strings using this parameters? I need to pass in multiline string as this: triggerRemoteJob ( job: "job_name",                     parameters: [                       text(name: 'Custom values', value: """\                            presets:                              - test-presubmit                            global:                              myImage:                                imageTag: test_${BUILD_ID}                            """,                         ),                     ]                 )   But this gives me an error:  org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep.setParameters() expects class java.lang.String but received class java.util.ArrayList

            cashlalala KaiHsiang Chang
            quilicicf Cyprien Quilici
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: