Skip to content

Commit 423ac1d

Browse files
azure-sdkscbedd
andauthored
update the entry to catch git config errors before the push happens (#36682)
Co-authored-by: Scott Beddall <[email protected]>
1 parent 458d095 commit 423ac1d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

eng/common/testproxy/onboarding/generate-assets-json.ps1

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In that case, the assets.json should live alongside the ci.yml in the sdk/<Servi
1414
1515
Generated assets.json file contents
1616
- AssetsRepo: "Azure/azure-sdk-assets" - This is the assets repository, aka where your recordings will live after this script runs.
17-
- AssetsRepoPrefixPath: "<language>" - this is will be computed from repository it's being run in.
17+
- AssetsRepoPrefixPath: "<language>" - this is will be computed from repository it's being run in.
1818
- TagPrefix: "<language>/<ServiceDirectory>" or "<language>/<ServiceDirectory>/<library>" or deeper if things
1919
are nested in such a manner. All tags created for this assets.json will start with this name.
2020
- Tag: "" - Initially empty, as nothing has yet been pushed.
@@ -81,6 +81,7 @@ $LangRecordingDirs = @{"cpp" = "recordings";
8181
. (Join-Path $PSScriptRoot "common-asset-functions.ps1")
8282

8383
Test-Exe-In-Path -ExeToLookFor $GitExe
84+
8485
$language = Get-Repo-Language
8586

8687
# If the initial push is being performed, ensure that test-proxy is
@@ -89,7 +90,7 @@ $language = Get-Repo-Language
8990
if ($InitialPush) {
9091
$proxyPresent = Test-Exe-In-Path -ExeToLookFor $TestProxyExe -ExitOnError $false
9192

92-
# try to fall back
93+
# try to fall back
9394
if (-not $proxyPresent) {
9495
$StandaloneTestProxyExe = "Azure.Sdk.Tools.TestProxy"
9596

@@ -107,6 +108,17 @@ if ($InitialPush) {
107108
Write-Error "The user has selected option InitialPush to push their assets, neither $TestProxyExe nor standalone executable $StandaloneTestProxyExe are installed on this machine."
108109
exit 1
109110
}
111+
112+
# if we're pushing, we also need to confirm that the necessary git configuration items are set
113+
$result = git config --get user.name
114+
if ($LASTEXITCODE -ne 0 -or !$result){
115+
Write-Error "The git config setting `"user.name`" is unset. Set it to your git user name via 'git config --global user.name `"<setting>`'"
116+
}
117+
118+
$result = git config --get user.email
119+
if ($LASTEXITCODE -ne 0 -or !$result){
120+
Write-Error "The git config setting `"user.email`" is unset. Set it to your git email via 'git config --global user.email `"<setting>`'"
121+
}
110122
}
111123

112124
if ($TestProxyExe -eq "test-proxy" -or $TestProxyExe.StartsWith("Azure.Sdk.Tools.TestProxy")) {

0 commit comments

Comments
 (0)