Skip to content

Commit

Permalink
feat(pr): add Planning state
Browse files Browse the repository at this point in the history
  • Loading branch information
corrieriluca committed Nov 5, 2023
1 parent 8018ce1 commit a17bbed
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion internal/controllers/terraformpullrequest/states.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (r *Reconciler) GetState(ctx context.Context, pr *configv1alpha1.TerraformP
return &Idle{}, conditions
case isLastCommitDiscovered && areLayersStillPlanning:
log.Infof("pull request %s layers are still planning, waiting", pr.Name)
return &Idle{}, conditions
return &Planning{}, conditions
case isLastCommitDiscovered && !areLayersStillPlanning && !isCommentUpToDate:
log.Infof("pull request %s layers have finished, posting comment", pr.Name)
return &CommentNeeded{}, conditions
Expand All @@ -50,6 +50,14 @@ func (s *Idle) getHandler() func(ctx context.Context, r *Reconciler, repository
}
}

type Planning struct{}

func (s *Planning) getHandler() func(ctx context.Context, r *Reconciler, repository *configv1alpha1.TerraformRepository, pr *configv1alpha1.TerraformPullRequest) ctrl.Result {
return func(ctx context.Context, r *Reconciler, repository *configv1alpha1.TerraformRepository, pr *configv1alpha1.TerraformPullRequest) ctrl.Result {
return ctrl.Result{RequeueAfter: r.Config.Controller.Timers.WaitAction}
}
}

type DiscoveryNeeded struct{}

func (s *DiscoveryNeeded) getHandler() func(ctx context.Context, r *Reconciler, repository *configv1alpha1.TerraformRepository, pr *configv1alpha1.TerraformPullRequest) ctrl.Result {
Expand Down

0 comments on commit a17bbed

Please sign in to comment.