Xcode Cloud randomly fails to resolve package dependencies

Hi folks,

I've been having this issue for the last few months, where Xcode Cloud fails to resolve Swift package dependencies while compiling my builds, seemingly at random.

Some of my Xcode Cloud builds will fail after several minutes, with an error log looking like that :

xcodebuild: error: Could not resolve package dependencies:   failed downloading 'https://dl.google.com/firebase/ios/bin/grpc/1.62.2/rc0/grpcpp.zip' which is required by binary target 'grpcpp': downloadError("The request timed out.")

Whenever this happens, I have to manually restart an Xcode Cloud build process (or several builds, since the error can happen multiple times in a row), to the point it's becoming increasingly painful to rely on Xcode Cloud for my workflow.

The failing packages are mostly random (meaning, it's not always the same one that Xcode fails to resolve), but they are always publicly accessible, even though I have an environment variable set in my Xcode workflows to retrieve a single Github private dependency (maybe this has some kind of importance).

Could anyone tell me if this is an isolated issue, or if I could do anything on my end to resolve this ?

Thank you !

We are experiencing the same. Random failures. We don't have any private dependencies.

Not much help here, but I've been seeing this intermittently over the last few months also. I only have a handful of public (no private) package dependencies.

EDIT: In fact, I just hit it on the next build after posting this!

      xcodebuild: error: Could not resolve package dependencies:   failed downloading 'https://github.com/realm/SwiftLint/releases/download/0.57.0/SwiftLintBinary-macos.artifactbundle.zip' which is required by binary target 'SwiftLintBinary': downloadError("The request timed out.")   fatalError

just to add that I don't recall seeing this before, but saw it twice yesterday. No private repos here, just common popular SPMs.

This has been plaguing our team for the past few weeks with an increase in the last week especially. The public URLs are always accessible when I open them on a brwoser.

Between this and the iOS 18 / Xcode 16 bump, our Xcode Cloud credits are taking a hit.

2024-12-13T11:35:24.664928084Z	Downloading binary artifact https://download.newrelic.com/ios_agent/NewRelic_XCFramework_Agent_7.5.2.zip
2024-12-13T11:35:24.665051860Z	Downloaded https://download.newrelic.com/ios_agent/NewRelic_XCFramework_Agent_7.5.2.zip (4.35s)
2024-12-13T11:35:24.665146833Z	Downloading binary artifact https://software.mobile.pendo.io/artifactory/ios-sdk-release/3.5.0.8949/pendo-ios-sdk-xcframework.3.5.0.8949.zip
2024-12-13T11:35:24.665267979Z	error: failed downloading 'https://software.mobile.pendo.io/artifactory/ios-sdk-release/3.5.0.8949/pendo-ios-sdk-xcframework.3.5.0.8949.zip' which is required by binary target 'Pendo': downloadError("The request timed out.")

This issue has been occurring for my team for months, typically from a private Reposilite instance for hosting some private packages, but occasionally other public packages as well. The Reposilite server is used by several teams with different build systems, and Xcode Cloud is the only one failing randomly like this. After much investigation where we whitelisted all Xcode Cloud IPs, added additional logging to the server, etc. all to no effect, I eventually found that I can resolve packages in the ci_post_clone.sh script, which ends up putting them in a cache that the later build step can find. I now do this in a retry loop, with redoing it 5 times with a small delay in between each attempt. This usually works, but we still get cases where it'll fail even that - once every couple of weeks or so. Rebuilding lets it work again.

Below is the relevant snippet from my ci_post_clone.sh script:

#!/bin/sh

function fail {
  echo $1 >&2
  exit 1
}

function retry {
  local n=1
  local max=5
  local delay=15
  while true; do
    "$@" && break || {
      if [[ $n -lt $max ]]; then
        ((n++))
        echo "Command failed. Attempt $n/$max:"
        sleep $delay;
      else
        fail "The command has failed after $n attempts."
      fi
    }
  done
}

echo "Pre-resolving packages"
retry swift package resolve

Xcode Cloud randomly fails to resolve package dependencies
 
 
Q