Skip to content

Commit 3fca70a

Browse files
rolfbjarneCopilot
andauthored
[devops] Move check for hard disk space to the setup logic. (#24364)
This way we always check for available hard disk space (currently we don't check for the API Diff pipeline). --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3bc8950 commit 3fca70a

File tree

7 files changed

+38
-31
lines changed

7 files changed

+38
-31
lines changed

tools/devops/automation/run-nightly-codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ stages:
6363
use1ES: false
6464
disableCodeQL: false
6565
xcodeChannel: $(xcodeChannel)
66+
statusContext: "Nightly CodeQL"
6667
buildSteps:
6768
- bash: $(Build.SourcesDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/automation/scripts/bash/build-nugets.sh
6869
displayName: 'Build Nugets'

tools/devops/automation/templates/build/api-diff-build-and-detect.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ steps:
5050
makeParallelism: '4'
5151
xcodeChannel: ${{ parameters.xcodeChannel }}
5252
use1ES: false
53+
requiredDiskSpace: 50
54+
statusContext: "API diff"
5355

5456
# detect changes
5557
- bash: $(Build.SourcesDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/automation/scripts/bash/compare.sh

tools/devops/automation/templates/build/build-mac-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ steps:
4848
xqaCertPass: ${{ parameters.xqaCertPass }}
4949
use1ES: ${{ parameters.use1ES }}
5050
xcodeChannel: ${{ parameters.xcodeChannel }}
51+
statusContext: "Build macOS tests"
52+
requiredDiskSpace: 10
5153
buildSteps:
5254

5355
- bash: |

tools/devops/automation/templates/build/build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ parameters:
5050
- name: XcodeChannel
5151
type: string
5252

53+
- name: requiredDiskSpace
54+
type: number
55+
default: 20
56+
57+
- name: statusContext
58+
type: string
59+
default: "Unknown context"
60+
5361
steps:
5462

5563
- template: ../common/checkout.yml
@@ -62,6 +70,8 @@ steps:
6270
parameters:
6371
disableCodeQL: ${{ parameters.disableCodeQL }}
6472
keyringPass: ${{ parameters.keyringPass }}
73+
requiredDiskSpace: ${{ parameters.requiredDiskSpace }}
74+
statusContext: ${{ parameters.statusContext }}
6575

6676
- template: install-certificates.yml@yaml-templates
6777
parameters:

tools/devops/automation/templates/common/setup.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ parameters:
66
default: true
77
- name: keyringPass
88
type: string
9+
- name: requiredDiskSpace
10+
type: number
11+
default: 20
12+
- name: statusContext
13+
type: string
914

1015
steps:
1116
- template: agent-cleanser/v1.yml@yaml-templates # Uninstalls mono, Xamarin.Mac (if installed) plus cleanses the Provisionator Xcode cache and kills processes at the end
@@ -28,6 +33,21 @@ steps:
2833
continueOnError: true
2934
timeoutInMinutes: 60
3035

36+
# Use a cmdlet to check if the space available in the device's root system is larger than the required amount (parameterized via 'requiredDiskSpace'). If there is not
37+
# enough space available it:
38+
# 1. Set the status of the build to error. It is not a failure since no tests have been ran.
39+
# 2. Set a comment stating the same as what was sent to the status.
40+
# 3. Cancel the pipeline and do not execute any of the following steps.
41+
- pwsh: |
42+
Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\$Env:BUILD_REPOSITORY_TITLE\tools\devops\automation\scripts\MaciosCI.psd1
43+
Assert-HDFreeSpace -Size ${{ parameters.requiredDiskSpace }}
44+
env:
45+
CONTEXT: ${{ parameters.statusContext }}
46+
GITHUB_TOKEN: $(GitHub.Token)
47+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
48+
displayName: 'Check HD Free Space'
49+
timeoutInMinutes: 5
50+
3151
- bash: $(System.DefaultWorkingDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/automation/scripts/bash/remove-ui-prompt.sh
3252
env:
3353
OSX_KEYCHAIN_PASS: ${{ parameters.keyringPass }}

tools/devops/automation/templates/mac/build.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,6 @@ steps:
9696
9797
displayName: 'Set VM Vendor'
9898

99-
# Use a cmdlet to check if the space available in the devices root system is larger than 50 gb. If there is not
100-
# enough space available it:
101-
# 1. Set the status of the build to error. It is not a failure since no tests have been ran.
102-
# 2. Set a comment stating the same as what was sent to the status.
103-
# 3. Cancel the pipeline and do not execute any of the following steps.
104-
- pwsh: |
105-
Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\$Env:BUILD_REPOSITORY_TITLE\tools\devops\automation\scripts\MaciosCI.psd1
106-
Assert-HDFreeSpace -Size 5
107-
env:
108-
CONTEXT: ${{ parameters.statusContext }}
109-
GITHUB_TOKEN: $(GitHub.Token)
110-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
111-
displayName: 'Check HD Free Space'
112-
timeoutInMinutes: 5
113-
11499
- task: xamops.azdevex.provisionator-task.provisionator@2
115100
displayName: 'Provision Brew components'
116101
inputs:

tools/devops/automation/templates/tests/build.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,10 @@ steps:
8585
- template: ../common/setup.yml
8686
parameters:
8787
keyringPass: ${{ parameters.keyringPass }}
88+
requiredDiskSpace: 20
89+
statusContext: ${{ parameters.statusContext }}
8890

89-
# Use a cmdlet to check if the space available in the devices root system is larger than 50 gb. If there is not
90-
# enough space available it:
91-
# 1. Set a comment stating the same as what was sent to the status.
92-
# 2. Cancel the pipeline and do not execute any of the following steps.
93-
- pwsh: |
94-
Import-Module ./MaciosCI.psd1
95-
Assert-HDFreeSpace -Size 20
96-
env:
97-
CONTEXT: ${{ parameters.statusContext }}
98-
GITHUB_TOKEN: $(GitHub.Token)
99-
ACCESSTOKEN: $(System.AccessToken)
100-
displayName: 'Check HD Free Space'
101-
timeoutInMinutes: 5
102-
workingDirectory: $(System.DefaultWorkingDirectory)/$(BUILD_REPOSITORY_TITLE)/tools/devops/automation/scripts/
103-
104-
# if we got to this point, it means that we do have at least 50 Gb to run the test, should
91+
# if we got to this point, it means that we do have at least 20 Gb to run the test, should
10592
# be more than enough, else the above script would have stopped the pipeline
10693
- bash: |
10794
set -x

0 commit comments

Comments
 (0)