@@ -30,7 +30,7 @@ import (
30
30
)
31
31
32
32
func ValidatePRR (kep * api.Proposal , h * api.PRRHandler , prrDir string ) error {
33
- requiredPRRApproval , _ , err := isPRRRequired (kep )
33
+ requiredPRRApproval , _ , _ , err := isPRRRequired (kep )
34
34
if err != nil {
35
35
return errors .Wrap (err , "checking if PRR is required" )
36
36
}
@@ -91,39 +91,49 @@ func ValidatePRR(kep *api.Proposal, h *api.PRRHandler, prrDir string) error {
91
91
return nil
92
92
}
93
93
94
- func isPRRRequired (kep * api.Proposal ) (required , missingMilestone bool , err error ) {
94
+ func isPRRRequired (kep * api.Proposal ) (required , missingMilestone , missingStage bool , err error ) {
95
95
logrus .Debug ("checking if PRR is required" )
96
96
97
97
required = true
98
98
missingMilestone = kep .IsMissingMilestone ()
99
+ missingStage = kep .IsMissingStage ()
99
100
100
101
if kep .Status != "implementable" {
101
102
required = false
102
- return required , missingMilestone , nil
103
+ return required , missingMilestone , missingStage , nil
103
104
}
104
105
105
106
if missingMilestone {
106
107
required = false
108
+ // TODO: Make this a specialized error
107
109
logrus .Warnf ("KEP %s is missing the latest milestone field. This will become a validation error in future releases." , kep .Number )
108
110
109
- return required , missingMilestone , nil
111
+ return required , missingMilestone , missingStage , nil
112
+ }
113
+
114
+ if missingStage {
115
+ required = false
116
+ // TODO: Make this a specialized error
117
+ logrus .Warnf ("KEP %s is missing the stage field. This will become a validation error in future releases." , kep .Number )
118
+
119
+ return required , missingMilestone , missingStage , nil
110
120
}
111
121
112
122
// TODO: Consider making this a function
113
123
prrRequiredAtSemVer , err := semver .ParseTolerant ("v1.21" )
114
124
if err != nil {
115
- return required , missingMilestone , errors .Wrap (err , "creating a SemVer object for PRRs" )
125
+ return required , missingMilestone , missingStage , errors .Wrap (err , "creating a SemVer object for PRRs" )
116
126
}
117
127
118
128
latestSemVer , err := semver .ParseTolerant (kep .LatestMilestone )
119
129
if err != nil {
120
- return required , missingMilestone , errors .Wrap (err , "creating a SemVer object for latest milestone" )
130
+ return required , missingMilestone , missingStage , errors .Wrap (err , "creating a SemVer object for latest milestone" )
121
131
}
122
132
123
133
if latestSemVer .LT (prrRequiredAtSemVer ) {
124
134
required = false
125
- return required , missingMilestone , nil
135
+ return required , missingMilestone , missingStage , nil
126
136
}
127
137
128
- return required , missingMilestone , nil
138
+ return required , missingMilestone , missingStage , nil
129
139
}
0 commit comments