Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround flaky SSL connection installing Android SDKs #3904

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented Jan 17, 2025

In our GitHub Actions we're trying to install the android sdks by running:

dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/"

This command often fails to download the necessary dependencies due to SSL certificate errors:

/Users/runner/.dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.145/tools/Xamarin.Installer.Common.targets(12,3): error : Failed to download Xamarin Repository manifest from https://aka.ms/AndroidManifestFeed/d17-12. System.AggregateException: One or more errors occurred. (The SSL connection could not be established, see inner exception.) [/Users/runner/work/sentry-dotnet/sentry-dotnet/src/Sentry/Sentry.csproj::TargetFramework=net8.0-android34.0]

When this happens, we have to manually rerun the job, which is painful.

This PR simply retries that command once, if it fails the first time... so some basic resilience.

#skip-changelog

@jamescrosswell jamescrosswell marked this pull request as ready for review January 19, 2025 20:41
@jamescrosswell jamescrosswell requested a review from vaind January 19, 2025 20:41
Comment on lines 222 to +232
- name: Install Android SDKs
id: installandroidsdks
continue-on-error: true
if: runner.os == 'macOS'
run: |
dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/"

- name: Install Android SDKs (retry)
if: steps.installandroidsdks.outcome=='failure' && runner.os == 'macOS'
run: |
dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, something like this could also work:

Suggested change
- name: Install Android SDKs
id: installandroidsdks
continue-on-error: true
if: runner.os == 'macOS'
run: |
dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/"
- name: Install Android SDKs (retry)
if: steps.installandroidsdks.outcome=='failure' && runner.os == 'macOS'
run: |
dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/"
- name: Install Android SDKs
if: runner.os == 'macOS'
run: |
s='dotnet build src/Sentry/Sentry.csproj -t:InstallAndroidDependencies -f:net8.0-android34.0 -p:AcceptAndroidSDKLicenses=True -p:AndroidSdkPath="/usr/local/lib/android/sdk/"'
eval $s || eval $s

@jamescrosswell jamescrosswell merged commit b22155f into main Jan 20, 2025
23 checks passed
@jamescrosswell jamescrosswell deleted the retry-install-android-sdks branch January 20, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants