-
Notifications
You must be signed in to change notification settings - Fork 10
/
seed-github-ci.Jenkinsfile
86 lines (84 loc) · 3.49 KB
/
seed-github-ci.Jenkinsfile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* this job defines all the multibranch jobs for upstream CI repos */
repos = [
"coreos/afterburn",
"coreos/bootupd",
"coreos/console-login-helper-messages",
"coreos/coreos-assembler",
"coreos/coreos-installer",
"coreos/coreos-ci",
"coreos/coreos-ci-lib",
"coreos/fedora-coreos-releng-automation",
"coreos/fedora-coreos-cincinnati",
"coreos/fedora-coreos-config",
"coreos/fedora-coreos-pipeline",
"coreos/ignition",
"coreos/rpm-ostree",
"coreos/ssh-key-dir",
"coreos/zincati",
"ostreedev/ostree"
]
node { repos.each { repo ->
def (owner, name) = repo.split('/')
jobDsl scriptText: """
multibranchPipelineJob('${name}') {
branchSources {
github {
// id must be constant so that job updates work correctly
id("fac233be-96f9-4331-851b-6153fdc9af9b")
repoOwner('${owner}')
repository('${name}')
checkoutCredentialsId("github-coreosbot-token")
scanCredentialsId("github-coreosbot-token")
}
}
factory {
workflowBranchProjectFactory {
scriptPath('.cci.jenkinsfile')
}
}
orphanedItemStrategy {
discardOldItems()
}
triggers {
// manually rescan once a day; this is important so that it
// picks up on deleted branches/PRs which can be cleaned up
periodic(60 * 24)
}
// things which don't seem to have a nice DSL :(
configure {
it / sources / data / 'jenkins.branch.BranchSource' / strategy {
properties(class: 'java.util.Arrays\$ArrayList') {
a(class: 'jenkins.branch.BranchProperty-array') {
'org.jenkinsci.plugins.workflow.multibranch.DurabilityHintBranchProperty' {
// we don't care about durability for these CI
// jobs. we should be able to interrupt and
// restart from scratch whenever
hint('PERFORMANCE_OPTIMIZED')
}
}
}
}
it / sources / data / 'jenkins.branch.BranchSource' / source << {
traits {
'org.jenkinsci.plugins.github__branch__source.BranchDiscoveryTrait' {
strategyId(1)
}
'org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait' {
strategyId(1)
}
'org.jenkinsci.plugins.github__branch__source.ForkPullRequestDiscoveryTrait' {
strategyId(1)
// allow testing of PRs from project contributors
trust(class: 'org.jenkinsci.plugins.github_branch_source.ForkPullRequestDiscoveryTrait\$TrustContributors')
}
}
}
it / sources / data / 'jenkins.branch.BranchSource' / buildStrategies {
'jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl' {
ignoreTargetOnlyChanges(true)
}
}
}
}
"""
}}