Skip to main content

Why do I always see 20 commits applied to my release?

Issue

When I associate commits to my release, I always get the last 20 commits pulled instead of just the ones that are relevant to this specific release.

Applies To

  • Users of sentry-cli set-commits

  • Users of any of the bundler plugins with the setCommits option

  • Any other Sentry integration that manages releases

Resolution

When the set-commits command is run, Sentry will first look for the most recent earlier release (by timestamp) in the same project(s) that has associated commits. If no earlier release with commits exists, then the default last 20 will be grabbed.

To ensure you have the correct commits associated, the set-commits command should be run every time for all releases. To specify the correct commit ranges for your release, use the following command:

sentry-cli releases set-commits "$RELEASE" \
  --commit "REPO_OWNER/REPO_NAME@$BASE_SHA..$COMMIT_SHA"

Example:

  1. Define the baseline and latest commits:

       PREV_SHA=<baseline from prior release>
       LATEST_SHA=<current release commit>
  2. Use the sentry-cli command to set the commit range:

   sentry-cli releases set-commits "$RELEASE" \
     --commit "REPO_OWNER/REPO_NAME@$PREV_SHA..$LATEST_SHA"

Ensure that the repository identifier (REPO_OWNER/REPO_NAME) is correct and consistent across all releases.

Troubleshooting Common Issues

If you encounter problems with commit data, follow these steps:

  1. Verify Repository Identifier: Ensure the correct repository identifier is used in the --commit argument.

  2. Use Explicit Ranges: Always specify both BASE_SHA and COMMIT_SHA explicitly for each release.

  3. Consistency Across Releases: Use the same BASE_SHA and COMMIT_SHA for all operating systems and environments derived from the same build. By following these steps, Sentry will process the commit data correctly, ensuring consistent information across all releases.

Did this answer your question?