-
Notifications
You must be signed in to change notification settings - Fork 9
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
Sync external references to Jira tracker links #865
Conversation
0169990
to
fa7f15e
Compare
apps/taskman/tests/cassettes/test_service/TestTaskmanService.test_update_link.yaml
Show resolved
Hide resolved
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.
LGTM
osidb/serializer.py
Outdated
if not tracker.is_closed and tracker.type == Tracker.TrackerType.JIRA: | ||
tracker.sync_reference( | ||
jira_token=self.get_jira_token(), reference=new_ref | ||
) |
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.
I do not want to over-complicate this right now but I am not convinced that the serializer
module is a good place for this on-save logic and we should rather continuously migrate it to the model layer. I know that we already backed a lot of it into the serializer
for various reasons in the past and it is not always trivial to change so I am just leaving a comment and not insisting on the change.
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.
I agree with @osoukup regarding putting things into serializers, but won't insist on changing that right now.
apps/taskman/tests/test_service.py
Outdated
Test that service is able to update remote links in Jira issues. | ||
""" | ||
url = "https://www.redhat.com" | ||
flaw = FlawFactory(embargoed=False, uuid="c581c407-5bc3-4a84-83ce-e3688e8fe87c") |
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.
Any reason for directly specifying the uuid
?
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.
No real reason other than it being done in the rest of the tests in that module. But you're right it's not really necessary so might remove them all
collectors/jiraffe/core.py
Outdated
@@ -220,6 +226,58 @@ def add_link(self, issue_key, url, title) -> Response: | |||
) | |||
return Response(data=response_content, status=e.status_code) | |||
|
|||
def update_link(self, issue_key, link_id, url, title) -> Response: | |||
"""Update a remote link to a task by its internal ID.""" |
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.
Tracker
instead of task
? 🤔
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.
Or even better, the more generic Jira issue
since this is not limited to trackers but can be used for a flaw's task as well.
fa7f15e
to
8168bce
Compare
@osoukup @JakubFrejlach I moved the logic to the model layer since in this case it was easy, if you want to re-review |
I would consider the eventual end-goal that serializers do not do more than just serialization while there is still a bit more being done in the overridden |
1303bee
to
4e88dcf
Compare
Update the jira package in the requirements to be able to use some of its newer functionalities, namely the ability to delete remote links with a dedicated method instead of having to send the http query directly.
Before this commit, when filing Jira trackers, external/upstream references were created as links in the Jira issue, but this was only done during tracker creation, and no further changes in the references on OSIDB side were reflected in already created trackers. With this commit, changes to references on OSIDB will create/update links in existing Jira trackers. Links are kept unique by their URL, so if a reference with a given URL changes its description, it will change the Jira link description as well, but if the URL changes, it will create a new Jira link. Closes OSIDB-3733.
4e88dcf
to
d7682c4
Compare
Before this commit, when filing Jira trackers, external/upstream references were created as links in the Jira issue, but this was only done during tracker creation, and no further changes in the references on OSIDB side were reflected in already created trackers.
With this commit, changes to references on OSIDB will create/update links in existing Jira trackers. Links are kept unique by their URL, so if a reference with a given URL changes its description, it will change the Jira link description as well, but if the URL changes, it will create a new Jira link.
Closes OSIDB-3733.