From 00a99098d3eb4a1e0ba39e4b2514233350abc715 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 3 Mar 2025 08:20:48 +0100 Subject: [PATCH] [devops] Install .NET before trying to install simulators. Because installing simulators means running a C# project, which requires .NET to build. Also improve the .NET version check systemdependencies.sh to not blindly try to execute `dotnet`, but check for its presence first. This fixes a couple of issues on bots that don't have .NET installed. --- system-dependencies.sh | 8 ++++++-- tools/devops/automation/templates/tests/build.yml | 4 ++++ tools/devops/automation/templates/windows/reserve-mac.yml | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/system-dependencies.sh b/system-dependencies.sh index 361d179dcc2b..5c48d3cc66be 100755 --- a/system-dependencies.sh +++ b/system-dependencies.sh @@ -964,8 +964,12 @@ check_7z check_objective_sharpie check_old_simulators if test -z "$IGNORE_DOTNET"; then - ok "Installed .NET SDKs:" - (IFS=$'\n'; for i in $(/usr/local/share/dotnet/dotnet --list-sdks); do log "$i"; done) + if test -f /usr/local/share/dotnet/dotnet; then + ok "Installed .NET SDKs:" + (IFS=$'\n'; for i in $(/usr/local/share/dotnet/dotnet --list-sdks); do log "$i"; done) + else + warn ".NET is not installed" + fi fi if test -z $FAIL; then diff --git a/tools/devops/automation/templates/tests/build.yml b/tools/devops/automation/templates/tests/build.yml index 977182bf47ea..99fb3f27d301 100644 --- a/tools/devops/automation/templates/tests/build.yml +++ b/tools/devops/automation/templates/tests/build.yml @@ -230,6 +230,10 @@ steps: github_token: ${{ parameters.gitHubToken }} timeoutInMinutes: 250 +- task: UseDotNet@2 + inputs: + version: 9.x + - bash: | set -x set -e diff --git a/tools/devops/automation/templates/windows/reserve-mac.yml b/tools/devops/automation/templates/windows/reserve-mac.yml index e315acde4894..0a6540c41dc2 100644 --- a/tools/devops/automation/templates/windows/reserve-mac.yml +++ b/tools/devops/automation/templates/windows/reserve-mac.yml @@ -102,6 +102,10 @@ steps: github_token: ${{ parameters.gitHubToken }} timeoutInMinutes: 250 +- task: UseDotNet@2 + inputs: + version: 9.x + - bash: $(Build.SourcesDirectory)/$(BUILD_REPOSITORY_TITLE)/system-dependencies.sh --ignore-mono --ignore-visual-studio --ignore-mono --ignore-sharpie --ignore-shellcheck --ignore-yamllint --provision-simulators displayName: 'Provision simulators' timeoutInMinutes: 250