incubator-devlake icon indicating copy to clipboard operation
incubator-devlake copied to clipboard

[Bug][jira plugin] devlake collection jira server information

Open jinzhu2002 opened this issue 3 years ago • 6 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

What happened

lake-v0110-devlake-1 | time="2022-07-20 01:19:53" level=error msg=" [task #24] [jira] retry #2 for http code error[404]:[{"errorMessages":["用户“[email protected]”不存在"],"errors":{}}]" lake-v0110-devlake-1 | time="2022-07-20 01:19:54" level=error msg=" [task #24] [jira] retry #2 for http code error[404]:[{"errorMessages":["用户“[email protected]”不存在"],"errors":{}}]" lake-v0110-devlake-1 | time="2022-07-20 01:19:56" level=error msg=" [task #24] [jira] retry #2 for http code error[404]:[{"errorMessages":["用户“[email protected]”不存在"],"errors":{}}]"

execute task fail

What you expected to happen

collection jira server information success

How to reproduce

curl http://127.0.0.1:8080/rest/agile/1.0/board/85/issue?expand=changelog&jql=ORDER+BY+created+ASC&maxResults=100&startAt=0

"changelog":{"startAt":0,"maxResults":13,"total":13,"histories":[{"id":"148308","author":{"self":"http://127.0.0.1:8080/rest/api/2/user?username=aaa","name":"aaa","key":"aaa","emailAddress":"[email protected]","avatarUrls":{"48x48":"http://127.0.0.1:8080/secure/useravatar?ownerId=aaa&avatarId=11401","24x24":"http://127.0.0.1:8080/secure/useravatar?size=small&ownerId=aaa&avatarId=11401","16x16":"http://127.0.0.1::8080/secure/useravatar?size=xsmall&ownerId=aaa&avatarId=11401","32x32":"http://127.0.0.1:8080/secure/useravatar?size=medium&ownerId=aaa&avatarId=11401"},"displayName":"sss

no accountID tag

modify apiv2models/user.go

func (u *User) getAccountId() string { if u == nil { return "" } if u.AccountId != "" { return u.AccountId } //add this code,run success,no test for jira cloud if (u.AccountId == "") && (u.Name != "") { return u.Name } return u.EmailAddress }

Anything else

No response

Version

v0.11.0

Are you willing to submit PR?

  • [x] Yes I am willing to submit a PR!

Code of Conduct

jinzhu2002 avatar Jul 20 '22 06:07 jinzhu2002

@jinzhu2002 Interesting, so right now you can make sure that you can get jira user info by the token, but devlake still return 404?

warren830 avatar Jul 20 '22 07:07 warren830

yes ,jira collection tasks run success,no any Errors。but no test for jira cloud

jinzhu2002 avatar Jul 20 '22 08:07 jinzhu2002

Right now, jira collection can work successfully.

warren830 avatar Jul 21 '22 02:07 warren830

@warren830 I encounter the same problem, how to solve it?

kyleliu1008 avatar Jul 22 '22 09:07 kyleliu1008

Hi @kyleliu1008 From @jinzhu2002 's suggestion, you can modify this file plugins/jira/apiv2models/user.go to the below

func (u *User) getAccountId() string {
	if u == nil {
		return ""
	}
	if u.AccountId != "" {
		return u.AccountId
	}
	//add this code,run success,no test for jira cloud
	if u.Name != "" {
		return u.Name
	}
	return u.EmailAddress
}

we will fix this bug in the next version

warren830 avatar Jul 22 '22 14:07 warren830

This should not be closed until we solve the problem in our main branch.

klesh avatar Jul 22 '22 15:07 klesh

This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs.

github-actions[bot] avatar Aug 25 '22 00:08 github-actions[bot]