xcodecontinuous-integrationxcode-cloud

Xcode Cloud build variable CI_WORKSPACE is empty


My Xcode Cloud builds of my Flutter app all of a sudden started failing, without me making any intended changes to it.

Following is my ci_post_clone.sh script.

echo "Starting CI script..."

echo $CI_WORKSPACE

# The default execution directory of this script is the ci_scripts directory.
cd $CI_WORKSPACE # change working directory to the root of your cloned repo.

ls

# Install Flutter using git.
git clone https://github.com/flutter/flutter.git --depth 1 -b stable $HOME/flutter
export PATH="$PATH:$HOME/flutter/bin"

# Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms.
flutter precache --ios

# Install Flutter dependencies.
flutter pub get

# Install CocoaPods using Homebrew.
HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates.
brew install cocoapods

cd ios && pod install # run `pod install` in the `ios` directory.

flutter build ios

The line in echo $CI_WORKSPACE just logs an empty line, so it seems this variable is not set/empty. Therefore the following commands cannot be executed.

However, I don't understand why this variable is empty? How is CI_WORKSPACE set and how can I fix it so it has the location of the cloned repo again?


Solution

  • Unfortunately, it seems removed now. :( I think it would be better use CI_PRIMARY_REPOSITORY_PATH instead of CI_WORKSPACE https://developer.apple.com/documentation/xcode/environment-variable-reference