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

trigger properties in scripted pipeline require 2 builds to get registered

    Details

    • Similar Issues:

      Description

      When defining trigger in a declarative pipeline, it will suffice to write

      pipeline {
       agent any
      
       triggers {
         cron('H H(0-7) * * *')
       }
      }

      and build once. 

      After the first build accessing the job config UI will show the trigger configuration.

      However if you do the same thing with a scripted pipeline

       

      node {
          properties([pipelineTriggers([cron('H H(0-7) * * *')])])
      }
      

       

      you need two builds to register the trigger (it won't appear in the UI and won't be working until the second manual build).

       

        Attachments

          Activity

          Hide
          abayer Andrew Bayer added a comment -

          What versions of core, workflow-job, and workflow-multibranch are you using when you see this?

          Show
          abayer Andrew Bayer added a comment - What versions of core, workflow-job , and workflow-multibranch are you using when you see this?
          Hide
          varmenise valentina armenise added a comment -

          Andrew Bayer sorry for the late.

          core 2.89

          workflow-job 2.17

          workflow-multibranch NA (not installed in my tests)

          Show
          varmenise valentina armenise added a comment - Andrew Bayer sorry for the late. core 2.89 workflow-job 2.17 workflow-multibranch NA (not installed in my tests)
          Hide
          mikecirioli mike cirioli added a comment -

          FWIW - I just had to do a test for a blog post i am writing and when using pipeline-event-triggers, you only need to run a build once (declarative or scripted) using 2.107 core.

          Show
          mikecirioli mike cirioli added a comment - FWIW - I just had to do a test for a blog post i am writing and when using pipeline-event-triggers, you only need to run a build once (declarative or scripted) using 2.107 core.
          Hide
          mikecirioli mike cirioli added a comment -

          quick update - i have re-verified that you no longer need to run a scripted job with triggers twice in order to have them registered. Closing this issue.

          Show
          mikecirioli mike cirioli added a comment - quick update - i have re-verified that you no longer need to run a scripted job with triggers twice in order to have them registered. Closing this issue.
          Hide
          liamrae Liam Rae-McLauchlan added a comment -

          We are also encountering this issue

           node ('centos-small') {
                  properties([
                      pipelineTriggers([cron('H/5 * * * *')]),
                  ])
          

           The trigger is not visible in the UI until the job is manually triggered twice. It is visible in the config.xml from the first run.
          The cron trigger is not executed until we manually trigger the job twice ( corresponds to when it is visible in the UI)

          Jenkins ver. 2.121.3
          Pipeline ver. 2.5

          Show
          liamrae Liam Rae-McLauchlan added a comment - We are also encountering this issue  node ('centos-small') { properties([ pipelineTriggers([cron('H/5 * * * *')]), ])  The trigger is not visible in the UI until the job is manually triggered twice. It is visible in the config.xml from the first run. The cron trigger is not executed until we manually trigger the job twice ( corresponds to when it is visible in the UI) Jenkins ver. 2.121.3 Pipeline ver. 2.5
          Hide
          spugachev Stanislav Pugachov added a comment -

          Is there a way to programmatically make it visible in UI? In groovy I mean

          Show
          spugachev Stanislav Pugachov added a comment - Is there a way to programmatically make it visible in UI? In groovy I mean

            People

            • Assignee:
              Unassigned
              Reporter:
              varmenise valentina armenise
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated: