Skip to content

Commit a45876f

Browse files
DanielMcAsseyDaniel McAsseyjamescrosswell
authored
fix: Allow Sentry failures when SENTRY_ALLOW_FAILURE is set in the Sentry CLI (#4852)
* fix(targets): fix #4849 by adding support for SENTRY_ALLOW_FAILURE * fix(targets): add allow failure in propose-version * ref(targets): tweak target check based on review * fix(targets): fix allow failure check correctly * Update CHANGELOG with new features and fixes Added a section for fixes and documented a new feature and dependency update. --------- Co-authored-by: Daniel McAssey <dmcassey@jigsawcreate.com> Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
1 parent dd7e96d commit a45876f

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Fixes
1010

11+
- Allow Sentry failures from the Sentry CLI when SENTRY_ALLOW_FAILURE is set ([#4852](https://github.com/getsentry/sentry-dotnet/pull/4852))
1112
- The SDK now logs a specific error message when envelopes are rejected due to size limits (HTTP 413) ([#4863](https://github.com/getsentry/sentry-dotnet/pull/4863))
1213
- Fixed thread-safety issue on Android when multiple events are captured concurrently ([#4814](https://github.com/getsentry/sentry-dotnet/pull/4814))
1314

src/Sentry/buildTransitive/Sentry.targets

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<PropertyGroup>
2020
<SentryAttributesFile>Sentry.Attributes$(MSBuildProjectExtension.Replace('proj', ''))</SentryAttributesFile>
2121
<SentryProGuardUUID Condition="'$(SentryProGuardUUID)' == ''">$([System.Guid]::NewGuid())</SentryProGuardUUID>
22+
<SentryAllowFailure Condition="'$(SENTRY_ALLOW_FAILURE)' == 'true'">true</SentryAllowFailure>
2223
</PropertyGroup>
2324

2425
<Target Name="_SentryEnsureAndroidEnableAssemblyCompressionDisabled"
@@ -360,7 +361,9 @@
360361
</SentryGetApplicationVersion>
361362

362363
<Exec ConsoleToMSBuild="true" Condition="'$(_SentryRelease)' == ''"
363-
Command="sentry-cli releases propose-version">
364+
Command="sentry-cli releases propose-version"
365+
IgnoreExitCode="$(SentryAllowFailure)"
366+
ContinueOnError="$(SentryAllowFailure)">
364367
<Output TaskParameter="ConsoleOutput" PropertyName="_SentryRelease"/>
365368
</Exec>
366369

@@ -369,7 +372,7 @@
369372

370373
<!-- Set release information after the build -->
371374
<Target Name="_CreateSentryRelease" AfterTargets="Build" DependsOnTargets="_GetSentryRelease"
372-
Condition="'$(SentryCLI)' != '' and '$(SentryCreateRelease)' == 'true'">
375+
Condition="'$(SentryCLI)' != '' and '$(SentryCreateRelease)' == 'true' and '$(_SentryRelease)' != ''">
373376
<Message Importance="High" Text="Creating Sentry Release: $(_SentryRelease)" />
374377
<Exec
375378
Command="$(SentryCLIBaseCommand) releases new $(_SentryRelease) $(SentryReleaseOptions)"
@@ -380,7 +383,7 @@
380383

381384
<!-- Send commit details to Sentry -->
382385
<Target Name="_SentrySetCommits" AfterTargets="Build" DependsOnTargets="_CreateSentryRelease"
383-
Condition="'$(SentryCLI)' != '' and '$(SentrySetCommits)' == 'true'">
386+
Condition="'$(SentryCLI)' != '' and '$(SentrySetCommits)' == 'true' and '$(_SentryRelease)' != ''">
384387
<Message Importance="High" Text="Setting Sentry commits" />
385388
<Exec
386389
Command="$(SentryCLIBaseCommand) releases set-commits $(SentrySetCommitOptions) $(_SentryRelease) $(SentrySetCommitReleaseOptions)"

0 commit comments

Comments
 (0)