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

Prevent duplicate tag push #5748

Merged
merged 10 commits into from
Apr 17, 2023
15 changes: 14 additions & 1 deletion tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,20 @@ public async Task Push(string pathToAssetsJson) {
}

GitHandler.Run($"tag {generatedTagName}", config);
GitHandler.Run($"push origin {generatedTagName}", config);

var remoteResult = GitHandler.Run($"ls-remote origin --tags {generatedTagName}", config);

if (remoteResult.ExitCode != 0)
{
if (string.IsNullOrWhiteSpace(remoteResult.StdOut))
{
GitHandler.Run($"push origin {generatedTagName}", config);
}
else
{
_consoleWrapper.WriteLine("Not attempting to push new tag, as we have found it already within the assets repo");
scbedd marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
catch(GitProcessException e)
{
Expand Down