orange-cloudfoundry / cf-ops-automation-broker

On demand dedicated services through COA concourse pipeline engine
4 stars 0 forks source link

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

Open gberche-orange opened 3 years ago

gberche-orange commented 3 years ago

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 commented 3 years ago

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

https://github.com/orange-cloudfoundry/cf-ops-automation-broker/blob/72c09b25d0ecaf57120fdd44aa3cd61ff299295b/cf-ops-automation-broker-core/src/main/java/com/orange/oss/cloudfoundry/broker/opsautomation/ondemandbroker/git/RetrierGitManager.java#L16-L24

Updated the issue title to consider this as an improvement