Skip to content

Commit

Permalink
Improve workflow-trigger registration on startup
Browse files Browse the repository at this point in the history
In situation when there is a combination of
invalid trigger and/or workflow but workflow
issues are not set, boot procedure crashed.

This is due to combination of old wf/trigger
setup that was successfuly saved before special
trigger verification was introduced.
  • Loading branch information
darh committed Oct 21, 2021
1 parent 58c1358 commit 415982c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion automation/service/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,12 @@ func (svc *trigger) registerWorkflows(ctx context.Context, workflows ...*types.W
continue
}

if len(wf.Issues) > 0 {
// workflow was processed before and issues were detected
// and stored on the workflow; no need to continue
continue
}

if err = svc.registerWorkflow(ctx, wf, tt.FilterByWorkflowID(wf.ID)...); err != nil {
return err
}
Expand Down Expand Up @@ -485,7 +491,13 @@ func (svc *trigger) registerWorkflow(ctx context.Context, wf *types.Workflow, tt
}

if wis := validateWorkflowTriggers(wf, tt...); len(wis) > 0 {
return wis
// skip trigger registration of there is a trigger related issue(s)
// on a specific workflow.
//
// this really happens since we run all validation on save,
// but there might be workflow from the time when these checks were
// not in place
return nil
}

if wf.RunAs > 0 {
Expand Down

0 comments on commit 415982c

Please sign in to comment.