Skip to content

Commit 17a6cf2

Browse files
authored
[devops] Use a variable for the Xcode channel to avoid duplication. (#23781)
Also verify that we use the right Xcode channel depending on which version of Xcode we're targeting.
1 parent c034c8b commit 17a6cf2

File tree

10 files changed

+53
-10
lines changed

10 files changed

+53
-10
lines changed

docs/ReleaseCheckList.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ Copy this list into a new issue and then check off as the release progresses.
2020
* XCODE_VERSION
2121
* XCODE_URL
2222
* XCODE_DEVELOPER_ROOT
23-
* Update any `xcodeChannel` values in tools/devops. Change to `Beta` if using an Xcode beta or release candidate, and switch back to `Stable` with the final (stable) Xcode release.
23+
* Update the `xcodeChannel` value in `tools/devops/automation/templates/variables/common.yml`. Change to `Beta` if using an Xcode beta or release candidate, and switch back to `Stable` with the final (stable) Xcode release.
2424
```shell
25-
$ cd tools/devops
26-
$ git grep -nE -e 'xcodeChannel: (Stable|Beta)' -i
27-
[...] # these are the matches that may need fixing.
25+
$ git grep -A 1 -E 'xcodeChannel' -- tools/devops/automation/templates/variables/common.yml
26+
[...] # the value that needs to be updated
2827
```
2928
* Add the new OS versions to the `builds/Version-*.plist.in` files.
3029
* Build and fix any issues.

tools/devops/automation/build-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ extends:
128128
stages:
129129
- template: templates/main-stage.yml
130130
parameters:
131-
xcodeChannel: Beta
131+
xcodeChannel: $(xcodeChannel)
132132
macOSName: ${{ parameters.macOSName }}
133133
isPR: false
134134
provisionatorChannel: ${{ parameters.provisionatorChannel }}

tools/devops/automation/build-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extends:
121121
stages:
122122
- template: templates/main-stage.yml
123123
parameters:
124-
xcodeChannel: Beta
124+
xcodeChannel: $(xcodeChannel)
125125
macOSName: ${{ parameters.macOSName }}
126126
isPR: true
127127
provisionatorChannel: ${{ parameters.provisionatorChannel }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ stages:
4444
demands:
4545
- Agent.OS -equals Darwin
4646
- macOS.Name -equals ${{ parameters.macOSName }}
47-
- XcodeChannel -equals Beta
47+
- XcodeChannel -equals $(xcodeChannel)
4848
workspace:
4949
clean: all
5050
steps:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash -e
2+
3+
if test -z "${XCODE_CHANNEL:-}"; then
4+
echo "The environment variable XCODE_CHANNEL must be specified."
5+
exit 1
6+
fi
7+
8+
cd "$(dirname "${BASH_SOURCE[0]}")/../../.."
9+
10+
FILE=$(pwd)/tmp.txt
11+
12+
make print-variable-value-to-file FILE="$FILE" VARIABLE=XCODE_IS_PREVIEW
13+
XCODE_IS_PREVIEW=$(cat "$FILE")
14+
15+
make print-variable-value-to-file FILE="$FILE" VARIABLE=XCODE_IS_STABLE
16+
XCODE_IS_STABLE=$(cat "$FILE")
17+
18+
rm -f "$FILE"
19+
20+
if [[ "$XCODE_IS_PREVIEW $XCODE_IS_STABLE" == "true false" ]]; then
21+
if [[ "${XCODE_CHANNEL}" != "Beta" ]]; then
22+
echo "XCODE_CHANNEL must be 'Beta' (not '$XCODE_CHANNEL') when XCODE_IS_PREVIEW=$XCODE_IS_PREVIEW (and XCODE_IS_STABLE=$XCODE_IS_STABLE)"
23+
exit 1
24+
fi
25+
elif [[ "$XCODE_IS_PREVIEW $XCODE_IS_STABLE" == "false true" ]]; then
26+
if [[ "${XCODE_CHANNEL}" != "Stable" ]]; then
27+
echo "XCODE_CHANNEL must be 'Stable' (not '$XCODE_CHANNEL') when XCODE_IS_STABLE=$XCODE_IS_STABLE (and XCODE_IS_PREVIEW=$XCODE_IS_PREVIEW)"
28+
exit 1
29+
fi
30+
else
31+
echo "Unexpected values for XCODE_IS_STABLE ($XCODE_IS_STABLE) and XCODE_IS_PREVIEW ($XCODE_IS_PREVIEW): must be either 'true' or 'false', and not equal to eachother."
32+
exit 1
33+
fi
34+
35+
echo "The current Xcode channel ('$XCODE_CHANNEL') is correct."

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ steps:
146146
name: configure_platforms
147147
displayName: 'Configure platforms'
148148

149+
- bash: ./$(BUILD_REPOSITORY_TITLE)/tools/devops/automation/scripts/bash/validate-xcode-channel.sh
150+
name: validateXcodeChannel
151+
displayName: 'Validate Xcode channel'
152+
env:
153+
XCODE_CHANNEL: $(xcodeChannel)
154+
149155
- pwsh: |
150156
Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY/$Env:BUILD_REPOSITORY_TITLE/tools/devops/automation/scripts/MaciosCI.psd1
151157
$jsonPath = Join-Path -Path "$(Build.ArtifactStagingDirectory)" -ChildPath "configuration.json"

tools/devops/automation/templates/pipelines/api-diff-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ variables:
5454
stages:
5555
- template: ../api-diff-stage.yml
5656
parameters:
57-
xcodeChannel: Beta
57+
xcodeChannel: $(xcodeChannel)
5858
macOSName: ${{ parameters.macOSName }}
5959
isPR: ${{ parameters.isPR }}
6060
provisionatorChannel: ${{ parameters.provisionatorChannel }}

tools/devops/automation/templates/pipelines/build-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ variables:
8989
stages:
9090
- template: ../main-stage.yml
9191
parameters:
92-
xcodeChannel: Beta
92+
xcodeChannel: $(xcodeChannel)
9393
macOSName: ${{ parameters.macOSName }}
9494
isPR: ${{ parameters.isPR }}
9595
provisionatorChannel: ${{ parameters.provisionatorChannel }}

tools/devops/automation/templates/pipelines/run-tests-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ variables:
5555
stages:
5656
- template: ../tests-stage.yml
5757
parameters:
58-
xcodeChannel: Beta
58+
xcodeChannel: $(xcodeChannel)
5959
macOSName: ${{ parameters.macOSName }}
6060
isPR: ${{ parameters.isPR }}
6161
provisionatorChannel: ${{ parameters.provisionatorChannel }}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,6 @@ variables:
6969

7070
- name: DotNetPreviewSdkVersion
7171
value: 10.0
72+
73+
- name: xcodeChannel
74+
value: Beta

0 commit comments

Comments
 (0)