Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE]: Choose the git push error default behavior #29

Open
damsien opened this issue Dec 5, 2024 · 0 comments
Open

[FE]: Choose the git push error default behavior #29

damsien opened this issue Dec 5, 2024 · 0 comments
Labels
feature A feature that is listed in the roadmap good first issue Good for newcomers

Comments

@damsien
Copy link
Collaborator

damsien commented Dec 5, 2024

Roadmap: v0.3 - 2024/12 Ability to choose the git push error default behavior
As a the DevOps of my team, I want to define the default behavior if for any reason, the push action fails.

What to do

1. Add the defaultPushErrorBehavior field in the RemoteSyncer

First, you need to create a new apiVersion for the RemoteSyncer object. Please see this page.

The field will be of a specific type.

type PushErrorBehavior string

const (
        Block       PushErrorBehavior = "Block"
        Pass        PushErrorBehavior = "Pass"
        Index       PushErrorBehavior = "Index"
)

2. Write the default behavior function

Write a function in the webhook request reconciler. Look for wrc.remoteSyncer.Spec.DefaultPushErrorBehavior.

  1. if set to Block, return false
  2. if set to Pass, return true
  3. if set to Index, return false (this feature will be addressed in a feature release)

3. Execute the behavior

If the push step fails, execute the function.

isPushed, err := wrc.gitPush(&rDetails)
wrc.gitPushPostChecker(isPushed, err, &rDetails)
if err != nil {
rDetails.errorDuringProcess = true
return wrc.responseConstructor(rDetails)
}

Keep the

rDetails.errorDuringProcess = true

If the function returns false, then

return wrc.responseConstructor(rDetails)

Else, do nothing. The final postCheck() will be executed.

Additional context

If you have any questions, please tag @damsien.

@damsien damsien added enhancement Request for enhancement good first issue Good for newcomers feature A feature that is listed in the roadmap labels Dec 5, 2024
@damsien damsien removed the enhancement Request for enhancement label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature that is listed in the roadmap good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant