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

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

      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).

          [JENKINS-28735] Supporting Jobs triggered by plug-ins, API and scripts, timer

          Jukka Varjo added a comment - - edited

          Hello,

          The issue is still present in Active Choices 1.2. Please find the screenshots for clarification:

          Manual triggering:

          Automated triggering with timer:

          Best regards,
          Jukka

          Jukka Varjo added a comment - - edited Hello, The issue is still present in Active Choices 1.2. Please find the screenshots for clarification: Manual triggering: Automated triggering with timer: Best regards, Jukka

          Thanks Jukka. That's indeed the expected behaviour, and I am not sure how to fix it. Looks like this will be documented as a known issue, and the issue closed. Do you have any other suggestions?

          Bruno P. Kinoshita added a comment - Thanks Jukka. That's indeed the expected behaviour, and I am not sure how to fix it. Looks like this will be documented as a known issue, and the issue closed. Do you have any other suggestions?

          Received another e-mail on this issue. Looks like we could either enhance the current documentation, or try to create some workaround for this.

          I gave it some more thinking, and maybe using phantomJS, or something similar, we could have an experimental feature to render the parameters based on the value of other parameters... the idea is a bit blurry in my mind, but with some more thinking and time, I think that could be doable.

          Bruno P. Kinoshita added a comment - Received another e-mail on this issue. Looks like we could either enhance the current documentation, or try to create some workaround for this. I gave it some more thinking, and maybe using phantomJS, or something similar, we could have an experimental feature to render the parameters based on the value of other parameters... the idea is a bit blurry in my mind, but with some more thinking and time, I think that could be doable.

          Is for that issue an update available? Did someone try it. We would like to have that feature.

          Sven Finsterwalder added a comment - Is for that issue an update available? Did someone try it. We would like to have that feature.

          Roberto Sena added a comment -

          I just found this plugin and it would make things a lot easier to kick off our builds. But we have nightly scheduled builds as well. I didn't notice that this plugin doesn't work with triggered builds. Has there been any luck being able to implement this feature?

          Roberto Sena added a comment - I just found this plugin and it would make things a lot easier to kick off our builds. But we have nightly scheduled builds as well. I didn't notice that this plugin doesn't work with triggered builds. Has there been any luck being able to implement this feature?

          kishorerp added a comment -

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

          kishorerp added a comment - Need this fix badly for our nightly builds trigger...

          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).

          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).

          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.

           

           

          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 .    

          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.

          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.

          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 

          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 

            kinow Bruno P. Kinoshita
            kinow Bruno P. Kinoshita
            Votes:
            21 Vote for this issue
            Watchers:
            25 Start watching this issue

              Created:
              Updated: