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 26, 2024
1 parent 3230f2a commit 5774807
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 fail 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)
// 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 5774807

Please sign in to comment.