File tree Expand file tree Collapse file tree
jenkins-jobs/scripted-when-changelog Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ node{
2+ checkout([$class: 'GitSCM',
3+ branches: [[name: "origin/master"]],
4+ userRemoteConfigs: [[
5+ url: 'https://github.com/pipelineascodecourse/scripted-when-changelog.git']]
6+ ])
7+
8+ def changeLogFound = false
9+ def changeLogSets = currentBuild.changeSets
10+ println "changeLogSets.size(): ${changeLogSets.size()}"
11+ for (int i = 0; i < changeLogSets.size(); i++) {
12+
13+ println changeLogSets[i].getClass().getName()
14+ def entries = changeLogSets[i].items
15+
16+ for (int j = 0; j < entries.length; j++) {
17+ def entry = entries[j]
18+ println "${entry.msg}"
19+ if(entry.msg =~ /.*some_text.*/){
20+ changeLogFound = true
21+ break;
22+ }
23+ }
24+
25+ if(changeLogFound)
26+ break
27+ }
28+
29+ changeLogSets = null
30+
31+ if(changeLogFound){
32+ stage('ChangeLogFound'){
33+ echo 'Change log found'
34+ }
35+ }
36+ else{
37+ stage('ChangeLogNotFound'){
38+ echo 'Change log not found'
39+ }
40+ }
41+ }
42+
You can’t perform that action at this time.
0 commit comments