Skip to content

Commit

Permalink
[KS-590] Auto-approval for workflow spec deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
bolekk committed Nov 25, 2024
1 parent 3230f2a commit 64d4820
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions core/services/feeds/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,21 @@ func (s *service) DeleteJob(ctx context.Context, args *DeleteJobArgs) (int64, er
logger.Errorw("Failed to push metrics for job proposal deletion", "err", err)
}

job, err := s.jobORM.FindJobByExternalJobID(ctx, proposal.ExternalJobID.UUID)
if err != nil {
// TODO: can this fails for non-workflow jobs? if so, should we still return an error (we don't know the type yet...)
return 0, errors.Wrap(err, "FindJobByExternalJobID failed")
}
if job.WorkflowSpecID != nil {
specId := int64(*job.WorkflowSpecID)

Check failure on line 519 in core/services/feeds/service.go

View workflow job for this annotation

GitHub Actions / lint

var-naming: var specId should be specID (revive)
// auto approve workflow specs
if err := s.CancelSpec(ctx, specId); err != nil {
logger.Errorw("Failed to auto approve workflow spec deletion", "id", specId, "err", err)
return 0, fmt.Errorf("failed to approve workflow spec deletion %d: %w", specId, err)
}
logger.Infow("Successful workflow spec deletion auto approval", "id", specId)
}

return proposal.ID, nil
}

Expand Down

0 comments on commit 64d4820

Please sign in to comment.