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

The selected option from Active Choice Parameter groovy script is not used when building a job periodically (using cron)

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • active-choices-plugin
    • None

      Steps to reproduce:

      Given: I install the Active Choice Parameter plugin
      When: I configure a job to have an Active Choice Parameter having a Groovy script
      And: I set an option as selected in the Groovy script, but not the first option
      And: I configure the job to build periodically (using cron)
      Then: The job should start with the selected option as for the parameter value

      Instead: The job starts with the first option from the groovy script and not with the selected one.

      eg.

      Having one Active Choice parameter, named "options" defined by the following Groovy script:

      return[
      'option1',
      'option2:selected',
      'option3'
      ]
      

      Then, if you build the project by using a system groovy script like this:

      import hudson.model.*
       
      // get ACP 'options'
      def resolver = build.buildVariableResolver
      def optionsACPValue = resolver.resolve("options").toString()
      
      // print 'options' ACP value
      
      println ("ACP value: '$\{optionsACPValue}'.")
      

      Output

      If you build manually you will get:

      *option2*
      

      and if you build periodically (using cron), the output will be:

      *option1*
      

            kinow Bruno P. Kinoshita
            alin_brados Alin Brados
            Votes:
            8 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: