-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
47 lines (38 loc) · 1.7 KB
/
Copy pathJenkinsfile
File metadata and controls
47 lines (38 loc) · 1.7 KB
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
boolean isTriggeredByTimer = "${currentBuild.getBuildCauses('hudson.triggers.TimerTrigger$TimerTriggerCause')}" != '[]'
boolean isTriggeredByUser = "${currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')}" != '[]'
String cronString = BRANCH_NAME == 'main' ? 'H 22 * * *' : ''
echo "isTriggeredByTimer = ${isTriggeredByTimer}"
echo "isTriggeredByUser = ${isTriggeredByUser}"
node {
properties([
pipelineTriggers([cron(cronString)]),
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '14', numToKeepStr: ''))
])
stage('Build All Jobs') {
if (isTriggeredByTimer || isTriggeredByUser) {
def hierarchy = [
['Build-LicenseFeature', 'ThirdParty-Library'],
['Library-EMFEditUtils', 'EclipseAddon-CDODebugUtils', 'Library-StandaloneInitialization'],
['Ecore-Workflow', 'Library-JUnit5Utils'],
['Build-UpdateSite']
]
hierarchy.each { repoNames ->
def buildJobs = [:]
repoNames.each { repoName ->
def jobPrefix = "MDSD-Tools/${repoName}/"
['main', 'master'].each {
def jobName = "$jobPrefix${it}"
if (Jenkins.instance.getItemByFullName(jobName)) {
buildJobs["${repoName}"] = {
build job: jobName, propagate: false
}
}
}
}
parallel buildJobs
}
} else {
echo "Build not triggered by user or timer. Doing nothing."
}
}
}