Skip to content

Commit 586b7f0

Browse files
committed
Add release status check
1 parent 561d4bc commit 586b7f0

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

Jenkinsfile

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,38 @@ pipeline {
5353
}
5454

5555

56+
stage ('check release status') {
57+
when {
58+
expression {
59+
def releaseStatus = sh(
60+
script: '''#!/bin/bash
61+
source bin/build-fcts.sh
62+
isReleaseable
63+
''',
64+
returnStatus: true
65+
)
66+
return releaseStatus == 0
67+
}
68+
}
69+
steps {
70+
sh(
71+
'''#!/bin/bash
72+
echo "Checking release note document..."
73+
source bin/build-fcts.sh
74+
local DATE=$(isReleaseMergeable)
75+
case $?
76+
0)
77+
echo "Ready to be merged"
78+
;;
79+
1)
80+
echo "Release not ready. Release date is currently empty. Missing 'date : YYYY/MM/DD' in the document."
81+
;;
82+
2)
83+
echo "Release prepared but not ready. The PR will be mergeable up to $DATE."
84+
'''
85+
)
86+
}
87+
}
5688
stage ('Push images to dockerhub'){
5789
environment{
5890
GITHUB_REPO="jenkins-ci"
@@ -72,4 +104,4 @@ pipeline {
72104
}
73105
}
74106
}
75-
}
107+
}

bin/build-fcts.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ function isReleaseMergeable() {
7676
fi
7777
let diff=(`date +%s`- `date +%s -d $releaseDate` )
7878

79+
echo "$releaseDate"
7980
if [[ $diff -gt 0 ]]
8081
then
8182
return

0 commit comments

Comments
 (0)