@@ -14,6 +14,9 @@ import (
1414 "go.uber.org/zap"
1515)
1616
17+ // IsApproved verifies that the request is approved or not.
18+ // It is approved if there is an approval of reviews at least, but
19+ // it is rejected if there is a reject of reviews.
1720func (i * Interactor ) IsApproved (ctx context.Context , d * ent.Deployment ) bool {
1821 rvs , _ := i .Store .ListReviews (ctx , d )
1922
@@ -32,6 +35,10 @@ func (i *Interactor) IsApproved(ctx context.Context, d *ent.Deployment) bool {
3235 return false
3336}
3437
38+ // Deploy posts a new deployment to SCM with the payload.
39+ // But if it requires a review, it saves the payload on the DB
40+ // and waits until reviewed.
41+ // It returns an error for a undeployable payload.
3542func (i * Interactor ) Deploy (ctx context.Context , u * ent.User , r * ent.Repo , d * ent.Deployment , env * extent.Env ) (* ent.Deployment , error ) {
3643 if err := i .isDeployable (ctx , u , r , d , env ); err != nil {
3744 return nil , err
@@ -114,7 +121,9 @@ func (i *Interactor) Deploy(ctx context.Context, u *ent.User, r *ent.Repo, d *en
114121 return d , nil
115122}
116123
117- // DeployToRemote create a new remote deployment after the deployment was approved.
124+ // DeployToRemote posts a new deployment to SCM with the saved payload
125+ // after review has finished.
126+ // It returns an error for a undeployable payload.
118127func (i * Interactor ) DeployToRemote (ctx context.Context , u * ent.User , r * ent.Repo , d * ent.Deployment , env * extent.Env ) (* ent.Deployment , error ) {
119128 if d .Status != deployment .StatusWaiting {
120129 return nil , e .NewErrorWithMessage (
0 commit comments