diff --git a/tools/ci_build/github/azure-pipelines/templates/telemetry-steps.yml b/tools/ci_build/github/azure-pipelines/templates/telemetry-steps.yml index c309dd9fc5..ba647f9b5b 100644 --- a/tools/ci_build/github/azure-pipelines/templates/telemetry-steps.yml +++ b/tools/ci_build/github/azure-pipelines/templates/telemetry-steps.yml @@ -2,27 +2,18 @@ # variable steps: - - ${{ if ne(variables.TELEMETRYGUID, '') }}: - - task: PythonScript@0 - displayName: 'Set TelemetryOption variable [telemetry enabled]' - inputs: - scriptSource: inline - script: | - print("##vso[task.setvariable variable=TelemetryOption]--use_telemetry") - - - powershell: | + - powershell: | + if ($env:TELEMETRYGUID) { $length = $env:TELEMETRYGUID.length $fileContent = "#define TraceLoggingOptionMicrosoftTelemetry() \ TraceLoggingOptionGroup("+$env:TELEMETRYGUID.substring(1, $length-2)+")" New-Item -Path "$(Build.SourcesDirectory)\include\onnxruntime\core\platform\windows\TraceLoggingConfigPrivate.h" -ItemType "file" -Value "$fileContent" -Force - displayName: 'Create TraceLoggingConfigPrivate.h For WinML Telemetry' - env: - TELEMETRYGUID: $(TELEMETRYGUID) - - - ${{ if eq(variables.TELEMETRYGUID, '') }}: - - task: PythonScript@0 - displayName: 'Set TelemetryOption variable [telemetry disabled]' - inputs: - scriptSource: inline - script: | - print("##vso[task.setvariable variable=TelemetryOption]") + 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." + } + displayName: 'Set TelemetryOption variable and optionally create TraceLoggingConfigPrivate.h for WinML Telemetry' + env: + TELEMETRYGUID: $(TELEMETRYGUID)