Skip to content

Commit

Permalink
[CI] [siminstaller] Bump bots to use the Ventura and make siminstalle…
Browse files Browse the repository at this point in the history
…r more resilient (#17760)

## siminstaller

We are getting a `System.IO.IOException: Resource busy`
when trying to detach with hdiutil on Ventura. When reaching
this spot we are really done with the mounted resource so
let's force detaching and in the event that it fails let's
just log since at this point the simulator is installed.

## CI

Bump bots to use the Ventura images, and Add `macOSName`
parameter to our yaml templates.

`macOSName` maps to the `macOS.Name` capability in our bots, this
way we can set the macOS name we want to use on the bots in bot build and tests.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
  • Loading branch information
3 people committed Mar 14, 2023
1 parent 7f4eea4 commit 9178171
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 5 deletions.
1 change: 1 addition & 0 deletions tests/xammac_tests/xammac_tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<RootTestsDirectory>..</RootTestsDirectory>
<CompilerResponseFile>$(RootTestsDirectory)\..\src\rsp\macos-defines.rsp</CompilerResponseFile>
<MonoBundlingExtraArgs>$(MonoBundlingExtraArgs) --marshal-objectivec-exceptions:throwmanagedexception</MonoBundlingExtraArgs>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
6 changes: 6 additions & 0 deletions tools/devops/automation/build-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ parameters:
type: string
default: 'latest'

- name: macOSName # comes from the build agent demand named macOS.Name
displayName: Name of the version of macOS to use
type: string
default: 'Ventura'

- name: pool
type: string
displayName: Bot pool to use
Expand Down Expand Up @@ -204,6 +209,7 @@ stages:
- template: templates/main-stage.yml
parameters:
xcodeChannel: Stable
macOSName: ${{ parameters.macOSName }}
isPR: false
provisionatorChannel: ${{ parameters.provisionatorChannel }}
pool: ${{ parameters.pool }}
Expand Down
6 changes: 6 additions & 0 deletions tools/devops/automation/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ parameters:
type: string
default: 'latest'

- name: macOSName # comes from the build agent demand named macOS.Name
displayName: Name of the version of macOS to use
type: string
default: 'Ventura'

- name: pool
type: string
displayName: Bot pool to use
Expand Down Expand Up @@ -187,6 +192,7 @@ stages:
- template: templates/main-stage.yml
parameters:
xcodeChannel: Stable
macOSName: ${{ parameters.macOSName }}
isPR: true
provisionatorChannel: ${{ parameters.provisionatorChannel }}
pool: ${{ parameters.pool }}
Expand Down
5 changes: 4 additions & 1 deletion tools/devops/automation/templates/build/api-diff-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ parameters:
- name: xcodeChannel
type: string

- name: macOSName
type: string

jobs:
- job: configure
displayName: 'Configure build'
Expand Down Expand Up @@ -91,7 +94,7 @@ jobs:
name: $(AgentPoolComputed)
demands:
- Agent.OS -equals Darwin
- macios_image -equals v2.1 # Big Sur image with Xcode 12.4 and 12.5 installed
- macOS.Name -equals ${{ parameters.macOSName }}
- XcodeChannel -equals ${{ parameters.xcodeChannel }}
workspace:
clean: all
Expand Down
5 changes: 4 additions & 1 deletion tools/devops/automation/templates/build/build-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ parameters:
- name: xcodeChannel
type: string

- name: macOSName
type: string

jobs:
- job: configure
displayName: 'Configure build'
Expand Down Expand Up @@ -133,7 +136,7 @@ jobs:
name: $(AgentPoolComputed)
demands:
- Agent.OS -equals Darwin
- macios_image -equals v2.1 # Big Sur image with Xcode 12.4 and 12.5 installed
- macOS.Name -equals ${{ parameters.macOSName }}
- XcodeChannel -equals ${{ parameters.xcodeChannel }}
workspace:
clean: all
Expand Down
6 changes: 6 additions & 0 deletions tools/devops/automation/templates/main-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ parameters:
- name: xcodeChannel
type: string

- name: macOSName
type: string

- name: simTestsConfigurations
type: object
default: [
Expand Down Expand Up @@ -234,6 +237,7 @@ stages:
- template: ./build/build-stage.yml
parameters:
xcodeChannel: ${{ parameters.xcodeChannel }}
macOSName: ${{ parameters.macOSName }}
isPR: ${{ parameters.isPR }}
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}
Expand Down Expand Up @@ -321,6 +325,7 @@ stages:
- template: ./build/api-diff-stage.yml
parameters:
xcodeChannel: ${{ parameters.xcodeChannel }}
macOSName: ${{ parameters.macOSName }}
isPR: ${{ parameters.isPR }}
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}
Expand All @@ -337,6 +342,7 @@ stages:
- template: ./tests/stage.yml
parameters:
xcodeChannel: ${{ parameters.xcodeChannel }}
macOSName: ${{ parameters.macOSName }}
isPR: ${{ parameters.isPR }}
repositoryAlias: ${{ parameters.repositoryAlias }}
commit: ${{ parameters.commit }}
Expand Down
5 changes: 4 additions & 1 deletion tools/devops/automation/templates/tests/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ parameters:
- name: XcodeChannel
type: string

- name: macOSName
type: string

stages:
- stage: ${{ parameters.stageName }}
displayName: ${{ parameters.displayName }}
Expand Down Expand Up @@ -139,7 +142,7 @@ stages:
name: $(AgentPoolComputed)
demands:
- Agent.OS -equals Darwin
- macios_image -equals v2.1 # Big Sur image with Xcode 12.4 and 12.5 installed
- macOS.Name -equals ${{ parameters.macOSName }}
- XcodeChannel -equals ${{ parameters.XcodeChannel }}
- ${{ each demand in parameters.extraBotDemands }}:
- demand
Expand Down
10 changes: 8 additions & 2 deletions tools/siminstaller/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,16 @@ static bool Install (string source, long fileSize, string installPrefix)
Directory.Delete (expanded_path, true);
}
} finally {
TryExecuteAndCapture ("hdiutil", $"detach '{mount_point}' -quiet", out _);
if (!TryExecuteAndCapture ("hdiutil", $"detach '{mount_point}' -quiet -force", out _))
Console.WriteLine ($"Failed to detach {mount_point}");
}
} finally {
Directory.Delete (mount_point, true);
try {
Directory.Delete (mount_point, true);
} catch (IOException ioex) {
Console.WriteLine ($"Unable to remove: {mount_point}");
Console.WriteLine ($" with error: {ioex}");
}
}

File.Delete (download_path);
Expand Down

6 comments on commit 9178171

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.