Skip to content

Commit

Permalink
[CI] Fix Windows Wheel flaky build caused by ', using heredoc in refr…
Browse files Browse the repository at this point in the history
…eshenv. (ray-project#29903)

See ray-project#29878 and ray-project#29717 for context.

TL;DR there is a script which exports environment variables present in powershell to bash, but it fails to handle cases where environment variable values contain single quotes. This causes the Windows Wheels build to fail whenever an environment variable value contains a single quote, particularly when the commit message has a single quote (common!). I fixed it by exporting the variables using bash heredocs which are more robust against arbitrary input values.

Signed-off-by: Cade Daniel <[email protected]>
  • Loading branch information
cadedaniel authored Nov 1, 2022
1 parent 78ad948 commit f39d323
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/build-wheel-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ Get-ChildItem env:* | %{
if ($_.Name -eq 'PATH') {
$value = $value -replace ';',':'
}
Write-Output ("export " + $_.Name + "='" + $value + "'")
# Use heredocs to wrap values. This fixes problems with environment variables containing single quotes.
# An environment variable containing the string REFRESHENV_EOF could still cause problems, but is
# far less likely than a single quote.
Write-Output ("export " + $_.Name + "=$`(cat <<- 'REFRESHENV_EOF'`n" + $value + "`nREFRESHENV_EOF`)")
}
} | Out-File -Encoding ascii $env:TEMP\refreshenv.sh
Expand Down

0 comments on commit f39d323

Please sign in to comment.