@@ -37,6 +37,7 @@ import (
37
37
38
38
"k8s.io/enhancements/api"
39
39
"k8s.io/enhancements/pkg/kepval/keps"
40
+ "k8s.io/enhancements/pkg/kepval/prrs"
40
41
"k8s.io/test-infra/prow/git"
41
42
)
42
43
@@ -373,6 +374,40 @@ func (c *Client) loadKEPFromYaml(kepPath string) (*api.Proposal, error) {
373
374
return nil , fmt .Errorf ("unable to load KEP metadata: %s" , err )
374
375
}
375
376
p .Name = filepath .Base (filepath .Dir (kepPath ))
377
+
378
+ // Read the PRR approval file and add any listed PRR approvers in there
379
+ // to the PRR approvers list in the KEP. this is a hack while we transition
380
+ // away from PRR approvers listed in kep.yaml
381
+ prrPath := filepath .Dir (kepPath )
382
+ prrPath = filepath .Dir (prrPath )
383
+ sig := filepath .Base (prrPath )
384
+ prrPath = filepath .Join (filepath .Dir (prrPath ),
385
+ "prod-readiness" ,
386
+ sig ,
387
+ p .Number + ".yaml" )
388
+ prrFile , err := os .Open (prrPath )
389
+ if os .IsNotExist (err ) {
390
+ return & p , nil
391
+ }
392
+ if err != nil {
393
+ return nil , fmt .Errorf ("could not open file %s: %v\n " , prrPath , err )
394
+ }
395
+
396
+ parser := & prrs.Parser {}
397
+ approval := parser .Parse (prrFile )
398
+ if approval .Error != nil {
399
+ fmt .Fprintf (c .Err , "WARNING: could not parse prod readiness request for KEP %s: %s\n " , p .Number , approval .Error )
400
+ }
401
+
402
+ approver := approval .ApproverForStage (p .Stage )
403
+ for _ , a := range p .PRRApprovers {
404
+ if a == approver {
405
+ approver = ""
406
+ }
407
+ }
408
+ if approver != "" {
409
+ p .PRRApprovers = append (p .PRRApprovers , approver )
410
+ }
376
411
return & p , nil
377
412
}
378
413
0 commit comments