Skip to content

Commit e40dc8b

Browse files
author
pipelineascodecourse
committed
initial commit
1 parent c07c4fe commit e40dc8b

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+

0 commit comments

Comments
 (0)