/
seedJob.groovy
33 lines (32 loc) · 1016 Bytes
/
seedJob.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
CREDENTIALS_ID = '<<CREDENTIALS ID>>'
[
[title: 'title1', repo: 'git@github.com:sergiomartins8/<<repo>>.git', jenkinsfile: 'Jenkinsfile'],
[title: 'title2', repo: 'git@github.com:sergiomartins8/<<repo>>.git', jenkinsfile: 'Jenkinsfile', pollScm: 'H/5 * * * *']
].each { job ->
pipelineJob(job.title) {
properties {
disableConcurrentBuilds()
}
cron = job.get('pollScm')
if (cron != null) {
triggers {
scm(cron)
}
}
definition {
cpsScm {
lightweight(true)
scm {
git {
branch(job.get('branch', '*/master'))
remote {
url(job.repo)
credentials(CREDENTIALS_ID)
}
scriptPath(job.get('jenkinsfile', 'Jenkinsfile'))
}
}
}
}
}
}