fix: Make git push operation atomic (#32777)

This commit is contained in:
Nidhi 2024-04-19 10:16:32 +05:30 committed by GitHub
parent 97e3791d3a
commit 3b45db6df6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -225,6 +225,7 @@ public class GitExecutorCEImpl implements GitExecutor {
StringBuilder result = new StringBuilder("Pushed successfully with status : "); StringBuilder result = new StringBuilder("Pushed successfully with status : ");
git.push() git.push()
.setAtomic(true)
.setTransportConfigCallback(transportConfigCallback) .setTransportConfigCallback(transportConfigCallback)
.setRemote(remoteUrl) .setRemote(remoteUrl)
.call() .call()

View File

@ -3077,11 +3077,11 @@ public class GitServiceCEImpl implements GitServiceCE {
auth.getPublicKey(), auth.getPublicKey(),
auth.getPrivateKey(), auth.getPrivateKey(),
gitArtifactMetadata.getBranchName()) gitArtifactMetadata.getBranchName())
.map(pushResult -> { .flatMap(pushResult -> {
if (pushResult.contains("REJECTED")) { if (pushResult.contains("REJECTED")) {
throw new AppsmithException(AppsmithError.GIT_UPSTREAM_CHANGES); return Mono.error(new AppsmithException(AppsmithError.GIT_UPSTREAM_CHANGES));
} }
return pushResult; return Mono.just(pushResult);
})); }));
} }