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

Fix broken issue assigning for Jira - deprecated input-data #314

Open
astyltsvig opened this issue Nov 27, 2019 · 1 comment
Open

Fix broken issue assigning for Jira - deprecated input-data #314

astyltsvig opened this issue Nov 27, 2019 · 1 comment
Assignees

Comments

@astyltsvig
Copy link
Collaborator

astyltsvig commented Nov 27, 2019

Problem

The Jira plugin for git-phlow fails assigning me to any issue for JIRA when i run git-phlow workon issueno.

Example:

andreas@andreas-Lenovo-ThinkBook-13s-IWL:~/Documents/oticon/GitOpsExperiment$ git workon TEST-14
Preparing workspace...

-------- Issue #TEST-14--------  
Moved to => In Progress 
Assingee '@[email protected]' could not be assigned to issue #TEST-14
Created workspace:  TEST-14-test 

Reference to user by Name(email) is deprecated!

Git-phlow plugin for Jira (assignIssue) need to be rewritten so it works with the new API

The problem occurs from using Email as reference for the user. In Jira you need to assign a user to an issue by accountId and not by email

Documented here in JIRA API image

Specifically here in line 198 https://github.com/Praqma/git-phlow/blob/fec9d58804e175062d4bf12bfa496e00ffe425d1/plugins/jira.go#L198

Git-phlow is sending the input-data formatted as

{"name":"[email protected]" } 

where it should be

{"accountId":"xasda--238axj2.-asxo"}
@astyltsvig
Copy link
Collaborator Author

astyltsvig commented Nov 27, 2019

I will be working on this issue and hopefully come up with a reliable solution soon.

Notes of my research:

Solution:

TODO -

  • Fetch AccountId from API
  • Save AccountId to .gitconfig file
  • Load AccountId from .gitconfig file
  • Use AccountId instead of Name in AssignUser()

Fetch accountId

GET /rest/api/3/user/search

curl -X GET \
  'https:///ansty.atlassian.net/rest/api/latest/user/search?query=ansty93%40gmail.com' \

Save AccountId to .gitconfig file

.gitconfig

[phlow]
jirauser = [email protected]
jirapassword = sadinx833883
jiraaccountid = 38d-3wqx-21deas

Load AccountId from .gitconfig file

Use AccountId instead of Name in AssignUser()

@astyltsvig astyltsvig changed the title Fix broken issue assigning for Jira - fix deprecated input-data Fix broken issue assigning for Jira - deprecated input-data Nov 27, 2019
@astyltsvig astyltsvig self-assigned this Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant