-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: Couldn’t not find the SHA of the previous release in the git history. #792
Comments
edit: My bad, it's an actual release name and it should be there. If you squash or rebase git history, then as you already mentioned there's a chance that hashes will be overridden, and we won't be able to find old release reference. If you cannot change that, then you'll most likely have to explicitly tell the CLI which hash is the one that you want to use as the base, eg.
|
@kamilogorek your advice is certainly helpful, but the first thing you mention is that Is the example wrong, or does the auto flag actually accept a value? I see competing examples here. If this wasn't the official documentation I wouldn't be concerned, but others might be led astray here if an inconsistency exists. |
@vinnymac good catch, updated my comment. I misread the command 😅 Thanks! |
@kamilogorek @sgametrio Actually I believe VERSION=$(sentry_cli releases propose-version)
sentry_cli releases new -p "$sentry_prj" "$VERSION"
sentry_cli releases set-commits --auto "$VERSION" || {
PRV_VERSION=`curl -sS \
-H "Authorization: Bearer $SENTRY_AUTH_TOKEN" \
"$sentry_base_url/organizations/$sentry_org/releases/$VERSION/previous-with-commits/" \
| jq -r .version`
sentry_cli releases delete "$PRV_VERSION"
sentry_cli releases set-commits --auto "$VERSION"
} We can discuss the issue if you feel like it.
This seems reasonable, but in practice seems useless, unless you do it by hand in your local repository. Sorry for being blunt. Where will I find the now non-existent commits on a CI server to determine the base commit? In the reflog? And actually I have a number of questions for which I don't expect to receive answers. Except for possibly here? Anyways, I'm open for suggestions. The first one is that I'm reluctant to install the GitHub application. Judging from the wording it seems like once I do, I can never go back. Then you suggest using cli over api. Why is that? You say that releases are global per organization. Is using commit hashes safe? The documentation makes one think one should do something different if one doesn't want to install the GitHub application. But from I can see, the difference only in the result (more info on Sentry probably). |
Is there any progress here? The set-commits command is failing here, but we haven't done a squash or a rebase. Is there any possibility to get around this problem? Because right now the only way to exit this loop hole is to completely disable set-commits command, right? Or is it possible to say "use auto, but if you don't find something, just take the last commit in history"? |
I ran in to this issue on our CI system. It boiled down to that it only fetched a shallow copy of the git repo. Hope this can help someone. |
@karatekaneen did you found a way to fetch without unshallowing? This make a bottleneck in our CI. Would be nice if we shallow fetch only needed commits for sentry-cli EDIT: I found a way to it with help of bash and sentry-ci: LAST_RELEASE=$(sentry-cli releases list | sed -n 6p | tr '|' '\n' | sed -n 3p | tr -d '[:space:]')
LAST_RELEASE_DATE=$(sentry-cli releases info $LAST_RELEASE | sed -n 5p | tr '|' '\n' | sed -n 3p | sed 's/^[ \t]*//;s/[ \t]*$//' | tr ' ' '\n' | sed -n 1p)
git fetch --shallow-since=$LAST_RELEASE_DATE EDIT 2: If some1 name releases with COUNT=30; cc=$COUNT; while [[ $(git tag | wc -l) < 1 ]]; do git fetch --depth=$cc; cc=$(expr $cc + $COUNT); done ; This script will "git fetch" until find a tag and be able to |
I had a the same issue. Turns out my github integration wasn't liked to the repo. I needed to allow access to the repo in my Github orgs app settings. Then link it in the Sentry org integration for Github config. |
Thanks for the info @Rennzie |
adding --ignore-missing solved my issue
|
Just ran into this on GitHub Actions - if anyone is also seeing this error in your workflow when using - uses: actions/checkout@v2
with:
fetch-depth: 0 |
When running the command - uses: actions/checkout@v4
with:
fetch-depth: 0 I encounter the following issue: Could not determine any commits to be associated with a repo-based integration. Proceeding to find commits from the local git tree.
error: Could not find the SHA of the previous release in the git history. If you limit the clone depth, try to increase it. Otherwise, it means that the commit we are looking for was amended or squashed and cannot be retrieved. Use --ignore-missing flag to skip it and create a new release with the default commits count. |
Hey everybody,
I'm using Sentry on a repository where we have several branches that upload source maps to Sentry, each time with a new release.
When calling these CLI commands:
It happens that sometimes we get the error
And if I increase the git depth, it shows
error: No commits found. Leaving release alone.
It has to be said that when merging into master we are squashing commits and that could be the cause of our problems, but we can't figure out exactly because sometimes the set-commits command just work as expected.
The text was updated successfully, but these errors were encountered: