Skip to content

configuration-as-code multibranchPipeline yaml example shows incorrect periodic() trigger syntax #2731

@KeremAR

Description

@KeremAR

Jenkins and plugins versions report

Environment
Jenkins: 2.528.1
OS: Linux - 5.15.0-1088-kvm
---
antisamy-markup-formatter:173.v680e3a_b_69ff3
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83
asm-api:9.9-185.va_6c6b_3348b_c3
authentication-tokens:1.144.v5ff4a_5ec5c33
basic-branch-build-strategies:275.vde2351b_4a_58b_
bootstrap5-api:5.3.8-895.v4d0d8e47fea_d
bouncycastle-api:2.30.1.82-277.v70ca_0b_877184
branch-api:2.1255.v2f5fe203584a_
caffeine-api:3.2.2-178.v353b_8428ed56
cloudbees-folder:6.1062.v2877b_d6b_b_eeb_
commons-lang3-api:3.19.0-104.v12125f33a_255
commons-text-api:1.14.0-194.v804a_dc3a_1b_d8
configuration-as-code:2006.v001a_2ca_6b_574
credentials:1447.v4cb_b_539b_5321
credentials-binding:702.vfe613e537e88
display-url-api:2.217.va_6b_de84cc74b_
docker-commons:457.v0f62a_94f11a_3
docker-workflow:634.vedc7242b_eda_7
durable-task:605.v9a_b_9040c9970
font-awesome-api:7.1.0-882.v1dfb_771e3278
git:5.8.0
git-client:6.4.0
github:1.45.0
github-api:1.330-492.v3941a_032db_2a_
github-branch-source:1906.v21c5c13d25c6
gson-api:2.13.2-173.va_a_092315913c
instance-identity:203.v15e81a_1b_7a_38
ionicons-api:94.vcc3065403257
jackson2-api:2.20.0-420.v8a_08b_d57ca_05
jakarta-activation-api:2.1.3-2
jakarta-mail-api:2.1.3-3
jakarta-xml-bind-api:4.0.5-3.v3d5b_a_73965b_9
javax-activation-api:1.2.0-8
jaxb:2.3.9-133.vb_ec76a_73f706
jjwt-api:0.11.5-120.v0268cf544b_89
job-dsl:1.93
joda-time-api:2.14.0-149.v1c3ce991d1b_9
json-api:20250517-173.v596efb_962a_31
json-path-api:2.9.0-190.veefca_05d5477
kubernetes:4384.v1b_6367f393d9
kubernetes-cli:1.364.vadef8cb8b823
kubernetes-client-api:7.3.1-256.v788a_0b_787114
kubernetes-credentials:206.vde31a_b_0f71a_c
locale:597.v7781ce70d4cf
mailer:522.va_995fa_cfb_8b_d
metrics:4.2.37-489.vb_6db_69b_ce753
mina-sshd-api-common:2.16.0-167.va_269f38cc024
mina-sshd-api-core:2.16.0-167.va_269f38cc024
okhttp-api:4.12.0-195.vc02552c04ffd
pipeline-build-step:571.v08a_fffd4b_0ce
pipeline-graph-analysis:245.v88f03631a_b_21
pipeline-groovy-lib:776.vfee5327b_b_a_5b_
pipeline-input-step:534.v352f0a_e98918
pipeline-milestone-step:138.v78ca_76831a_43
pipeline-model-api:2.2273.v643f36ed9e94
pipeline-model-definition:2.2273.v643f36ed9e94
pipeline-model-extensions:2.2273.v643f36ed9e94
pipeline-rest-api:2.38
pipeline-stage-step:322.vecffa_99f371c
pipeline-stage-tags-metadata:2.2273.v643f36ed9e94
pipeline-stage-view:2.38
plain-credentials:199.v9f8e1f741799
plugin-util-api:6.1192.v30fe6e2837ff
prism-api:1.30.0-630.va_e19d17f83b_0
scm-api:712.v8846fdd68c88
script-security:1378.vf25626395f49
snakeyaml-api:2.3-125.v4d77857a_b_402
sonar:2.18
ssh-credentials:361.vb_f6760818e8c
structs:353.v261ea_40a_80fb_
token-macro:477.vd4f0dc3cb_cf1
variant:70.va_d9f17f859e0
workflow-aggregator:608.v67378e9d3db_1
workflow-api:1384.vdc05a_48f535f
workflow-basic-steps:1098.v808b_fd7f8cf4
workflow-cps:4209.v83c4e257f1e9
workflow-durable-task-step:1464.v2d3f5c68f84c
workflow-job:1559.va_a_533730b_ea_d
workflow-multibranch:821.vc3b_4ea_780798
workflow-scm-step:452.vdf1ca_c8d3a_87
workflow-step-api:710.v3e456cc85233
workflow-support:1004.veee3a_d67cdb_9

What Operating System are you using (both controller, and any agents involved in the problem)?

Controller: Kubernetes (K3s v1.26.10+k3s2) on Ubuntu
Agents: Kubernetes dynamic agents (same cluster)

Reproduction steps

1- Install Jenkins with Configuration as Code (JCasC)

2- Configure JCasC with Job DSL script (in values.yaml):
controller:
JCasC:
configScripts:
jenkins-config: |
jobs:
- script: >
multibranchPipelineJob('app-ci') {
displayName('CI/CD Pipeline')
description('description')

            branchSources {
              github {
                id('app-12345')
                scanCredentialsId('github-registry')
                repoOwner('owner')
                repository('repo')
              }
            }
            
            orphanedItemStrategy {
              discardOldItems {
                numToKeep(10)
              }
            }
            
            triggers {
              periodic(1)  # ❌ This syntax from documentation
            }
          }

3- Start Jenkins - Pod will crash with error
4- Check logs: kubectl logs -n jenkins jenkins-0 -c jenkins --tail=50

Expected Results

According to multibranch example, periodic(1) should work for setting up periodic scanning of multibranch pipeline every 1 minute.

Actual Results

Jenkins fails to start with the following error:

javaposse.jobdsl.dsl.DslScriptException: (script, line 21)
No signature of method: javaposse.jobdsl.dsl.helpers.triggers.MultibranchWorkflowTriggerContext.periodic()
is applicable for argument types: (java.lang.Integer) values: [1]

Caused: io.jenkins.plugins.casc.ConfiguratorException: jobs: Failed to execute script with hash 1852956090

Root cause: The MultibranchWorkflowTriggerContext class does not have a periodic() method.

Anything else?

Replace periodic(1) with:

triggers {
periodicFolderTrigger {
interval('1')
}
}

it works for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions