Repository navigation
[devops] Provision Xcode from an immutable Azure Artifacts package instead of Provisionator - #26309
Conversation
CI currently gets Xcode through Provisionator, which needs a read-only SAS token for the BosStorageMirror storage account. Neither the token nor the storage account is something this repository can reason about, and the downloaded bundle is never checked against what Make.config expects. Pin the Xcode we build with as an immutable Azure Artifacts Universal Package instead, and add the repository-owned tooling that installs it: * Make.config gains XCODE_PACKAGE_FEED, XCODE_PACKAGE_NAME, XCODE_PACKAGE_VERSION and XCODE_BUILD_VERSION next to XCODE_VERSION. XCODE_URL stays for local provisioning, which has no access to the feed. * install-xcode.sh verifies a package (manifest schema, size, SHA-256 and Apple XIP signature), installs it atomically with a backup/rollback, and reconciles selection, the Xcode.app symlink, the Xamarin/MAUI AppleSdkRoot settings, the licence and first-launch state. It refuses to run when XCODE_DEVELOPER_ROOT and XCODE_PACKAGE_VERSION disagree. * packagekit-extract.m expands the Apple-signed XIP through the same PackageKit API Archive Utility uses. It is a private framework, so install-xcode.sh falls back to 'xip --expand' if it ever stops working. * download-universal-package.sh downloads a Universal Package with the Azure DevOps ArtifactTool. ArtifactTool has no native macOS arm64 build, so the osx-x64 release is run explicitly under Rosetta. Downloads are staged in a sibling directory and renamed only on success, so they are retry-safe. Trust is anchored in Apple's own signature and in the immutability of the feed version, not in the manifest that travels inside the package. Nothing calls these yet; this commit only adds them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
The Xcode Universal Package lives in a 'macios-tools-internal' feed that exists in more than one Azure DevOps organization, with the same feed name and the same package name but a different host project: DevDiv: https://devdiv.visualstudio.com/DevDiv/_artifacts/feed/macios-tools-internal/UPack/xcode-apple-silicon/ dnceng: https://dnceng.visualstudio.com/internal/_artifacts/feed/macios-tools-internal/UPack/xcode-apple-silicon/ Add download-xcode-package.sh, which reads the pinned coordinates from Make.config, takes the organization from SYSTEM_COLLECTIONURI, and maps it to the project that owns the feed: 'devdiv' to 'DevDiv' and 'dnceng' to 'internal'. Both the legacy '<org>.visualstudio.com' and the modern 'dev.azure.com/<org>' forms are accepted and normalised to a single canonical endpoint per organization, so the result doesn't depend on which form the agent happens to report. Deriving the project from a mapping rather than from System.TeamProject keeps the feed address independent of where the pipeline itself runs, and turns an unsupported organization into an actionable error instead of a confusing 404. The mapping is only a default: --organization, --project and --feed all override it, so another organization can be onboarded without touching this script. Note that 'dnceng' means the 'internal' project; 'public' has no access to this feed. --print exposes each resolved value so the resolution can be checked without downloading anything. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
The pinned Xcode package is 'xcode-apple-silicon' and contains arm64 slices only, so the jobs that provision Xcode have to run on Apple silicon. The jobs that expand build/build.yml only demanded a macOS name, which is Apple silicon in practice (Tahoe dropped Intel) but was never stated. Add an explicit 'macOS.Architecture -equals arm64' demand so an Intel agent is never scheduled in the first place, rather than failing once provisioning starts. This matches what the simulator test and Windows reservation jobs already demand. The ACES branches are left alone: they select an image directly, and that image is Apple silicon. The macOS test legs are unaffected. They never provision Xcode, so the x64 Sonoma leg keeps running on x64. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
Teach ./system-dependencies.sh to install Xcode through install-xcode.sh so that CI and local provisioning share one implementation. * --xcode-package-directory points at a downloaded Universal Package. install_specific_xcode hands it to install-xcode.sh, which validates it before anything privileged happens. * Without a package, the XCODE_URL archive is still downloaded for local provisioning, but it is now installed through the same code path. The curl invocation gained --fail and retries so a failed download stops being an HTML error page saved as a .xip. DMGs are no longer supported; Apple ships XIPs. * check_specific_xcode replaces the "does the directory exist" test with 'install-xcode.sh verify', which also checks the product build, the bundle identity, the host architecture, the minimum macOS version and the Apple code signature, and then reconciles selection when provisioning. The probe is quiet so the ordinary "not installed yet" case doesn't look like an error, and is repeated verbosely before failing so the real reason is visible. * get_xcode_developer_root reads Make.config directly while provisioning. install-xcode.sh is driven by Make.config, so honouring an inherited variable or a stale configure.inc here made the rest of the script inspect a different Xcode than the one that was just installed and selected. Without --provision-xcode, configure.inc is still honoured, so './configure --xcode=...' keeps working locally. * Under Azure Pipelines, refuse to fall back to the XCODE_URL download. That dependency is what the Universal Package replaces and there are no credentials for it in CI, so it would otherwise fail obscurely much later. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
Replace common/provision.yml, which minted two read-only BosStorageMirror SAS tokens through an Azure service connection and then ran the Provisionator bootstrap, with common/provision-xcode.yml. The new template resolves the pinned package, skips the download when the agent already has that exact Xcode, downloads it from the feed belonging to the organization the build runs in, and then runs system-dependencies.sh. It authenticates with the pipeline's own build identity, so no Azure subscription service connection, storage account, SAS token or GitHub PAT is involved. System.AccessToken is mapped into the download step only, and no step in the template enables 'set -x'. Provisioning is now expressed once instead of being split between a Provisionator run and a second system-dependencies.sh call: * Build and simulator tests previously ran Provisionator and then system-dependencies.sh with a different set of flags. Both are now a single call that always passes --provision-xcode, so selection, the Xcode.app symlink, the AppleSdkRoot settings and first-launch state are reconciled. This matters for the Windows reservation job, which deletes those settings immediately beforehand. * shellcheck, yamllint and p7zip move from the Provisionator brew step to --provision-shellcheck, --provision-yamllint and --provision-7z, which run the same brew commands. azure-cli is dropped: it was there for the SAS generation this commit removes, and the only remaining macOS consumer of 'az' installs it itself, before provisioning. * The Windows reservation job keeps skipping Xcode components via the new provisionXcodeComponents parameter, and still provisions after the agent has been taken out of its pool. * mac/build.yml's Provisionator call was disabled and is deleted outright. The template takes the checkout path as a parameter because the callers don't agree on Build.SourcesDirectory versus System.DefaultWorkingDirectory. Two steps that existed only to keep Provisionator working are removed: the 'make provisioning' generation steps, and the guards that required xcode-select to already point at an Xcode. ensure-xcode-select.sh goes with them, since it hard-failed when /Applications/Xcode.app was missing, which blocked the installer that repairs exactly that state. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
Nothing runs Provisionator any more, so delete what was left behind: * provisionator-bootstrap.sh, which downloaded the Provisionator archive from the BosStorageMirror storage account using a SAS token. * build-provisioning.csx, provision-xcode.csx, provision-brew-packages.csx and provision-shared.in.csx, together with the 'provisioning' make target that generated provision-shared.csx from Make.config, and the .gitignore entries for the generated files. * The provisionatorChannel parameter and the PROVISIONATOR_CHANNEL variable, which were threaded from the entry pipelines all the way down to the provisioning steps. This also removes the last use of the 'Xamarin - RelEng (BosStorageMirror-Contributor-MI)' service connection from the macOS jobs. XCODE_URL still points at BosStorageMirror because local provisioning has no access to the internal feed; CI no longer reads it. The cleanup steps that delete ~/Library/Caches/com.xamarin.provisionator are intentionally kept, so bots that were provisioned by the old tooling still get that cache removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
Update the two places that still described the Provisionator flow: * tools/devops/README.md drops the provisionatorChannel parameter and replaces the 'provisionator@2 task -> build-provisioning.csx' node in the build step graph with the new template and the scripts it calls. * The Xcode bump skill now collects the Azure Artifacts package version and the product build version, sets XCODE_PACKAGE_NAME, XCODE_PACKAGE_VERSION and XCODE_BUILD_VERSION, and points out that XCODE_DEVELOPER_ROOT has to name the application XCODE_PACKAGE_VERSION implies, because install-xcode.sh refuses to run when the two disagree. The skill also gains the step that is easiest to forget: the matching package has to exist in both the DevDiv and the dnceng feed before CI is queued, since each pipeline resolves the same coordinates in its own organization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
There was a problem hiding this comment.
Pull request overview
This PR replaces macOS CI Xcode provisioning via Provisionator + BosStorageMirror SAS tokens with a repo-owned, end-to-end verified install flow that downloads an immutable Azure Artifacts Universal Package pinned in Make.config.
Changes:
- Add Azure Artifacts Universal Package download + Xcode install/verify scripts and a new
provision-xcode.ymltemplate. - Switch build/test/reservation pipelines to the new provisioning template, remove Provisionator plumbing (templates, bootstrap, csx generation).
- Require Apple silicon agents for jobs that provision Xcode and wire the new pinned package coordinates into
Make.config.
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/devops/README.md | Updates pipeline/provisioning flow documentation to reflect new template + scripts. |
| tools/devops/provision-xcode.csx | Removes legacy Provisionator csx entrypoint. |
| tools/devops/provision-shared.in.csx | Removes legacy Provisionator helper logic (Xcode select, brew packages, VSMac settings). |
| tools/devops/provision-brew-packages.csx | Removes legacy Provisionator brew provisioning csx. |
| tools/devops/Makefile | Removes csx generation target previously required for Provisionator. |
| tools/devops/build-provisioning.csx | Removes legacy Provisionator build provisioning script. |
| tools/devops/automation/templates/windows/reserve-mac.yml | Switches reservation job to provision-xcode.yml and unifies provisioning steps. |
| tools/devops/automation/templates/variables/common.yml | Removes Provisionator channel variable plumbing. |
| tools/devops/automation/templates/tests/build.yml | Switches test build provisioning to provision-xcode.yml. |
| tools/devops/automation/templates/tests-stage.yml | Removes Provisionator channel parameter from stage contract. |
| tools/devops/automation/templates/pipelines/run-tests-pipeline.yml | Removes Provisionator channel parameter threading. |
| tools/devops/automation/templates/pipelines/build-pipeline.yml | Removes Provisionator channel parameter threading. |
| tools/devops/automation/templates/pipelines/api-diff-pipeline.yml | Removes Provisionator channel parameter threading. |
| tools/devops/automation/templates/main-stage.yml | Removes Provisionator channel parameter from main stage contract. |
| tools/devops/automation/templates/mac/build.yml | Removes Provisionator-related cache-clearing and disabled brew provisioning template usage. |
| tools/devops/automation/templates/common/setup.yml | Removes ensure-xcode-select.sh call; defers selection to Xcode provisioning template. |
| tools/devops/automation/templates/common/provision.yml | Deletes legacy Provisionator + SAS token provisioning template. |
| tools/devops/automation/templates/common/provision-xcode.yml | Adds new unified Xcode + dependency provisioning template (resolve/download/provision/clean). |
| tools/devops/automation/templates/build/build.yml | Switches build stage to provision-xcode.yml and removes legacy provisioning steps. |
| tools/devops/automation/templates/build/build-stage.yml | Adds arm64 demand for jobs that provision Xcode. |
| tools/devops/automation/templates/build/build-mac-tests-stage.yml | Adds arm64 demand for jobs that provision Xcode in mac tests build stage. |
| tools/devops/automation/templates/build/api-diff-stage.yml | Adds arm64 demand for API diff stage provisioning legs. |
| tools/devops/automation/templates/api-diff-stage.yml | Removes Provisionator channel parameter from API diff stage contract. |
| tools/devops/automation/scripts/provisionator-bootstrap.sh | Deletes Provisionator bootstrap script. |
| tools/devops/automation/scripts/bash/packagekit-extract.m | Adds PackageKit-based signed XIP extraction helper (with runtime fallback in installer). |
| tools/devops/automation/scripts/bash/install-xcode.sh | Adds Xcode package validation, install, selection reconciliation, and verification logic. |
| tools/devops/automation/scripts/bash/ensure-xcode-select.sh | Deletes legacy “ensure xcode-select” helper. |
| tools/devops/automation/scripts/bash/download-xcode-package.sh | Adds org→project feed resolution and wrapper around universal package downloader. |
| tools/devops/automation/scripts/bash/download-universal-package.sh | Adds ArtifactTool bootstrap + universal package download implementation. |
| tools/devops/automation/scripts/.gitignore | Removes ignore for legacy Provisionator extraction directory. |
| tools/devops/automation/run-nightly-codeql.yml | Adds arm64 demand for CodeQL job that provisions Xcode. |
| tools/devops/automation/build-pull-request.yml | Removes Provisionator channel parameter from PR entry pipeline. |
| tools/devops/automation/build-pipeline.yml | Removes Provisionator channel parameter from CI entry pipeline. |
| system-dependencies.sh | Adds Xcode package directory support and routes installs/verifications through install-xcode.sh. |
| Make.config | Pins Xcode universal package coordinates + build version; documents new CI provisioning source. |
| .gitignore | Removes legacy Provisionator/generated csx ignore entries. |
| .agents/skills/macios-xcode-beta-update/SKILL.md | Updates Xcode bump skill to include package/build coordinates and new constraints. |
This comment has been minimized.
This comment has been minimized.
The Linux build verification leg runs 'make -C tools/devops check-sh', which invokes whatever shellcheck the agent happens to have; no version is pinned. install_archive's trap handler is only reached through 'trap', which shellcheck cannot see from inside a subshell function, so it reports the whole handler as unreachable. Newer shellchecks call that SC2329, which was already silenced; the version on the Linux agent calls it SC2317, which was not, so check-sh failed with 15 findings. Silence both codes and say why. Verified by reproducing the exact 15 SC2317 findings with shellcheck 0.10.0 and confirming they are gone, while shellcheck 0.11.0 still reports nothing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
binary_architectures parsed the summary line 'file' prints for a universal
binary. That line only spells out the slices 'file' could reach in its read
buffer and abbreviates the rest, so a large binary is described as
Mach-O universal binary with 2 architectures: [x86_64:Mach-O ...] [arm64e]
and the abbreviated slices were dropped. Reproduced with /usr/lib/dyld, where
the old parser reported 'x86_64' while lipo reports 'x86_64 arm64e'.
The consequence is latent while the pinned Xcode is arm64-only, but a universal
Xcode would be reported as x86_64-only and rejected on an arm64 host with a
misleading "cannot execute natively on arm64" error, blocking provisioning.
Parse the per-architecture lines underneath the summary instead: those are
always complete. Verified against lipo for large and small universal binaries,
arm64-only Xcode bundles, non-Mach-O files and missing files.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
XCODE_VERSION only ever carries a major and a minor version, but the package version carries the patch component too. The repository has shipped exactly that combination three times recently: XCODE_VERSION=26.0 with Xcode_26.0.1.app, 26.1 with Xcode_26.1.1.app, and 26.4 with Xcode_26.4.1.app. install-xcode.sh compared the two normalised versions for exact equality, so '26.4' and '26.4.1' were treated as different Xcode releases and the script refused to run at all. The next patch bump would have failed every job before anything was even downloaded. Compare only the major and minor versions here. The full package version is still matched exactly against the package manifest and against the installed bundle's marketing version, and XCODE_BUILD_VERSION is still matched exactly, so this doesn't weaken what is actually verified. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
Two problems with the command line tools step. The catalog query discarded stderr, but softwareupdate splits its output between both streams, so the label list could be thrown away and the function would always report that it couldn't confirm the label. Capture both streams. The install itself was then unbounded and unchecked. Bounding only the query doesn't help: proving the catalog is reachable doesn't stop a multi-gigabyte download from stalling, and because the install was the last command in the function a failure propagated out through reconcile_xcode and aborted the whole installation under 'set -e'. That contradicts treating the command line tools as an addition to what the Xcode package already provides. Bound the install with the same alarm the query uses, generously enough not to interrupt a legitimately slow install, and log and continue when it doesn't complete. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
tests-stage.yml declares its own build_packages job, which expands build/build.yml and therefore provisions the arm64-only Xcode package, but its pool was missed when the architecture demand was added to the other provisioning jobs. Add the same 'macOS.Architecture -equals arm64' demand so this job can't be scheduled on an Intel agent and fail once provisioning starts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
…rules download-universal-package.sh read the value of every option without checking that one was actually present, so under 'set -u' a trailing valueless flag failed with 'unbound variable' instead of a usage message. Group the value-taking options and check arity the way the sibling wrapper already does. Document the Xcode naming rules in the bump skill as a table. The package version is strict SemVer because Azure Artifacts requires it, while the application name follows this repository's own convention, so the two are deliberately spelled differently: betas drop the dot before the ordinal, release candidates keep it, and the first beta or RC has no ordinal at all. Xcode_26.3.0-rc2.app has been written twice and corrected both times, which is what install-xcode.sh's consistency check exists to catch. Also record that XCODE_VERSION keeps only the major and minor version for a patch release, and that XCODE_BUILD_VERSION is what actually distinguishes one beta or RC from the next. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
rolfbjarne
left a comment
There was a problem hiding this comment.
Sometimes a bot may have the Xcode we want installed, but using a different naming scheme than we expect (say we expect Xcode 26.2 in /Applications/Xcode_26.2.0.app and it's actually in /Applications/Xcode_26.2.app).
I might be wrong, but it doesn't seem like this code handles this situation, and will instead redownload and reinstall Xcode using the expected path, instead of re-using the already installed Xcode.
So an improvement could be to search all /Applications/Xcode*.app (non-symlink) bundles, and use any matching the exact version we're looking for.
A bot often already has exactly the Xcode we want, just not at the path
Make.config names: we pin Xcode_26.2.0.app and the bot has Xcode_26.2.app.
Until now that meant downloading and installing another multi-gigabyte copy of
an Xcode that was already sitting there.
Look for it instead. When the configured path doesn't verify, scan
/Applications for a bundle that passes the same verification the configured
path has to pass -- marketing version, exact product build, bundle identifier,
architecture, minimum macOS and Apple code signature -- and reuse the first
match.
Reuse works by pointing the configured path at the bundle we found. Everything
that reads Make.config then keeps working untouched: this script,
system-dependencies.sh, and plain 'make' in the Windows reservation job, which
never runs ./configure and would otherwise decide Xcode isn't installed at all.
Details worth knowing:
* Candidates are scanned in a stable order, symlinks are skipped, and names
are filtered so a Finder duplicate ("Xcode_26.4.0 2.app") or an unrelated
application can't be picked up. ./configure also rejects paths with spaces.
* A candidate is only reused when its name classifies the same way as the
configured name. Make.config decides XCODE_IS_STABLE from the application
name alone, so adopting a differently-shaped name could publish a preview as
stable, which is the direction Make.config explicitly warns about.
* 'verify' stays read-only: it is the unprivileged probe that decides whether
to download, so only 'reconcile' and 'install' create the symlink.
* If something real already occupies the configured path, we refuse to touch
it and let the normal install replace it, rather than deleting a bundle that
someone else put there.
* 'install' now always targets the literal configured path. It used to
canonicalise first, which meant an install could overwrite a bundle we had
only borrowed through the symlink.
Reported by rolfbjarne.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
This reverts the temporary commit that disabled reuse. It did its job: with reuse off, every agent went through the new code path and it worked. The task fetched artifacttool-osx-arm64 (no Rosetta anywhere), resolved the feed to the DevDiv project, downloaded all 2,318.5 MB of xcode-apple-silicon 26.6.0 in about fifteen seconds, expanded the archive and installed it: Installed Xcode 26.6.0 (17F113) in '/Applications/Xcode_26.6.0.app'. Selected Xcode 26.6.0 (17F113). Roughly three and a half minutes end to end for a cold provision. Reuse is back on, so agents that already have the bundle skip all of it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #3c9246c] Prepare .NET Release succeeded ✅📦 Published NuGet packages (32 packages)iOS
MacCatalyst
macOS
tvOS
Other
Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
Two extractors, where the preferred one compiled an Objective-C file against a
private framework at runtime and the other was the supported tool it fell back
to. Keep only the supported one.
The private path existed on the theory that PackageKit, being what Archive
Utility itself uses, would be better. Measured against the real 2.3 GB archive
it simply isn't:
time entries signature
PackageKit 120s 156,814 valid
xip --expand 113s 156,814 valid
Identical path sets, identical version and build, both bundles pass
'codesign --verify' with the same team identifier. xip is marginally faster and
cannot break when an OS update changes a private interface that we redeclare by
hand.
Dropping it loses nothing on the security side either: the archive's Apple
signature is checked by 'pkgutil --check-signature' before extraction, and the
resulting bundle is checked again afterwards. Neither depends on the extractor.
xip is also a plain binary rather than an xcrun shim, so it still works while
'xcode-select' points at the Xcode we are replacing, which is why it is safe to
rely on as the only path.
Suggested by rolfbjarne.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
The extractor changed, and with reuse on every agent skips the install, so nothing would exercise it. Same trick as last time: turn reuse off, let a full download and install run everywhere, then revert once it is confirmed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
This comment has been minimized.
This comment has been minimized.
This reverts the temporary commit that disabled reuse. With reuse off every agent did a full install, which is what confirms the xip-only extractor: Expanding 'Xcode_26.6_Apple_silicon.xip' on the /Applications volume. Installed Xcode 26.6.0 (17F113) in '/Applications/Xcode_26.6.0.app'. Selected Xcode 26.6.0 (17F113). No trace of the old extractor in the logs, and expanding plus installing took 2m18s against 2m36s for the PackageKit path on the same pipeline yesterday, so the small win measured locally holds on the bots too. Reuse is back on, so agents that already have the bundle skip all of it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
rolfbjarne
left a comment
There was a problem hiding this comment.
Looks good! Just one minor thing (not holding up the review for this): it would be nice if the PR description was accurate with the regards to the current changes in the PR.
|
Thanks! Description rewritten to match what the PR actually does now. What was stale and is now fixed:
I also added a section for the Xcode reuse behaviour, which had no coverage at all, and folded in the measured evidence — the 27/27 reuse rate, the cold-provision numbers from the bots, and the xip-vs-PackageKit comparison. Two limitations I added rather than removed, since they are real and were previously unstated:
|
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #2263842] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 203 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
…rtifacts package instead of Provisionator (#26329) Backport of #26309 to `release/10.0.1xx`. Cherry-picked from `fcc1dffc8417462c562c4b360d2720d5d5f1ef83` with `-x`. See the original PR for the full rationale; this description covers only what the backport had to resolve. # What this does Replaces Provisionator with an immutable **Azure Artifacts Universal Package** (`xcode-apple-silicon`) pinned in `Make.config`, downloaded by the built-in `UniversalPackages@0` task using the pipeline's own build identity, and installed by a repository-owned script that verifies it end to end. No Azure subscription service connection, storage account, SAS token, GitHub PAT, or Provisionator bootstrap is involved any more, and no token is handed to a script. The feed is resolved per organization — `devdiv` → `DevDiv`, `dnceng` → `internal`. # Conflicts resolved Four, all caused by `release/10.0.1xx` being behind `main` on unrelated changes rather than by the backported work itself. **`tools/devops/automation/templates/common/provision.yml`** and **`tools/devops/provision-shared.in.csx`** — modify/delete. Both are deleted by this change. The branch's only divergence in them was that it lacked two `main`-only fixes (a `retryCountOnTaskFailure` on the SAS-token task, and a `try`/`catch` around `ListXcodes`), and both files disappear entirely, so the deletions were taken. **`.gitignore`** — the branch still carries `bcl-test-importer` and the bcl-test entries that `main` has since dropped. Kept the branch's entries and applied only this change's deletion of `provisionator.msbuild.props`. **`tools/devops/Makefile`** — this one mattered. `main` has migrated `LocProject.json` to `generate-loc-project.sh`, which **does not exist on this branch**, so taking `main`'s side would have broken `make` in `tools/devops`. Kept the branch's existing `LocProject.json.in` rule and removed only the `provision-shared.csx` rule and the `provisioning:` target. # Verification - The three files this change owns outright — `install-xcode.sh`, `resolve-xcode-package.sh` and `provision-xcode.yml` — are **byte-identical to `main`**. - **The backport introduces no new divergence from `main`.** For all nine files that still differ, the difference is exactly the divergence that already existed between the branches before the cherry-pick, compared content-line by content-line. - No dangling references remain to any removed file or variable (`provision.yml`, `provisionator-bootstrap.sh`, `provision-shared`, the `.csx` scripts, `provisionatorChannel`, `PROVISIONATOR_CHANNEL`, `ensure-xcode-select.sh`). - Template parameter contracts check out: every parameter supplied at the three `provision-xcode.yml` call sites is declared, and every `${{ parameters.* }}` reference resolves. - Gates pass: `shellcheck` 0.10.0 **and** 0.11.0, `yamllint` (both the config and GitHub-Actions forms), `bash -n` on every changed script, and `tools/devops/Makefile` still parses. - Smoke-tested on this branch: `Make.config` resolves `XCODE_PACKAGE_VERSION=26.6.0`, `XCODE_BUILD_VERSION=17F113` and derives `XCODE_IS_STABLE=true`; `install-xcode.sh verify` runs; the resolver still maps `devdiv` → `DevDiv` and `dnceng` → `internal`. The Xcode pinned here is the same as on `main` (`26.6` / `26.6.0` / `17F113`), so no coordinate adaptation was needed. # Worth watching in CI `--provision-xcode` clears `IGNORE_XCODE`, so `check_xcode` now runs end to end on build bots. That newly enables the `iPhoneSimulator`/`MacOSX`/`AppleTVOS` SDK assertions on the build stage, which means **a stale `*_NUGET_OS_VERSION` in `Make.versions` will fail the build stage rather than only the tests**. Relevant here because this branch tracks a different set of .NET 10 package versions than `main`. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e134d13d-5eee-4266-ba75-24422addd02b
Summary
CI gets Xcode from Provisionator today. That requires minting two read-only SAS tokens for the
bosstoragemirrorstorage account through an Azure service connection, bootstrapping the Provisionator binary from that same account, and trusting whatever bundle comes back — nothing checks that the installed Xcode is the oneMake.configasks for.This replaces that with an immutable Azure Artifacts Universal Package (
xcode-apple-silicon) pinned inMake.config, downloaded by the built-inUniversalPackages@0task using the pipeline's own build identity, and installed by a repository-owned script that verifies it end to end.No Azure subscription service connection, storage account, SAS token, GitHub PAT, or Provisionator bootstrap is involved any more, and no token is handed to a script.
Why
xcode-apple-silicon26.6.0, build17F113) that is verified againstMake.configinstead of an opaque.xipbehind a mutable URL.allowSharedKeyAccess=false, short-lived user-delegation SAS tokens,azon the agent, and the Provisionator channel. All of that is gone.How Xcode is provisioned now
templates/common/provision-xcode.ymlreplacestemplates/common/provision.yml:Make.config, work out which project hosts the feed, and runinstall-xcode.sh verify. If the agent already has that exact Xcode, the download is skipped entirely.UniversalPackages@0fetches the package from the feed in the organization the build is running in. The task authenticates as the build identity throughSYSTEMVSSCONNECTION, so no token is mapped into any step.system-dependencies.sh, which hands the package toinstall-xcode.shand then provisions Xcode components, simulators and build tools.condition: always().install-xcode.shvalidates the package manifest (schema, size, SHA-256, Apple XIP signature), expands it withxip --expand, and checks the resulting bundle's identifier, marketing version, product build, host architecture, minimum macOS version and Apple code signature before anything privileged happens. It installs atomically with backup/rollback, then reconcilesxcode-select, the/Applications/Xcode.appsymlink, the Xamarin/MAUIAppleSdkRootsettings, the licence and first-launch state.Trust is anchored in Apple's own signature and in the immutability of the feed version — not in the manifest that ships inside the package (which an attacker who could alter the payload could also alter).
Reusing an Xcode that is already installed
Bots frequently already have the Xcode we want, under a different name: we pin
/Applications/Xcode_26.6.0.appand the bot has/Applications/Xcode_26.6.app. Before this, every agent downloaded and installed a multi-gigabyte Xcode that was already sitting on its disk.When the configured path doesn't verify,
install-xcode.shnow scans/Applicationsfor a bundle that passes the same verification the configured path has to pass, and reuses the first match by symlinking the configured path at it. Everything that readsMake.configthen keeps working untouched — this script,system-dependencies.sh, and plainmakein the Windows reservation job, which never runs./configure.Guards, since this writes into a shared bot:
Make.configderivesXCODE_IS_STABLEfrom the application name alone, so adopting a differently-shaped name could publish a preview as stable.Xcode_26.4.0 2.app) or an unrelated application can't win; symlinks are skipped; candidates are scanned in a stable order.verifystays strictly read-only — it is the unprivileged probe that decides whether to download — so onlyreconcileandinstallcreate the symlink.In practice 27 of 27 agents in a test run skipped the download.
Feed resolution: DevDiv and dnceng
The feed name and package name are identical in both organizations; only the organization and the project that hosts the feed differ:
https://devdiv.visualstudio.com/DevDiv/_artifacts/feed/macios-tools-internal/UPack/xcode-apple-silicon/https://dnceng.visualstudio.com/internal/_artifacts/feed/macios-tools-internal/UPack/xcode-apple-silicon/resolve-xcode-package.shtakes the organization fromSYSTEM_COLLECTIONURIand maps it to the project that owns the feed —devdiv→DevDiv,dnceng→internal— and publishes the result for the download task. Both the legacy<org>.visualstudio.comand moderndev.azure.com/<org>forms are accepted and normalised to one canonical endpoint per organization, so the result never depends on which form the agent happens to report.Deriving the project from an explicit mapping rather than from
System.TeamProjectkeeps the feed address independent of where the pipeline itself runs, and turns an unsupported organization into an actionable error instead of a confusing 404. The mapping is a default, not a policy:--organization,--projectand--feedall override it, so another organization can be onboarded without touching the script.Note that "dnceng" means the
internalproject.dnceng/publichas no such feed and no access to it.What this removes
templates/common/provision.yml(SAS minting + Provisionator bootstrap)scripts/provisionator-bootstrap.shbuild-provisioning.csx,provision-xcode.csx,provision-brew-packages.csx,provision-shared.in.csx, and theprovisioningmake target that generatedprovision-shared.csxprovisionatorChannelparameter andPROVISIONATOR_CHANNELvariable, threaded through every entry pipelineensure-xcode-select.sh— it hard-failed when/Applications/Xcode.appwas missing, which blocked the installer that repairs exactly that stateXamarin - RelEng (BosStorageMirror-Contributor-MI)service connection from the macOS jobsXCODE_URLstays inMake.configbecause local provisioning has no access to the internal feed. CI no longer reads it, and refuses to fall back to it under Azure Pipelines so the dependency can't quietly come back.Behaviour changes worth reviewing
system-dependencies.shwith a different set of flags. They're now a single call that always passes--provision-xcode, so selection, theXcode.appsymlink,AppleSdkRootand first-launch state are reconciled. That matters for the Windows reservation job, which deletes those settings immediately beforehand and previously never had them rewritten.shellcheck,yamllintandp7zipmove from the Provisionator brew step to--provision-shellcheck --provision-yamllint --provision-7z, which run the samebrew installcommands.azure-cliis dropped — it existed for the SAS generation this PR removes, and the only remaining macOS consumer ofaz(windows/generate-token.yml) installs it itself viaazure-tools/az-client-update.yml@yaml-templates, before provisioning runs. It never depended on the brew-installed copy.provisionXcodeComponentsparameter.macOS.Architecture -equals arm64demand so an Intel agent is never scheduled, rather than failing once provisioning starts. The macOS test legs are unaffected — they never provision Xcode, so the x64 Sonoma leg keeps running on x64.check_xcodenow runs end to end on build bots for the first time.--ignore-allpreviously leftIGNORE_XCODE=1;--provision-xcodenow clears it. That newly enablesinstall_coresimulatorand theiPhoneSimulator/MacOSX/AppleTVOSSDK assertions on the build stage. Those SDKs ship inside the bundle, but a stale*_NUGET_OS_VERSIONinMake.versionswill now fail the build stage rather than only the tests.Security posture
The old path used a short-lived, read-only, container-scoped SAS from a dedicated managed identity. The new path uses the pipeline's own build identity against a project-scoped feed, handled entirely by the
UniversalPackages@0task.That identity was already exposed to PR-controlled steps on the untrusted macOS pool before this PR (
build/build.yml,mac/build.yml,common/setup.ymlall mapSystem.AccessToken), so this doesn't create the exposure — but it does mean the token now also confers feed read access.Secret handling was reviewed specifically:
SYSTEM_ACCESSTOKENis no longer mapped into any step of this template; the task usesSYSTEMVSSCONNECTIONitself.set -x.Prerequisites in Azure DevOps (not fixable in this repo)
macios-tools-internalfeeds have no upstream sources. The Build Service holds the AzDO-default Feed and Upstream Reader (Collaborator) role, which cannot publish — but it can save packages from an upstream, and an upstream that also servesxcode-apple-siliconwould be the one route to shadowing the package.At the time of writing, both feeds exist and contain
xcode-apple-silicon26.6.0, and neither has retention enabled.Reviewing this PR
Commits 1–7 are the original port, ordered so they can be read in sequence with no file split across commits:
Make.configcoordinates plusinstall-xcode.sh. Nothing calls them yet.system-dependencies.shchanges.Commits 8–21 came out of CI and review. The ones that change the design rather than fix a detail:
osx-arm64build. Superseded by 16, which removes our copy of that logic entirely.UniversalPackages@0task instead of driving ArtifactTool ourselves. Deletesdownload-universal-package.sh;download-xcode-package.shbecomesresolve-xcode-package.shsince it no longer downloads.xip --expand, deletingpackagekit-extract.mand the runtimeclanginvocation.Commits 17/18 and 20/21 are paired: each temporarily disables Xcode reuse so CI actually exercises the download-and-install path, then restores it once confirmed. They cancel out and can be read as no-ops.
Validation
shellcheck(0.10.0 and 0.11.0) andyamllintgates fortools/devopspass;bash -nclean on every changed script.origin/mainbaseline forsystem-dependencies.sh(two pre-existing warnings were removed).origin/mainbaseline.--project/--feedoverrides.install-xcode.shexercised locally:verifysuccess and failure paths, theMake.configdrift assertion, version/app-name derivation against the realXcode_26.4.0,26.5.0and27.0.0-beta4bundles, and the reuse logic including both misclassification directions, the name filter, the symlink skip and all three adopt branches.Xcode_26.4.0.apptoXcode_26.4.appand confirming discovery found it without mutating anything.artifacttool-osx-arm64, resolvedfeed macios-tools-internal, project DevDiv, pulled 2,318.5 MB in ~15s, thenInstalled Xcode 26.6.0 (17F113)andSelected Xcode 26.6.0 (17F113). ~3.5 min for a cold provision.xip --expandcompared against the previous PackageKit extractor on the real 2.3 GB archive: 113s vs 120s, 156,814 identical paths, same version and build, both bundles passcodesign --verifywith the same team identifier. On the pipeline, expand-plus-install measured 2m18s against 2m36s.26.6.1, unrelated labels).Known limitations
softwareupdatecannot report failure. It exits0for an unknown label, an invalid flag and a failed query, and can hang when the update service is unreachable. Command Line Tools installation is therefore best-effort: the catalog query is bounded with a timeout and decided from its contents, and the log says "could not confirm" rather than claiming Apple doesn't offer the label, because a reachable-but-empty catalog is genuinely indistinguishable from a failed query./Applications/Xcode_<version>.appis a symlink to something that fails verification will reinstall Xcode, because the installer requires a real bundle at the target.install-xcode.shrefuses to replace a real directory at/Applications/Xcode.app; it only manages that path as a symlink.Rollback
Revert the whole range. Commits 5 and 6 are the behavioural switch; 1–4 are inert without them.