-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ref(releases): Move code to a new function #81208
base: master
Are you sure you want to change the base?
Conversation
a27ebea
to
6bac2f2
Compare
or status_details.get("inNextRelease") | ||
or status_details.get("inUpcomingRelease") | ||
or status_details.get("inRelease") | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The four if statements prevent the usage for multiple projects:
sentry/src/sentry/api/helpers/group_index/update.py
Lines 314 to 319 in 7efb91b
# TODO(jess): We may want to support this for multi project, but punting on it for now | |
if len(projects) > 1: | |
return Response( | |
{"detail": "Cannot set resolved in next release for multiple projects."}, | |
status=400, | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commit = None | ||
release = None | ||
|
||
if status == "resolvedInNextRelease" or status_details.get("inNextRelease"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I copy/paste the original code the only differences are these:
diff --git a/src/sentry/api/helpers/group_index/update.py b/src/sentry/api/helpers/group_index/update.py
index 4d872033722..8de70a96876 100644
--- a/src/sentry/api/helpers/group_index/update.py
+++ b/src/sentry/api/helpers/group_index/update.py
@@ -548,6 +548,12 @@ def resolve_in_release_helper(
release = None
if status == "resolvedInNextRelease" or status_details.get("inNextRelease"):
+ # TODO(jess): We may want to support this for multi project, but punting on it for now
+ if len(projects) > 1:
+ return Response(
+ {"detail": "Cannot set resolved in next release for multiple projects."},
+ status=400,
+ )
# may not be a release yet
release = status_details.get("inNextRelease") or get_release_to_resolve_by(projects[0])
@@ -567,6 +573,11 @@ def resolve_in_release_helper(
res_type_str = "in_next_release"
res_status = GroupResolution.Status.pending
elif status_details.get("inUpcomingRelease"):
+ if len(projects) > 1:
+ return Response(
+ {"detail": "Cannot set resolved in upcoming release for multiple projects."},
+ status=400,
+ )
release = status_details.get("inUpcomingRelease") or most_recent_release(projects[0])
activity_type = ActivityType.SET_RESOLVED_IN_RELEASE.value
activity_data = {"version": ""}
@@ -581,6 +592,13 @@ def resolve_in_release_helper(
res_type_str = "in_upcoming_release"
res_status = GroupResolution.Status.pending
elif status_details.get("inRelease"):
+ # TODO(jess): We could update validation to check if release
+ # applies to multiple projects, but I think we agreed to punt
+ # on this for now
+ if len(projects) > 1:
+ return Response(
+ {"detail": "Cannot set resolved in release for multiple projects."}, status=400
+ )
release = status_details["inRelease"]
activity_type = ActivityType.SET_RESOLVED_IN_RELEASE.value
activity_data = {
@@ -598,6 +616,12 @@ def resolve_in_release_helper(
res_type_str = "in_release"
res_status = GroupResolution.Status.resolved
elif status_details.get("inCommit"):
+ # TODO(jess): Same here, this is probably something we could do, but
+ # punting for now.
+ if len(projects) > 1:
+ return Response(
+ {"detail": "Cannot set resolved in commit for multiple projects."}, status=400
+ )
commit = status_details["inCommit"]
activity_type = ActivityType.SET_RESOLVED_IN_COMMIT.value
activity_data = {"commit": commit.id}
res_type = GroupResolution.Type.in_release | ||
res_status = GroupResolution.Status.resolved | ||
except IndexError: | ||
release = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines come from this block:
sentry/src/sentry/api/helpers/group_index/update.py
Lines 407 to 423 in 7efb91b
# if we've specified a commit, let's see if its already been released | |
# this will allow us to associate the resolution to a release as if we | |
# were simply using 'inRelease' above | |
# Note: this is different than the way commit resolution works on deploy | |
# creation, as a given deploy is connected to an explicit release, and | |
# in this case we're simply choosing the most recent release which contains | |
# the commit. | |
if commit and not release: | |
# TODO(jess): If we support multiple projects for release / commit resolution, | |
# we need to update this to find the release for each project (we shouldn't assume | |
# it's the same) | |
try: | |
release = most_recent_release_matching_commit(projects, commit) | |
res_type = GroupResolution.Type.in_release | |
res_status = GroupResolution.Status.resolved | |
except IndexError: | |
release = None |
❌ 33 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
No description provided.