Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to set release ID for SDK when deployments are done via CI #5457

Answered by AbhiPrasad
grug asked this question in Q&A
Discussion options

Hi there,

I'd like to set up release health with the Sentry SDK (React, not using create-react-app). As part of that, we need to set release when we init the SDK in our application.

However, we set the release using the Sentry CLI tool in our CI pipelines, i.e.

curl -sL https://sentry.io/get-cli/ | bash
 export SENTRY_RELEASE=$(sentry-cli releases propose-version)
 sentry-cli releases new -p $SENTRY_PROJECT $SENTRY_RELEASE
 sentry-cli releases set-commits $SENTRY_RELEASE --auto
 sentry-cli releases files $SENTRY_RELEASE 
 sentry-cli releases finalize $SENTRY_RELEASE
 sentry-cli releases deploys $SENTRY_RELEASE new -e production

Since we're setting the release in our CI pipelines, there's no way to feed the version back into the project.

Is there a recommended pattern for achieving this?

You must be logged in to vote

We recommend injecting the variable using your bundler. For example, see how it's done with webpack: https://webpack.js.org/guides/environment-variables/

Replies: 1 comment 1 reply

Comment options

We recommend injecting the variable using your bundler. For example, see how it's done with webpack: https://webpack.js.org/guides/environment-variables/

You must be logged in to vote
1 reply
Comment options

This makes sense. I didn't realise that sentry-cli releases propose-version was deterministic as it uses the most recent commit.

Answer selected by grug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /