Skip to main content

Groovy syntax to retrieve a multibranch pipeline's build trigger property



  • Denys Digtiar

    All the Pipeline projects inside Organization Folder / Multi-branch Pipelines are automatically generated and should not be modified manually.

    The way to set properties and triggers of such Pipelines is from the Pipelines themselves, using the `properties` step in scripted or declarative directives.

  • Brandon Bhagwandeen

    Thanks @Denys. My aim is to create a cron job to check mutli-branch pipelines and enforce a standard minimum "build periodically" trigger so that some jobs do not build too many times.

    I'm able to grab the schedule for jobs like this:

    List keys = new ArrayList(job.getTriggers().keySet());

    for (int i = 0; i < keys.size(); i++) {
       Object obj = keys.get(i);
       if(obj.getDisplayName().contains("Build periodically")) {
          println job.fullName + "," + job.getTriggers().get(keys.get(i)).spec

  • Allan Burdajewicz

    Hello Brandon,

    You can use a script like the following to check the cron trigger of all multibranch jobs in your instance:

    import jenkins.model.Jenkins

    .each { org ->

    println "${org.fullDisplayName}"
    hudson.triggers.Trigger periodicFolderTrigger = org.getTriggers().find { triggerEntry ->
    triggerEntry.key instanceof com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger.DescriptorImpl

    if(periodicFolderTrigger != null) {
    println " PeriodicFolderTrigger { interval: ${periodicFolderTrigger.getInterval()}, spec: ${periodicFolderTrigger.getSpec()} }"
    } else {
    println " No PeriodicFolderTrigger"



Please sign in to leave a comment.

About CloudBees Support

Our Support Engineers are available to help with any questions or problems you may have with any of our products.