Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 46d863b

Browse files
author
noah
committed
Add comments for deployment.go
1 parent 74046d4 commit 46d863b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

internal/interactor/deployment.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.
1720
func (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.
3542
func (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.
118127
func (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

Comments
 (0)