Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions .github/actions/upgrade-azure-cli/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,30 @@ description: Upgrades Azure CLI on Linux and Windows runners
runs:
using: composite
steps:
- name: Upgrade Azure CLI on Linux
# Azure CLI 2.91.0 runs on Python 3.14 and deadlocks intermittently on module import during
# long-running operations such as creating a Service Bus namespace (Azure/azure-cli#33996). The fix,
# Azure/azure-cli#34201, is not in 2.91.0. Both steps install 2.90.0 instead of the latest version.
# Once a release that contains the fix is available, restore the upgrade:
# Linux: curl -fsSL 'https://azurecliprod.blob.core.windows.net/$root/deb_install.sh' | sudo bash
# Windows: az upgrade --yes
- name: Install Azure CLI 2.90.0 on Linux
if: runner.os == 'Linux'
shell: bash
run: curl -fsSL 'https://azurecliprod.blob.core.windows.net/$root/deb_install.sh' | sudo bash
- name: Upgrade Azure CLI on Windows
run: |
deb="azure-cli_2.90.0-1~$(lsb_release -cs)_amd64.deb"
curl -fsSL -o "$RUNNER_TEMP/$deb" "https://packages.microsoft.com/repos/azure-cli/pool/main/a/azure-cli/$deb"
sudo apt-get install -y --allow-downgrades "$RUNNER_TEMP/$deb"
az version
# The MSI refuses to install over the newer version on the runner image, so the ZIP distribution is
# extracted next to it and put first on PATH for the following steps.
- name: Install Azure CLI 2.90.0 on Windows
if: runner.os == 'Windows'
shell: pwsh
run: az upgrade --yes
run: |
$zip = Join-Path $env:RUNNER_TEMP 'azure-cli-2.90.0-x64.zip'
$dir = Join-Path $env:RUNNER_TEMP 'azure-cli-2.90.0'
Invoke-WebRequest -Uri 'https://azcliprod.blob.core.windows.net/zip/azure-cli-2.90.0-x64.zip' -OutFile $zip
Expand-Archive -Path $zip -DestinationPath $dir -Force
$bin = Join-Path $dir 'bin'
$bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
& (Join-Path $bin 'az.cmd') version
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,18 @@ await store.Maintenance.SendAsync(new PutIndexesOperation(new IndexDefinition
finally
{
await StopServer();
if (Directory.Exists(root))
try
{
if (Directory.Exists(root))
{
FileUtils.DeleteDirectory(root, recursive: true, contentsOnly: false);
}
}
catch (Exception ex)
{
FileUtils.DeleteDirectory(root, recursive: true, contentsOnly: false);
// The server files can stay locked for a moment after the process exits. The temp folder is not
// what the test verifies, so a failed cleanup must not fail the test.
Assert.Warn($"Failed to delete {root}: {ex}");
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/ServiceControlInstaller.Engine/FileSystem/FileUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ static void RunWithRetries(Action action)
action();
break;
}
catch (IOException ex) when (--attempts > 0)
// Windows reports a file that a process still holds, or that an antivirus scanner holds, as
// UnauthorizedAccessException, for example right after the process that loaded it exits
catch (Exception ex) when ((ex is IOException or UnauthorizedAccessException) && --attempts > 0)
{
Debug.WriteLine($"ServiceControlInstaller.Engine.FileSystem.FileUtils::RunWithRetries Action failed, {attempts} attempts remaining. Reason: {ex.Message} ({ex.GetType().FullName})");
// Yes, Task.Delay would be better but would require all calls to be async
Expand Down
Loading