Skip to content

Commit

Permalink
Ensure push of an unrestored assets.json is a recognizable error (#…
Browse files Browse the repository at this point in the history
…4868)

* and set environment exit code to -1
  • Loading branch information
scbedd authored Dec 5, 2022
1 parent c151cca commit 723daf9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ public async Task<string> GetPath(string pathToAssetsJson)
/// <returns></returns>
public async Task Push(string pathToAssetsJson) {
var config = await ParseConfigurationFile(pathToAssetsJson);

var initialized = IsAssetsRepoInitialized(config);

if (!initialized)
{
_consoleWrapper.WriteLine($"The targeted assets.json \"{config.AssetsJsonRelativeLocation}\" has not been restored prior to attempting push. " +
$"Are you certain you're pushing the correct assets.json? Please invoke \'test-proxy restore \"{config.AssetsJsonRelativeLocation}\"\' prior to invoking a push operation.");

Environment.ExitCode = -1;
return;
}

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

Expand Down

0 comments on commit 723daf9

Please sign in to comment.