sentry-netlify-build-plugin
sentry-netlify-build-plugin copied to clipboard
Gitlab - SentryCLI failed to set commits
When using this plugin with a Gitlab integration, we run in to the following error:
12:51:09 PM: cmd: '/opt/buildhome/.netlify-build-plugins/node_modules/@sentry/cli/sentry-cli releases set-commits ac28e1c49ac9312242e09696c2046c53c3926835 --commit theworkshop/web-app@ac28e1c49ac9312242e09696c2046c53c3926835'
12:51:09 PM: }
12:51:09 PM:
12:51:09 PM: ┌──────────────────────────────────────────────┐
12:51:09 PM: │ Plugin "@sentry/netlify-build-plugin" failed │
12:51:09 PM: └──────────────────────────────────────────────┘
12:51:09 PM:
12:51:09 PM: Error message
12:51:09 PM: Error: SentryCLI failed to set commits. You likely need to set up a repository or repository integration.
12:51:09 PM: Read more: https://docs.sentry.io/workflow/releases/?platform=python#install-repo-integration
When running the command locally to replicate the issue, we get a bit more information around why this is failing:
$ sentry-cli releases set-commits ac28e1c49ac9312242e09696c2046c53c3926835 --commit theworkshop/web-app@ac28e1c49ac9312242e09696c2046c53c3926835
error: Unknown repo 'theworkshop/web-app'
The error we're running into seems to be due to how whitespace is handled in the repository name with the Gitlab integration
Modifying the command locally to the following fixes the issue:
$ sentry-cli releases set-commits ac28e1c49ac9312242e09696c2046c53c3926835 --commit theworkshop\ /\ web-app@ac28e1c49ac9312242e09696c2046c53c3926835
It should also probably be documented somewhere that the what Sentry uses as 'name' is actually configurable on Gitlab - i.e. if a user has modified their repo name with Gitlab, then this script won't work as this script actually uses the repo 'slug' rather than name for matching.