Skip to content

Commit 847fdf3

Browse files
authored
Refactor dotnet steps to add DevOps logging (Azure#52879)
1 parent 002f914 commit 847fdf3

File tree

4 files changed

+37
-28
lines changed

4 files changed

+37
-28
lines changed

eng/pipelines/templates/jobs/ci.tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,12 @@ jobs:
157157
parameters:
158158
LogFilePath: $(Build.ArtifactStagingDirectory)/test.binlog
159159

160-
- script: >-
160+
- pwsh: >
161+
./eng/scripts/runwithdevopslogging.ps1
161162
dotnet test eng/service.proj
162-
--filter "(TestCategory!=Manually) & (TestCategory!=Live) & ($(AdditionalTestFilters))"
163+
--filter '"(TestCategory!=Manually) & (TestCategory!=Live) & ($(AdditionalTestFilters))"'
163164
--framework $(TestTargetFramework)
164-
--logger "trx;LogFileName=$(TestTargetFramework).trx" --logger:"console;verbosity=normal"
165+
--logger '"trx;LogFileName=$(TestTargetFramework).trx"' --logger:'"console;verbosity=normal"'
165166
--blame-crash-dump-type full --blame-hang-dump-type full --blame-hang-timeout ${{parameters.TestTimeoutInMinutes}}minutes
166167
/p:SDKType=${{ parameters.SDKType }}
167168
/p:ServiceDirectory=$(ServiceDirectory)

eng/pipelines/templates/jobs/live.tests.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ jobs:
161161
azurePowerShellVersion: LatestVersion
162162
pwsh: true
163163
ScriptType: InlineScript
164-
Inline: >-
164+
Inline: >
165165
. ./eng/common/TestResources/SubConfig-Helpers.ps1
166166
$serviceDirectoryPrefix = BuildServiceDirectoryPrefix ${{ parameters.ServiceDirectory }};
167167
$account = (Get-AzContext).Account;
@@ -170,11 +170,12 @@ jobs:
170170
[Environment]::SetEnvironmentVariable("${serviceDirectoryPrefix}CLIENT_ID", $account.Id);
171171
[Environment]::SetEnvironmentVariable("${serviceDirectoryPrefix}TENANT_ID", $account.Tenants);
172172
173+
./eng/scripts/runwithdevopslogging.ps1
173174
dotnet test eng/service.proj
174175
--framework $(TestTargetFramework)
175-
--filter "TestCategory!=Manually & ($(AdditionalTestFilters))"
176-
--logger "trx"
177-
--logger:"console;verbosity=normal"
176+
--filter '"TestCategory!=Manually & ($(AdditionalTestFilters))"'
177+
--logger trx
178+
--logger:'"console;verbosity=normal"'
178179
--blame-crash-dump-type full --blame-hang-dump-type full --blame-hang-timeout ${{parameters.TimeoutInMinutes}}minutes
179180
/p:SDKType=${{ parameters.SDKType }}
180181
/p:ServiceDirectory=${{ parameters.ServiceDirectory }}
@@ -187,6 +188,7 @@ jobs:
187188
/p:CollectCoverage=$(CollectCoverage) /p:CodeCoverageDirectory=$(Build.SourcesDirectory)\sdk\${{parameters.ServiceDirectory}}
188189
/p:EnableSourceLink=false
189190
$(AdditionalTestArguments);
191+
190192
Write-Host "Last exit code: $LASTEXITCODE";
191193
exit $LASTEXITCODE;
192194
env:
@@ -198,12 +200,13 @@ jobs:
198200
${{ var.key }}: ${{ var.value }}
199201

200202
- ${{ else }}:
201-
- script: >-
203+
- pwsh: >
204+
./eng/scripts/runwithdevopslogging.ps1
202205
dotnet test eng/service.proj
203206
--framework $(TestTargetFramework)
204-
--filter "TestCategory!=Manually & ($(AdditionalTestFilters))"
205-
--logger "trx"
206-
--logger:"console;verbosity=normal"
207+
--filter '"TestCategory!=Manually & ($(AdditionalTestFilters))"'
208+
--logger trx
209+
--logger:'"console;verbosity=normal"'
207210
--blame-crash-dump-type full --blame-hang-dump-type full --blame-hang-timeout ${{parameters.TimeoutInMinutes}}minutes
208211
/p:SDKType=${{ parameters.SDKType }}
209212
/p:ServiceDirectory=${{ parameters.ServiceDirectory }}

eng/pipelines/templates/steps/build.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,27 @@ steps:
9494
# surprised by new errors that pop up only in internal when public CI was clean.
9595
- ${{ if eq(parameters.ServiceDirectory, 'auto') }}:
9696
# only use the project list override file if the service directory is not auto
97-
- pwsh: |
98-
dotnet pack eng/service.proj -warnaserror `
99-
/p:ValidateRunApiCompat=true `
100-
/p:SDKType=${{ parameters.SDKType }} `
101-
/p:IncludeTests=false `
102-
/p:PublicSign=false $(VersioningProperties) `
103-
/p:Configuration=Release `
104-
/p:CommitSHA=$(Build.SourceVersion) `
105-
/p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory) `
106-
/p:ServiceDirectory=* `
107-
/p:ProjectListOverrideFile=$(ProjectListOverrideFile) `
108-
/p:IncludePerf=false `
109-
/p:IncludeStress=false `
110-
/p:IncludeIntegrationTests=false `
111-
/p:EnableOverrideExclusions=true `
112-
$(DiagnosticArguments)
97+
- pwsh: >
98+
./eng/scripts/runwithdevopslogging.ps1
99+
dotnet pack eng/service.proj -warnaserror
100+
/p:ValidateRunApiCompat=true
101+
/p:SDKType=${{ parameters.SDKType }}
102+
/p:IncludeTests=false
103+
/p:PublicSign=false $(VersioningProperties)
104+
/p:Configuration=Release
105+
/p:CommitSHA=$(Build.SourceVersion)
106+
/p:ArtifactsPackagesDir=$(Build.ArtifactStagingDirectory)
107+
/p:ServiceDirectory=*
108+
/p:ProjectListOverrideFile=$(ProjectListOverrideFile)
109+
/p:IncludePerf=false
110+
/p:IncludeStress=false
111+
/p:IncludeIntegrationTests=false
112+
/p:EnableOverrideExclusions=true
113+
$(DiagnosticArguments)
113114
displayName: "Build and Package for PR"
114115
- ${{ else }}:
115-
- script: >-
116+
- pwsh: >
117+
./eng/scripts/runwithdevopslogging.ps1
116118
dotnet pack eng/service.proj -warnaserror
117119
/p:ValidateRunApiCompat=true
118120
/p:SDKType=${{ parameters.SDKType }}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
. $PSScriptRoot/../common/scripts/Helpers/CommandInvocation-Helpers.ps1
2+
3+
Invoke-LoggedMsbuildCommand "$args"

0 commit comments

Comments
 (0)