Skip to content

Commit

Permalink
Add check project in validate change
Browse files Browse the repository at this point in the history
  • Loading branch information
iphayao committed Sep 22, 2020
1 parent 1cc9ff3 commit ffc8ed9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cicd-common/Jenkinsfile
@@ -1,11 +1,17 @@
String validateFileChange() {
String validateFileChange(projectName) {
def res = false
for(changeSet in currentBuild.changeSets) {
for(entry in changeSet.getItems()) {
for(file in entry.getAffectedFiles()) {
print file.getPath()
if(file.getPath().startWith(projectName)) {
print 'Change occured in project ${projectName}'
res = true
}
}
}
}

return res
}

pipeline {
Expand All @@ -14,7 +20,8 @@ pipeline {
stages {
stage('Validate File Change') {
steps {
validateFileChange()
echo validateFileChange('test-monorepo-foo')
echo validateFileChange('test-monorepo-bar')
}
}
}
Expand Down

0 comments on commit ffc8ed9

Please sign in to comment.