Skip to content

Commit

Permalink
Execute immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidotdev committed Jan 25, 2024
1 parent f08e384 commit c060a12
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions controllers/pipeline_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ func (r *PipelineReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
if err := r.Update(ctx, pipeline); err != nil {
return ctrl.Result{}, err
}

if pipeline.Annotations != nil && pipeline.Annotations["spinnaker.kaidotdev.github.io/execute-immediately"] == "true" {
if _, err := r.SpinnakerClient.ExecPipeline(pipeline.Status.SpinnakerResource.ApplicationName, pipeline.Status.SpinnakerResource.ID); err != nil {
r.Recorder.Eventf(pipeline, coreV1.EventTypeNormal, "ExecuteFailed", "Failed to execute pipeline: %q", req.Name)
return ctrl.Result{}, nil
}
r.Recorder.Eventf(pipeline, coreV1.EventTypeNormal, "SuccessfulExecuted", "Executed pipeline: %q", req.Name)
}
}
} else {
if containsString(pipeline.ObjectMeta.Finalizers, myFinalizerName) {
Expand Down

0 comments on commit c060a12

Please sign in to comment.