JCASC: Jenkins Configuration as Code for Declarative Pipeline: Remote Trigger

Jenkins setup:

Jenkins: 2.414.1
OS: Linux - 6.5.0-1025-azure
Java: 11.0.20 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
Parameterized-Remote-Trigger:3.2.0
PrioritySorter:5.1.0
ansicolor:1.0.4
ant:497.v94e7d9fffa_b_9
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
azure-ad:457.vf85d61f83b_26
azure-sdk:174.va_89c1df897d2
bootstrap5-api:5.3.2-3
bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_
branch-api:2.1128.v717130d4f816
build-timeout:1.32
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.0.2
cloudbees-folder:6.858.v898218f3609d
commons-lang3-api:3.17.0-84.vb_b_938040b_078
commons-text-api:1.11.0-108.v2c41b_8b_2b_269
configuration-as-code:1775.v810dc950b_514
credentials:1319.v7eb_51b_3a_c97b_
credentials-binding:642.v737c34dea_6c2
display-url-api:2.204.vf6fddd8a_8b_e9
durable-task:568.v8fb_5c57e8417
echarts-api:5.4.0-7
envinject:2.919.v009a_a_1067cd0
envinject-api:1.199.v3ce31253ed13
font-awesome-api:6.5.1-2
git:5.2.1
git-client:4.6.0
github:1.37.3.1
github-api:1.321-468.v6a_9f5f2d5a_7e
github-branch-source:1771.v59b_6a_fa_1b_89e
github-oauth:597.ve0c3480fcb_d0
gradle:2.13.1
gson-api:2.10.1-15.v0d99f670e0a_7
instance-identity:201.vd2a_b_5a_468a_a_6
ionicons-api:74.v93d5eb_813d5f
jackson2-api:2.17.0-379.v02de8ec9f64c
jakarta-activation-api:2.1.3-1
jakarta-mail-api:2.1.3-1
javax-activation-api:1.2.0-7
javax-mail-api:1.6.2-9
jaxb:2.3.9-1
jdk-tool:66.vd8fa_64ee91b_d
jjwt-api:0.11.5-112.ve82dfb_224b_a_d
job-dsl:1.87
jquery3-api:3.7.1-1
json-api:20240205-27.va_007549e895c
json-path-api:2.9.0-33.v2527142f2e1d
junit:1265.v65b_14fa_f12f0
mailer:470.vc91f60c5d8e2
matrix-auth:3.2.2
matrix-project:822.824.v14451b_c0fd42
mina-sshd-api-common:2.12.1-101.v85b_e08b_780dd
mina-sshd-api-core:2.12.1-101.v85b_e08b_780dd
okhttp-api:4.11.0-172.vda_da_1feeb_c6e
pam-auth:1.11
permissive-script-security:0.7
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-github-lib:61.v629f2cc41d83
pipeline-graph-analysis:216.vfd8b_ece330ca_
pipeline-groovy-lib:689.veec561a_dee13
pipeline-input-step:477.v339683a_8d55e
pipeline-milestone-step:119.vdfdc43fc3b_9a_
pipeline-model-api:2.2150.v4cfd8916915c
pipeline-model-definition:2.2150.v4cfd8916915c
pipeline-model-extensions:2.2150.v4cfd8916915c
pipeline-rest-api:2.34
pipeline-stage-step:312.v8cd10304c27a_
pipeline-stage-tags-metadata:2.2150.v4cfd8916915c
pipeline-stage-view:2.34
pipeline-utility-steps:2.16.0
plain-credentials:182.v468b_97b_9dcb_8
plugin-util-api:3.8.0
prism-api:1.29.0-8
resource-disposer:0.24
scm-api:676.v886669a_199a_a_
script-security:1362.v67dc1f0e1b_b_3
snakeyaml-api:2.3-123.v13484c65210a_
ssh-credentials:337.v395d2403ccd4
ssh-slaves:2.948.vb_8050d697fec
sshd:3.303.vefc7119b_ec23
structs:325.vcb_307d2a_2782
timestamper:1.27
token-macro:400.v35420b_922dcb_
trilead-api:2.142.v748523a_76693
variant:60.v7290fc0eb_b_cd
workflow-aggregator:600.vb_57cdd26fdd7
workflow-api:1291.v51fd2a_625da_7
workflow-basic-steps:1058.vcb_fc1e3a_21a_9
workflow-cps:3837.v305192405b_c0
workflow-durable-task-step:1331.vc8c2fed35334
workflow-job:1385.vb_58b_86ea_fff1
workflow-multibranch:770.v1a_d0708dd1f6
workflow-scm-step:427.v4ca_6512e7df1
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:920.v59f71ce16f04
ws-cleanup:0.46

0

I have a jenkins controller defined purely in JSCASC, with pipelines defined using declarative script. I would like to use the startup-trigger-plugin plugin to trigger pipeline jobs remotely via webhook.

The problem appears to have two parts:

  1. Trigger configuration, in CASC, for each pipeline being triggered remotely.
  2. Web authentication token configuration, which should also be configured in JSCASC.

My questions:

a) Is this possible at all using purely JSCASC? b) Where can I find example working configuration for this scenario?

Sample of my jcasc pipeline jobs section definition:

#Job Definitions using job-dsl plugin
jobs:
  - script: folder('Applications')
  - script: folder('Infrastructure')
  - script: folder('Infrastructure/Production')
  - script: folder('Infrastructure/NonProduction')
  - script: folder('Infrastructure/Production/Bootstrap')
  - script: folder('Infrastructure/NonProduction/Bootstrap')
  - script: folder('Applications/Production')
  - script: folder('Applications/NonProduction')
  - script: folder('Applications/Orchestration')
  - file: /usr/local/enterprise-caf-lz003-app001-nprd.groovy
  - file: /usr/local/enterprise-caf-lz003-app001-prod.groovy
  

I’ve added this question on stackoverflow, hopefully for better coverage: