--- /dev/null
+JOB = "ceph-dev-pipeline"
+VALID_PARAMETERS = [
+ "ARCHS",
+ "CI_COMPILE",
+ "CI_CONTAINER",
+ "CI_PIPELINE",
+ "DISTROS",
+ "DWZ",
+ "FLAVOR",
+ "SCCACHE",
+]
+def params = []
+
+pipeline {
+ agent any
+ stages {
+ stage("Prepare parameters") {
+ steps {
+ script {
+ def trailer = sh(
+ script: "echo \"$head_commit\" | git interpret-trailers --parse",
+ returnStdout: true,
+ )
+ println("trailer: ${trailer}")
+ def paramsMap = [:]
+ for (item in trailer.split("\n")) {
+ def matcher = item =~ /(.+): (.+)/
+ if (matcher.matches()) {
+ key = matcher[0][1].replace("-", "_").toUpperCase()
+ value = matcher[0][2]
+ paramsMap[key] = value
+ }
+ }
+ def branch = env.ref.replace("refs/heads/", "")
+ params.push(string(name: "BRANCH", value: branch))
+ println("Looking for parameters: ${VALID_PARAMETERS}")
+ for (key in VALID_PARAMETERS) {
+ value = paramsMap[key]
+ if ( value ) {
+ params.push(string(name: key, value: value))
+ println("${key}=${value}")
+ }
+ }
+ }
+ }
+ }
+ stage("Trigger job") {
+ steps {
+ script {
+ build(
+ job: JOB,
+ parameters: params
+ )
+ }
+ }
+ }
+ }
+}
--- /dev/null
+- job:
+ name: ceph-dev-pipeline-trigger
+ project-type: pipeline
+ quiet-period: 1
+ concurrent: true
+ pipeline-scm:
+ scm:
+ - git:
+ url: https://github.com/ceph/ceph-build
+ branches:
+ - jenkinsfile
+ shallow-clone: true
+ submodule:
+ disable: true
+ wipe-workspace: true
+ script-path: ceph-dev-pipeline-trigger/build/Jenkinsfile
+ lightweight-checkout: true
+ do-not-fetch-tags: true
+
+ triggers:
+ - generic-webhook-trigger:
+ token: ceph-dev-pipeline-trigger
+ token-credential-id: pipeline-trigger-token
+ print-contrib-var: true
+ header-params:
+ - key: X_GitHub_Event
+ value: ""
+ post-content-params:
+ - type: JSONPath
+ key: head_commit
+ value: $.head_commit.message
+ - type: JSONPath
+ key: ref
+ value: $.ref
+ - type: JSONPath
+ key: pusher
+ value: $.pusher.name
+ regex-filter-text: $head_commit
+ regex-filter-expression: "(?i)CI-PIPELINE: true"
+ cause: "Push to $ref by $pusher"