-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpipelinejob.groovy
46 lines (42 loc) · 1.23 KB
/
pipelinejob.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import groovy.text.SimpleTemplateEngine
def fileContents = readFileFromWorkspace "Jenkinsfile.${project_type.toLowerCase().trim()}"
def engine = new SimpleTemplateEngine()
template = engine.createTemplate(fileContents).make(binding.getVariables()).toString()
folder(job_name) {
displayName(job_name)
description("${job_name}\nlabels:${project_type.toLowerCase().trim()}")
}
pipelineJob("${job_name}/Release") {
properties {
githubProjectUrl(github_project_url)
parameters {
pipelineTriggers {
triggers {
GenericTrigger {
genericVariables {
genericVariable {
key('reference')
value('$.ref')
expressionType('JSONPath')
}
genericVariable {
key('repository_full_name')
value('$.repository.full_name')
expressionType('JSONPath')
}
}
regexpFilterText('$repository_full_name/$reference')
regexpFilterExpression(repository_branch_filter_regex)
tokenCredentialId('generic_webhook_token')
}
}
}
}
}
definition {
cps {
script(template)
sandbox()
}
}
}