getsentry / sentry-react-native

Official Sentry SDK for React-Native
https://sentry.io
MIT License
1.56k stars 330 forks source link

Release Commits not being automatically assscoiated #3443

Open daniel-johns-99 opened 8 months ago

daniel-johns-99 commented 8 months ago

OS:

Platform:

SDK:

SDK version: 5.13.0

react-native version: 0.67.0

Are you using Expo?

Are you using sentry.io or on-premise?

I'm unsure if this is a feature request or a bug.

However I expect that by using the built in Gradle job and the xcode Script, Sentry would automatically create my new releases and associate commits.

On iOS I am achieving this by passing the export AUTO_RELEASE=true # Automatically detect release from Xcode project Value and on Android this is by default.

Whilst the releases are created and sourcemap and debug symbols are successfully associated with this release I am not seeing any commit data associated. Based on the documentation here: https://docs.sentry.io/product/releases/setup/#3-associate-commits I would expect this to happen as I am using the release automation options.

If the React native cli is not doing that automatically, I feel like I would need to run sentry-cli releases set-commits --auto $VERSION however I am not sure which VERSION to pass as Sentry is currently automatically doing this.

krystofwoldrich commented 8 months ago

Hi, thank you for the message, the release flag for Xcode only changes if the uploaded source maps get associated with the release or use debug ID only.

The Gradle job and Xcode scripts do not currently associate commits to a release.

If you are interested in getting Suspect commits in your issues, this feature works also with our GH integration without calling sentry-cli releases set-commits.

Here is how Gradle creates the automatic release https://github.com/getsentry/sentry-react-native/blob/c0f481c66d41266c1b2d72a571f1e7bab68d747e/sentry.gradle#L309-L310

Here is how Xcode scripts create it https://github.com/getsentry/sentry-cli/blob/0b42f7994ced115367e8647966ff33faf3a28414/src/commands/react_native/xcode.rs#L375-L380

You can recreate the same before you call set-commits.

daniel-johns-99 commented 8 months ago

Thanks @krystofwoldrich Got it, I still think it would be a valuable feature to have a option for the CLI/Gradle job to automatically call set-commits to avoid having to edit the out of the box scripts?

One further query I had with this was calling sentry-cli releases set-commits --auto $VERSION mentions that it will resolve the head commit and the previous releases head commit (https://docs.sentry.io/product/releases/associate-commits/?original_referrer=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-react-native%2Fissues%2F3443#using-the-cli)[here]

Do you know how it determines what is defined as the previous release? For React-Native, both Android & iOS requires separate releases in Sentry for symboclation, but its running in the same project. I wouldn't want the previous release of Android to be the head commit of the iOS release. Is there logic to actually read the package off the Release to determine this, as it would be quite specific to React Native I am unsure.

krystofwoldrich commented 8 months ago

@daniel-johns-99 Yes, we agree and add the request to our backlog.

The CLI takes the last commit of the latest release with commits in the project in Sentry.

So which ever Android or iOS would be later will be taken.

Side note: You can have one release of your RN app for both Android and iOS versions.