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

Extend Git retry mechanism to git push race conditions on secrets/templates repos #426

Open
gberche-orange opened this issue Aug 17, 2021 · 1 comment · May be fixed by #428
Open

Extend Git retry mechanism to git push race conditions on secrets/templates repos #426

gberche-orange opened this issue Aug 17, 2021 · 1 comment · May be fixed by #428
Assignees

Comments

@gberche-orange
Copy link
Member

gberche-orange commented Aug 17, 2021

Expected behavior

As a coab operator

Observed behavior

The retry mechanism is apparently not working and failing at 1st push error

   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT java.lang.IllegalArgumentException: java.lang.RuntimeException: failed to push: remote conflict. re-push following rebase failed with: secondPushFailure
s=[REJECTED_NONFASTFORWARD]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at com.orange.oss.cloudfoundry.broker.opsautomation.ondemandbroker.git.SimpleGitManager.commitPushRepo(SimpleGitManager.java:363) ~[cf-ops-automatio
n-broker-core-1.8.0.jar:1.8.0]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at com.orange.oss.cloudfoundry.broker.opsautomation.ondemandbroker.git.RetrierGitManager.lambda$commitPushRepo$4(RetrierGitManager.java:51) ~[cf-ops
-automation-broker-core-1.8.0.jar:1.8.0]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at net.jodah.failsafe.Functions.lambda$toSupplier$11(Functions.java:248) ~[failsafe-2.4.1.jar:2.4.1]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at net.jodah.failsafe.Functions.lambda$get$0(Functions.java:48) ~[failsafe-2.4.1.jar:2.4.1]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at net.jodah.failsafe.RetryPolicyExecutor.lambda$supply$0(RetryPolicyExecutor.java:62) ~[failsafe-2.4.1.jar:2.4.1]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at net.jodah.failsafe.Execution.executeSync(Execution.java:128) ~[failsafe-2.4.1.jar:2.4.1]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at net.jodah.failsafe.FailsafeExecutor.call(FailsafeExecutor.java:376) ~[failsafe-2.4.1.jar:2.4.1]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at net.jodah.failsafe.FailsafeExecutor.run(FailsafeExecutor.java:223) ~[failsafe-2.4.1.jar:2.4.1]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at com.orange.oss.cloudfoundry.broker.opsautomation.ondemandbroker.git.RetrierGitManager.commitPushRepo(RetrierGitManager.java:49) ~[cf-ops-automati
on-broker-core-1.8.0.jar:1.8.0]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at com.orange.oss.cloudfoundry.broker.opsautomation.ondemandbroker.git.PooledGitManager.commitPushRepo(PooledGitManager.java:69) ~[cf-ops-automation
-broker-core-1.8.0.jar:1.8.0]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at com.orange.oss.cloudfoundry.broker.opsautomation.ondemandbroker.git.GitProcessor.commitPushRepo(GitProcessor.java:72) ~[cf-ops-automation-broker-
core-1.8.0.jar:1.8.0]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at com.orange.oss.cloudfoundry.broker.opsautomation.ondemandbroker.git.GitProcessor.postCreate(GitProcessor.java:24) ~[cf-ops-automation-broker-core
-1.8.0.jar:1.8.0]
   2021-08-17T13:07:47.01+0000 [APP/PROC/WEB/0] OUT 	at com.orange.oss.cloudfoundry.broker.opsautomation.ondemandbroker.processors.ProcessorChain.create(ProcessorChain.java:46) ~[cf-ops-automation-brok
@gberche-orange gberche-orange changed the title Gti retry mechanism isn't effective Git retry mechanism isn't effective Aug 17, 2021
@gberche-orange gberche-orange changed the title Git retry mechanism isn't effective Extend Git retry mechanism to git push race conditions on secrets/templates repos Aug 17, 2021
@gberche-orange
Copy link
Member Author

gberche-orange commented Aug 17, 2021

The git retrier mechanism only focussed 502 transport exceptions, handleIf(e -> isCauseSubclassOf(e, org.eclipse.jgit.api.errors.TransportException.class)) see

public RetrierGitManager(String repositoryAliasName, GitManager gitManager, RetryPolicy<Object> retryPolicy) {
this.gitManager = gitManager;
this.retryPolicy = retryPolicy;
this.retryPolicy
.onRetry(e -> logger.warn("Transient (?) failure, retrying. Cause: {}",
e.getLastFailure().toString(), e.getLastFailure()))
.onRetriesExceeded(e -> logger.warn("Aborting. Max attempts reached: #" + this.retryPolicy.getMaxAttempts() +
" or max duration reached (" + this.retryPolicy.getMaxDuration().toString() + "). Rethrowing failure:" + e.getFailure()))
.handleIf(e -> isCauseSubclassOf(e, org.eclipse.jgit.api.errors.TransportException.class))

Updated the issue title to consider this as an improvement

@gberche-orange gberche-orange self-assigned this Aug 17, 2021
gberche-orange added a commit that referenced this issue Aug 18, 2021
@gberche-orange gberche-orange linked a pull request Aug 18, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant