@@ -25,42 +25,55 @@ class ReleasePromotion {
25
25
}
26
26
27
27
async promote ( ) {
28
- const { version, prid, cli } = this ;
29
-
30
28
// In the promotion stage, we can pull most relevant data
31
29
// from the release commit created in the preparation stage.
32
30
await this . parseDataFromReleaseCommit ( ) ;
33
31
32
+ const { prid, cli, version } = this ;
33
+
34
34
// Verify that PR is ready to promote.
35
- cli . startSpinner ( 'Verifying PR promotion readiness' ) ;
36
35
const {
37
36
jenkinsReady,
38
37
githubCIReady,
39
38
isApproved
40
39
} = await this . verifyPRAttributes ( ) ;
40
+
41
+ cli . startSpinner ( 'Verifying Jenkins CI status' ) ;
41
42
if ( ! jenkinsReady ) {
42
- cli . stopSpinner ( `Jenkins CI is failing for #${ prid } ` ) ;
43
+ cli . stopSpinner (
44
+ `Jenkins CI is failing for #${ prid } ` , cli . SPINNER_STATUS . FAILED ) ;
43
45
const proceed = await cli . prompt ( 'Do you want to proceed?' ) ;
44
46
if ( ! proceed ) {
45
47
cli . warn ( `Aborting release promotion for version ${ version } ` ) ;
46
48
return ;
47
49
}
48
- } else if ( ! githubCIReady ) {
49
- cli . stopSpinner ( `GitHub CI is failing for #${ prid } ` ) ;
50
+ }
51
+ cli . stopSpinner ( 'Jenkins CI is passing' ) ;
52
+
53
+ cli . startSpinner ( 'Verifying GitHub CI status' ) ;
54
+ if ( ! githubCIReady ) {
55
+ cli . stopSpinner (
56
+ `GitHub CI is failing for #${ prid } ` , cli . SPINNER_STATUS . FAILED ) ;
50
57
const proceed = await cli . prompt ( 'Do you want to proceed?' ) ;
51
58
if ( ! proceed ) {
52
59
cli . warn ( `Aborting release promotion for version ${ version } ` ) ;
53
60
return ;
54
61
}
55
- } else if ( ! isApproved ) {
56
- cli . stopSpinner ( `#${ prid } does not have sufficient approvals` ) ;
62
+ }
63
+ cli . stopSpinner ( 'GitHub CI is passing' ) ;
64
+
65
+ cli . startSpinner ( 'Verifying PR approval status' ) ;
66
+ if ( ! isApproved ) {
67
+ cli . stopSpinner (
68
+ `#${ prid } does not have sufficient approvals` ,
69
+ cli . SPINNER_STATUS . FAILED ) ;
57
70
const proceed = await cli . prompt ( 'Do you want to proceed?' ) ;
58
71
if ( ! proceed ) {
59
72
cli . warn ( `Aborting release promotion for version ${ version } ` ) ;
60
73
return ;
61
74
}
62
75
}
63
- cli . stopSpinner ( `The release PR for ${ version } is ready to promote! ` ) ;
76
+ cli . stopSpinner ( `# ${ prid } has necessary approvals ` ) ;
64
77
65
78
// Create and sign the release tag.
66
79
const shouldTagAndSignRelease = await cli . prompt (
@@ -74,7 +87,7 @@ class ReleasePromotion {
74
87
// Set up for next release.
75
88
cli . startSpinner ( 'Setting up for next release' ) ;
76
89
await this . setupForNextRelease ( ) ;
77
- cli . startSpinner ( 'Successfully set up for next release' ) ;
90
+ cli . stopSpinner ( 'Successfully set up for next release' ) ;
78
91
79
92
const shouldMergeProposalBranch = await cli . prompt (
80
93
'Merge proposal branch into staging branch?' ) ;
@@ -142,7 +155,7 @@ class ReleasePromotion {
142
155
const checker = new PRChecker ( cli , data , { prid, owner, repo } ) ;
143
156
const jenkinsReady = checker . checkJenkinsCI ( ) ;
144
157
const githubCIReady = checker . checkGitHubCI ( ) ;
145
- const isApproved = checker . checkReviewsAndWait ( false /* checkComments */ ) ;
158
+ const isApproved = checker . checkReviewsAndWait ( new Date ( ) , false ) ;
146
159
147
160
return {
148
161
jenkinsReady,
@@ -160,7 +173,7 @@ class ReleasePromotion {
160
173
const components = releaseCommitMessage . split ( ' ' ) ;
161
174
162
175
// Parse out release date.
163
- if ( ! / \d { 4 } - \d { 2 } - \d { 2 } / . match ( components [ 0 ] ) ) {
176
+ if ( ! components [ 0 ] . match ( / \d { 4 } - \d { 2 } - \d { 2 } / ) ) {
164
177
cli . error ( `Release commit contains invalid date: ${ components [ 0 ] } ` ) ;
165
178
return ;
166
179
}
0 commit comments