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

Repair failing test-proxy livetests #5259

Merged
merged 14 commits into from
Jan 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public async Task Push(string pathToAssetsJson) {
return;
}

SetOrigin(config);
var pendingChanges = DetectPendingChanges(config);
var generatedTagName = config.TagPrefix;

Expand All @@ -121,19 +122,20 @@ public async Task Push(string pathToAssetsJson) {
{
throw GenerateInvokeException(SHAResult);
}
SetOrigin(config);

GitHandler.Run($"tag {generatedTagName}", config);
GitHandler.Run($"push origin {generatedTagName}", config);
HideOrigin(config);
}
catch(GitProcessException e)
{
HideOrigin(config);
throw GenerateInvokeException(e.Result);
}
await UpdateAssetsJson(generatedTagName, config);
await BreadCrumb.Update(config);
}

HideOrigin(config);
}

/// <summary>
Expand Down Expand Up @@ -173,6 +175,7 @@ public async Task Reset(string pathToAssetsJson)
InitializeAssetsRepo(config);
}

SetOrigin(config);
var pendingChanges = DetectPendingChanges(config);

if (pendingChanges.Length > 0)
Expand Down Expand Up @@ -208,6 +211,7 @@ public async Task Reset(string pathToAssetsJson)
}
catch(GitProcessException e)
{
HideOrigin(config);
throw GenerateInvokeException(e.Result);
}

Expand All @@ -217,6 +221,8 @@ public async Task Reset(string pathToAssetsJson)
await BreadCrumb.Update(config);
}
}

HideOrigin(config);
}

/// <summary>
Expand Down Expand Up @@ -249,7 +255,7 @@ public string[] DetectPendingChanges(GitAssetsConfiguration config)
{
SetSafeDirectory(config);

if (!GitHandler.TryRun("status --porcelain", config.AssetsRepoLocation.ToString(), out var diffResult))
if (!GitHandler.TryRun($"status --porcelain", config.AssetsRepoLocation.ToString(), out var diffResult))
{
throw GenerateInvokeException(diffResult);
}
Expand Down Expand Up @@ -309,16 +315,18 @@ public void CheckoutRepoAtConfig(GitAssetsConfiguration config)
// The -c advice.detachedHead=false removes the verbose detatched head state
// warning that happens when syncing sparse-checkout to a particular Tag
GitHandler.Run($"-c advice.detachedHead=false checkout {config.Tag}", config);
HideOrigin(config);

// the first argument, the key, is the path to the assets json relative location
// the second argument, the value, is the value we want to set the json elative location to
// the third argument is a function argument that resolves what to do in the "update" case. If the key already exists
// update the tag to what we just checked out.
Assets.AddOrUpdate(config.AssetsJsonRelativeLocation.ToString(), config.Tag, (key, oldValue) => config.Tag);

HideOrigin(config);
}
catch(GitProcessException e)
{
HideOrigin(config);
throw GenerateInvokeException(e.Result);
}
}
Expand Down