Hello,
Has anyone used Sentry with Xcode Cloud? How are you uploading dSYM files? One way is fastlane but Xcode Cloud doesn't come with Fastlane preinstalled, the other is sentry-cli but the same issue, it's not preinstalled.
Hello,
Has anyone used Sentry with Xcode Cloud? How are you uploading dSYM files? One way is fastlane but Xcode Cloud doesn't come with Fastlane preinstalled, the other is sentry-cli but the same issue, it's not preinstalled.
Same here.
You're able to install and run sentry-cli from inside the post-xcodebuild script. This was working for me (you can define the SENTRY_AUTH_TOKEN as an environment value in the workflow):
ci_scripts/ci_post_xcodebuild.sh
#!/bin/sh
set -e
# This is necessary in order to have sentry-cli
# install locally into the current directory
export INSTALL_DIR=$PWD
if [[ $(command -v sentry-cli) == "" ]]; then
echo "Installing Sentry CLI"
curl -sL https://sentry.io/get-cli/ | bash
fi
echo "Uploading dSYM to Sentry"
sentry-cli --auth-token $SENTRY_AUTH_TOKEN \
upload-dif --org 'organization-name' \
--project 'project-name' \
$CI_ARCHIVE_PATH
Summary
In case it can help someone, here my solution.
Our team uses a "self-hosted" Sentry instance, so I had to provide the URL to sentry-cli
.
Instead of passing the parameters directly as arguments to the binary, I used the Environment Variable panel in XCode Cloud.
SENTRY_URL
, SENTRY_ORG
, SENTRY_PROJECT
, SENTRY_AUTH_TOKEN
.
The advantage is that your variables do not appear in the script, and also you can set the SENTRY_AUTH_TOKEN
as secret.
Another advantage of XCode Cloud is that you can use Homebrew to install dependencies. See documentation.
Scripts
ci_scripts/ci_post_clone.sh
#!/bin/sh
brew install getsentry/tools/sentry-cli
ci_scripts/ci_post_xcodebuild.sh
#!/bin/sh
if which sentry-cli >/dev/null; then
ERROR=$(sentry-cli upload-dif --include-sources "$CI_ARCHIVE_PATH/dSYMs" 2>&1 >/dev/null)
if [ ! $? -eq 0 ]; then
echo "warning: sentry-cli - $ERROR"
fi
else
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
fi
It seems that sentry-cli has changed since the previous responses were made.
Here's the ci_scripts/ci_post_xcodebuild.sh
that worked for me:
set -e
if [ ! -d "$CI_ARCHIVE_PATH" ]; then
echo "Archive does not exist, skipping Sentry upload"
exit 0
fi
# This is necessary in order to have sentry-cli
# install locally into the current directory
export INSTALL_DIR=$PWD
if [[ $(command -v sentry-cli) == "" ]]; then
echo "Installing Sentry CLI"
curl -sL https://sentry.io/get-cli/ | bash
fi
echo "Authenticate to Sentry"
sentry-cli login --auth-token $SENTRY_AUTH_TOKEN
echo "Uploading dSYM to Sentry"
sentry-cli debug-files upload -o <org> -p <project> $CI_ARCHIVE_PATH
Now, if I've got a companion Apple Watch app, can I prevent another download of the Sentry package and prevent those symbols from being uploaded?