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

Commit bae83a2

Browse files
author
noah
committed
Fix to add RepoID when creating a status
1 parent d7a424f commit bae83a2

File tree

12 files changed

+97
-20
lines changed

12 files changed

+97
-20
lines changed

internal/interactor/deployment.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ func (i *DeploymentInteractor) Deploy(ctx context.Context, u *ent.User, r *ent.R
125125
Status: string(deployment.StatusWaiting),
126126
Description: "Gitploy waits the reviews.",
127127
DeploymentID: d.ID,
128+
RepoID: r.ID,
128129
}); err != nil {
129130
i.log.Error("Failed to create a deployment status.", zap.Error(err))
130131
}
@@ -153,6 +154,7 @@ func (i *DeploymentInteractor) Deploy(ctx context.Context, u *ent.User, r *ent.R
153154
Status: string(deployment.StatusCreated),
154155
Description: "Gitploy starts to deploy.",
155156
DeploymentID: d.ID,
157+
RepoID: r.ID,
156158
}); err != nil {
157159
i.log.Error("Failed to create a deployment status.", zap.Error(err))
158160
}
@@ -235,6 +237,7 @@ func (i *DeploymentInteractor) DeployToRemote(ctx context.Context, u *ent.User,
235237
Status: string(deployment.StatusCreated),
236238
Description: "Gitploy start to deploy.",
237239
DeploymentID: d.ID,
240+
RepoID: r.ID,
238241
})
239242

240243
return d, nil
@@ -301,6 +304,7 @@ L:
301304
Status: "canceled",
302305
Description: "Gitploy cancels the inactive deployment.",
303306
DeploymentID: d.ID,
307+
RepoID: d.RepoID,
304308
}
305309
if err := i.scm.CancelDeployment(ctx, d.Edges.User, d.Edges.Repo, d, s); err != nil {
306310
i.log.Error("It has failed to cancel the remote deployment.", zap.Error(err))

internal/pkg/store/deploymentstatus.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ func (s *Store) CreateEntDeploymentStatus(ctx context.Context, ds *ent.Deploymen
2727
SetStatus(ds.Status).
2828
SetDescription(ds.Description).
2929
SetLogURL(ds.LogURL).
30-
SetDeploymentID(ds.DeploymentID)
30+
SetDeploymentID(ds.DeploymentID).
31+
SetRepoID(ds.RepoID)
3132

3233
if !ds.CreatedAt.IsZero() {
3334
qry.SetCreatedAt(ds.CreatedAt.UTC())

internal/pkg/store/event.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ func (s *Store) ListEventsGreaterThanTime(ctx context.Context, t time.Time) ([]*
3030
}).
3131
WithDeploymentStatus(func(dsq *ent.DeploymentStatusQuery) {
3232
dsq.
33-
WithDeployment()
33+
WithDeployment().
34+
WithRepo()
3435
}).
3536
WithReview(func(rq *ent.ReviewQuery) {
3637
rq.

internal/server/hooks/hook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func (h *Hooks) handleGithubDeploymentEvent(c *gin.Context) {
117117
}
118118

119119
ds.DeploymentID = d.ID
120+
ds.RepoID = d.RepoID
120121
if ds, err = h.i.CreateDeploymentStatus(ctx, ds); err != nil {
121122
h.log.Check(gb.GetZapLogLevel(err), "Failed to create a new the deployment status.").Write(zap.Error(err))
122123
gb.ResponseWithError(c, err)

model/ent/deploymentstatus.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

model/ent/deploymentstatus/where.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

model/ent/deploymentstatus_create.go

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

model/ent/deploymentstatus_update.go

Lines changed: 28 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

model/ent/migrate/schema.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

model/ent/mutation.go

Lines changed: 20 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)