Fix telemetry-steps.yml (#4903)

Fix bug in telemetry-steps.yml that causes telemetry setup to be disabled even if TELEMETRYGUID is set.
This commit is contained in:
edgchen1 2020-08-24 22:14:40 -07:00 committed by GitHub
parent f34ed3a576
commit 71d8846635
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)