Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Execute build.ps1 from bash on Mac to avoid STDIO streams hang #19257

Merged
merged 8 commits into from Dec 7, 2023
23 changes: 22 additions & 1 deletion eng/pipelines/common/device-tests-steps.yml
Expand Up @@ -55,9 +55,30 @@ steps:
- pwsh: ./build.ps1 --target=dotnet-buildtasks --configuration="Release"
displayName: 'Build the MSBuild Tasks'

- pwsh: ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }}
- pwsh: |
$platformName = 'Windows'
if ($IsMacOS) {
$platformName = 'Mac'
} elseif ($IsLinux) {
$platformName = 'Linux'
}
Write-Host "Platform.Name: ${platformName}"
Write-Host "##vso[task.setvariable variable=Platform.Name]${platformName}"
displayName: 'Set Platform.Name'

- pwsh: |
./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }}
displayName: $(Agent.JobName)
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), ne(variables['Platform.Name'], 'Mac'))
retryCountOnTaskFailure: 2

- bash: |
# Execute the powershell script from a bash shell on Mac to avoid interference between powershell processes that lead to this error: The STDIO streams did not close within 10 seconds of the exit event from process '/usr/local/bin/pwsh'. This may indicate a child process inherited the STDIO streams and has not yet exited.
pwsh ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }}
displayName: $(Agent.JobName)
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), eq(variables['Platform.Name'], 'Mac'))
retryCountOnTaskFailure: 2

- task: PublishTestResults@2
Expand Down