Skip to content
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

add function for adding assignees to issues #589

Merged
merged 1 commit into from
Jun 9, 2021

Conversation

KPostOffice
Copy link
Contributor

Closes: #586

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@KPostOffice KPostOffice force-pushed the add_assignee branch 2 times, most recently from 40d1945 to 7e8c07b Compare May 25, 2021 19:57
@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

Copy link
Member

@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, the code looks really good!

Regarding the tests, the code looks good but we need to generate the yaml files with the responses.

  • As you might know from the contribution guide, If you run the tests locally, you need to provide github/gitlab/pagure tokens via env.var. and run the tests. This will touch the real services and save the responses to the yaml files. Those files need to be committed as well so we don't need to use secrets and touch the real services in CI. (Basically, it records the communication and removes the sensitive values.)
  • Since it touches the real services, your account need to have the permissions to do assigning -- e.g. on GitHub, I can give you triage permission if you want.
  • I can also generate the response files for you. (I understand it's tricky for the first time.)

Thanks!

@KPostOffice
Copy link
Contributor Author

@lachmanfrantisek Do I just use my own personal access tokens for github/gitlab/pagure?

@mfocko
Copy link
Member

mfocko commented May 27, 2021

Do I just use my own personal access tokens for github/gitlab/pagure?

@KPostOffice yes, but I think you need write access to the repository to set assignees... I think there is some test I have created before that used user-agnostic repository... lemme have a look... test_add_user in generic_commands... I think you could use a skeleton like that. Don't worry about creating new issues from the test case, so it's independent

@softwarefactory-project-zuul
Copy link
Contributor

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@KPostOffice
Copy link
Contributor Author

@lachmanfrantisek PTAL

Copy link
Member

@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Just one small suggestion, otherwise LGTM.

Can you please do rebase instead of merge so we have only one new commit that sits on top of the current main branch? (Let me know if you need some help with that.)

Thank you for working on this!

Comment on lines 179 to 190
a = self._raw_issue.__dict__.get("assignee_ids") or []
for assignee in assignees:
users = self.project.service.gitlab_instance.users.list( # type: ignore
username=assignee
)
if not users:
raise GitlabAPIException(f"Unable to find '{assignee}' username")
uid = str(users[0].id)
if uid not in a:
a.append(str(users[0].id))

self._raw_issue.assignee_ids = a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a better name for the assignee list, please?

@KPostOffice KPostOffice force-pushed the add_assignee branch 2 times, most recently from 92b74b0 to 7f04a00 Compare June 4, 2021 18:25
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@KPostOffice
Copy link
Contributor Author

@lachmanfrantisek I addressed both comments. It should push on top of master nicely now.

Copy link
Member

@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the contribution!

@lachmanfrantisek lachmanfrantisek added the mergeit When set, zuul wil gate and merge the PR. label Jun 9, 2021
@softwarefactory-project-zuul
Copy link
Contributor

Build failed (gate pipeline).

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit c49ba84 into packit:main Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit When set, zuul wil gate and merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding assignees for issue that already exists
3 participants