-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
41 lines (34 loc) · 1.59 KB
/
Jenkinsfile
File metadata and controls
41 lines (34 loc) · 1.59 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
pipeline {
agent any
environment {
LOGS_PATH = "./Code"
}
stages {
stage('Child pipelines') {
steps {
script {
// Define child pipeline for driverSwRequest if specific files are changed
buildJobIfFilesChanged('driverSwRequest', ['Design/DriverSwRequest/**/*', 'driverSwRequest.groovy', 'Jenkinsfile', 'tools/**/*'])
// Define child pipeline for cruiseControlMode if specific files are changed
buildJobIfFilesChanged('cruiseControlMode', ['Design/CruiseControlMode/**/*', 'cruiseControlMode.groovy', 'Jenkinsfile', 'tools/**/*'])
// Define child pipeline for targetSpeedThrottle if specific files are changed
buildJobIfFilesChanged('targetSpeedThrottle', ['Design/TargetSpeedThrottle/**/*', 'targetSpeedThrottle.groovy', 'Jenkinsfile', 'tools/**/*'])
// Define child pipeline for crs_controller if specific files are changed
buildJobIfFilesChanged('crs_controller', ['Design/crs_controller/**/*', 'crs_controller.groovy', 'Jenkinsfile', 'tools/**/*'])
}
}
}
}
}
def buildJobIfFilesChanged(jobName, filePatterns) {
def changed = filePatterns.any { isFilesChanged(it) }
if (changed) {
build job: jobName, parameters: [], wait: false
}
}
def isFilesChanged(String path) {
def changedFiles = checkout([$class: 'GitSCM']).poll().getRemoteChangeset()
return changedFiles.any { change ->
change.getPath().startsWith(path)
}
}