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

Supporting Jobs triggered by plug-ins, API and scripts, timer

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      From https://github.com/biouno/uno-choice-plugin/issues/60

      Investigate the possibility of having Active Choices parameters being triggered/used from the Jenkins API or by other plug-ins, and document it (be it viable or not).

        Attachments

          Issue Links

            Activity

            Hide
            kishorerp kishorerp added a comment -

            Need this fix badly for our nightly builds trigger...

            Show
            kishorerp kishorerp added a comment - Need this fix badly for our nightly builds trigger...
            Hide
            kinow Bruno P. Kinoshita added a comment -

            Had an idea on how to implement it, would need some time to experiment with the Java classes and see if that's really doable, but at least I have now a picture on how to do it in my mind.

            Working on the plug-in for the next days, but unfortunately will spend this development cycle on bug fixes and try to help with the security bug in Scriptler, to whitelist the active-choices plugin (which depends on the former plugin).

            Show
            kinow Bruno P. Kinoshita added a comment - Had an idea on how to implement it, would need some time to experiment with the Java classes and see if that's really doable, but at least I have now a picture on how to do it in my mind. Working on the plug-in for the next days, but unfortunately will spend this development cycle on bug fixes and try to help with the security bug in Scriptler, to whitelist the active-choices plugin (which depends on the former plugin).
            Hide
            simontom Simon Tomek added a comment - - edited

            Hi there, it's been another year.

            Is there any update?

            Or is there any workaround for how to get these dynamic params calculated even by using Timer or BuildTrigger?

            Thanks

             

            UPDATE

            Well, I managed to solve the problem, at least for my UseCase.

            I just needed to have one master job which triggers children. Master has Choice Parameter with a list of values (e.g. 12.0, 12.xx, master). Children jobs uses specified branch from GIT. Problem is each repo uses another release branch name prefix. So, I looked for a way how to pass a version and add the specific branch name dynamically at child job.

            First, I tried by using Active Choices. It worked. But only if I used the GUI. Othervise, whenever I tried to start the child job from master job and passing the version I want, it failed, because it wasn't able to recalculate the Reactive Choice value.

            But then I came across Prepare an environment for the run. I use simple Groovy script which creates the value dynamically (adds some specific prefix to the name of GIT branch) and works like a charm..like I said before at least for my UseCase.

             

             

            Show
            simontom Simon Tomek added a comment - - edited Hi there, it's been another year. Is there any update? Or is there any workaround for how to get these dynamic params calculated even by using Timer or BuildTrigger? Thanks   UPDATE Well, I managed to solve the problem, at least for my UseCase. I just needed to have one master job which triggers children. Master has Choice Parameter with a list of values (e.g. 12.0, 12.xx, master). Children jobs uses specified branch from GIT. Problem is each repo uses another release branch name prefix. So, I looked for a way how to pass a version and add the specific branch name dynamically at child job. First, I tried by using Active Choices. It worked. But only if I used the GUI. Othervise, whenever I tried to start the child job from master job and passing the version I want, it failed, because it wasn't able to recalculate the Reactive Choice value. But then I came across Prepare an environment for the run . I use simple Groovy script which creates the value dynamically (adds some specific prefix to the name of GIT branch) and works like a charm..like I said before at least for my UseCase .    
            Hide
            tizkiko Tidhar Klein Orbach added a comment - - edited

            I encountered in the same issue. My workaround for this is to return the first element as a list of the default selected values. so in case your script returns:

            ['ONE:selected','TWO:selected','TREE:selected','FOUR:selected'] 

            instead, it would return:

            [ONE,TWO,TREE,FOUR, ONE:selected, TWO:selected, TREE:selected, FOUR:selected] 

            see https://stackoverflow.com/a/55219124/947784 for more details.

            Show
            tizkiko Tidhar Klein Orbach added a comment - - edited I encountered in the same issue. My workaround for this is to return the first element as a list of the default selected values. so in case your script returns: [ 'ONE:selected' , 'TWO:selected' , 'TREE:selected' , 'FOUR:selected' ] instead , it would return: [ONE,TWO,TREE,FOUR, ONE:selected, TWO:selected, TREE:selected, FOUR:selected] see https://stackoverflow.com/a/55219124/947784  for more details.
            Hide
            dumam Bartosz Nowak added a comment -

            I don't know if I'm good understand problem, but I found one task that i think is somehow related to this one.

            https://issues.jenkins-ci.org/browse/JENKINS-42723

            Please correct me if I'm wrong 

            Show
            dumam Bartosz Nowak added a comment - I don't know if I'm good understand problem, but I found one task that i think is somehow related to this one. https://issues.jenkins-ci.org/browse/JENKINS-42723 Please correct me if I'm wrong 

              People

              Assignee:
              kinow Bruno P. Kinoshita
              Reporter:
              kinow Bruno P. Kinoshita
              Votes:
              17 Vote for this issue
              Watchers:
              21 Start watching this issue

                Dates

                Created:
                Updated: