Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions builder/store/database/deploy_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,14 @@ func (s *deployTaskStoreImpl) GetDeployBySvcName(ctx context.Context, svcName st

func (s *deployTaskStoreImpl) StopDeploy(ctx context.Context, repoType types.RepositoryType, repoID, userID int64, deployID int64) error {
// only stop the deploy of specific repo was triggered by current login user
res, err := s.db.BunDB.Exec("Update deploys set status=?,updated_at=current_timestamp where id = ? and repo_id = ? and user_id = ?", common.Stopped, deployID, repoID, userID)
res, err := s.db.BunDB.Exec("Update deploys set status=?,updated_at=current_timestamp,instances='[]'::jsonb where id = ? and repo_id = ? and user_id = ?", common.Stopped, deployID, repoID, userID)
err = assertAffectedOneRow(res, err)
err = errorx.HandleDBError(err, nil)
return err
}
func (s *deployTaskStoreImpl) StopDeployByID(ctx context.Context, userID int64, deployID int64) error {
// only stop the deploy of specific repo was triggered by current login user
res, err := s.db.BunDB.Exec("Update deploys set status=?,updated_at=current_timestamp where id = ? and user_id = ?", common.Stopped, deployID, userID)
res, err := s.db.BunDB.Exec("Update deploys set status=?,updated_at=current_timestamp,instances='[]'::jsonb where id = ? and user_id = ?", common.Stopped, deployID, userID)
err = assertAffectedOneRow(res, err)
err = errorx.HandleDBError(err, nil)
return err
Expand Down
1 change: 1 addition & 0 deletions builder/store/database/deploy_task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestDeployTaskStore_CRUD(t *testing.T) {
dp, err = store.GetDeployByID(ctx, dp.ID)
require.Nil(t, err)
require.Equal(t, dp.Status, common.Stopped)
require.Empty(t, dp.Instances)

err = store.CreateDeploy(ctx, &database.Deploy{
DeployName: "dp2", SvcName: "s2",
Expand Down
2 changes: 1 addition & 1 deletion component/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ func (c *spaceComponentImpl) stopSpaceDeploy(ctx context.Context, namespace, nam

err = c.deployTaskStore.StopDeploy(ctx, types.SpaceRepo, deploy.RepoID, deploy.UserID, deploy.ID)
if err != nil {
return fmt.Errorf("fail to update space deploy status to stopped for deploy ID '%d', %w", deploy.ID, err)
return fmt.Errorf("failed to update space deploy status to stopped for deploy ID '%d', %w", deploy.ID, err)
}
return nil
}
Expand Down
Loading