onnxruntime/tools/ci_build/github/windows/set_telemetry_var.ps1
Changming Sun 4a0b86eba6
Update the post-merge pipeline (#14965)
### Description
1.  Remove Linux jobs for ORT-Extension combined build
2.  Add a macOS build job for ORT-Extension combined build
3. Adjust the yaml file so that it can support two different ADO
instances.


### Motivation and Context
To test our code better. And it will enable us to run such tests for
every commit in the main branch. It would be easier for us to figure out
which change caused a build break.

See
[AB#13435](https://aiinfra.visualstudio.com/6a833879-cd9b-44a4-a9de-adc2d818f13c/_workitems/edit/13435)
2023-03-29 13:12:07 -07:00

15 lines
No EOL
1.1 KiB
PowerShell

# The first part of the expression in the following "if" statement is necessary, otherwise it will report an error,
# "You cannot call a method on a null-valued expression.", when the env variable does not exist.
if (-not [string]::IsNullOrEmpty( $Env:TELEMETRYGUID) -and $Env:TELEMETRYGUID.StartsWith('"')) {
$length = $Env:TELEMETRYGUID.length
# See https://learn.microsoft.com/en-us/windows/win32/api/traceloggingprovider/nf-traceloggingprovider-traceloggingoptiongroup
# The value of the env variable must have quotes, because we do not add the quotes here.
$fileContent = "#define TraceLoggingOptionMicrosoftTelemetry() \
TraceLoggingOptionGroup("+$Env:TELEMETRYGUID.substring(1, $length-2)+")"
New-Item -Path "include\onnxruntime\core\platform\windows\TraceLoggingConfigPrivate.h" -ItemType "file" -Value "$fileContent" -Force
Write-Host "##vso[task.setvariable variable=TelemetryOption]--use_telemetry"
Write-Host "Telemetry is enabled."
} else {
Write-Host "##vso[task.setvariable variable=TelemetryOption]"
Write-Host "Telemetry is disabled."
}