Repository navigation
Implement jira bridge - #250
Conversation
|
Some notes: I suggest you start with doc/jira_bridge.md as it describes several of the jira-specific issues that are dealt with by the bridge, as well as some (initial) design decisions. Note that I've tested the import quite a bit, but I've only tested the export with one bug that I created, exported, imported, modified, exported again. I don't want to use my work JIRA instance in case I messed up and export thousands duplicate bugs into our jira (the project I used to test has 6000 issues). One thing that would help a lot is if we could get in touch with Atlassian and request that they donate a license (or a cloud instance) to the The bridge currently does nothing to import any of the JIRA fields that don'thave I don't fully understand what the whole |
Why not using a free plan, hosted by Atlassian ? It's up to 10 seat, "free forever".
I thouched a bit on that here: #241 (comment)
Yeah, it doesn't really do anything at the moment but will eventually. The goal is to be able to load as much credential as necessary and being able to use git-bug as a "real" bridge between two bug tracker for a migration. It's not really part of git-bug's end goal but it was a fairly simply architectural change to enable that use case. |
|
Huu, sorry for asking that after you wrote that much code, but have you looked at https://github.com/andygrunwald/go-jira ? Wouldn't that simplify a bunch of things in here ? |
For real? Wow awesome. I only found the 30 day server trial. I'll look into this.
Ok great, I haven't gotten back to that discussion yet. I've been focused on this bridge :).
Ok good. I think I've respected the setup and the plumbing is in place for this bridge as well.
Nope. It's news to me.
I don't think so... I mean it would be a lot less code to use someone else's REST wrapper, if that's what you mean, but I don't think the rest of the bridge implementation changes. If that library looks good I would be happy to swap out for it.
..meh, the big time sink was studying the API and testing behaviors. Writing the REST wrapper was relatively quick. |
Having someone else do the maintenance is a big win, at least for me ;) |
MichaelMure
left a comment
There was a problem hiding this comment.
That's a lot of code ! Nothing obviously wrong, great start !
I created an instance at https://git-bug.atlassian.net give me an email so I can invite you. |
cheshirekow
left a comment
There was a problem hiding this comment.
I think the github review interface is buggy. I thought it discarded some of my replies, but then I think they may have come back. I apologize if there are duplicates. I put a 👍 on some of your requested changes to acknowledge them. I will comment with "Done" when they are done.
| entry to our git-config: | ||
|
|
||
| ``` | ||
| create-issue-defaults = {"issuetype":"10001"} |
There was a problem hiding this comment.
For the raw JSON request? No it must be an ID.
For git-bug? Sure it could but there are a couple of considerations:
- The mapping can change more easily than the workflow. If a project manager decides that "Open" should be renamed to "Initiated" the textual name will change but the ID and workflow specification will stay the same.
- We'll need to lookup the mapping and translate it when we merge the JSON into our outgoing request
- Issue types are not namespaced by project, they are global to a JIRA server so all projects share a common pool of names and ids. This may or may not be an issue if the pool is large. I don't know how big the mapping might get. The large company I currently work for has 155 issue types that are visible to me, which is small enough to query once and reuse.
If you feel like it's worthwhile we can go down that path. I would advocate to make this a future enhancement.
| You can specify the mapping between `git-bug` status and JIRA status id's using | ||
| the following: | ||
| ``` | ||
| bug-open-id = 1 |
There was a problem hiding this comment.
That's a good point. This should really be a dictionary style mapping.
Sent you an email. I'm glad you were able to get one. I've been trying for a few days now and I keep getting an error. Looks like it worked for me today though. |
cheshirekow
left a comment
There was a problem hiding this comment.
Alright I think I've addressed all the comments so far. I'm out of time for the evening so I will test the changes and push an update to this PR when I get a chance.
| conf[core.KeyTarget] = target | ||
| conf[keyServer] = serverURL | ||
| conf[keyProject] = project | ||
| if choice == 1 { |
| } | ||
|
|
||
| // PromptPassword performs interactive input collection to get the user password | ||
| func PromptPassword() (string, error) { |
There was a problem hiding this comment.
Moved to input/prompt.go. We can follow up with using it in other bridges (TODO 3cb989e)
| targetOpID, err := b.ResolveOperationWithMetadata( | ||
| keyJiraID, item.ID) | ||
| if err == nil { | ||
| self.out <- core.NewImportNothing("", "comment already imported") |
There was a problem hiding this comment.
Ok, done. Removed the superfluous nothing events. One question though: if we can't import/export a particular operation due to lack of credentials or for some other criteria, should we silently move on or should we emit an error event? Same question as in the exporter above really.
| } | ||
|
|
||
| // Convenience function to edit the body of a bug (the first comment) | ||
| func EditBody(b Interface, author identity.Interface, unixTime int64, message string) (*EditCommentOperation, error) { |
There was a problem hiding this comment.
Done. Also made the same edits in bug_cache.go
|
|
||
| ## Configuration | ||
|
|
||
| As mentioned in the notes above, there are a few optional configuration fields |
| entry to our git-config: | ||
|
|
||
| ``` | ||
| create-issue-defaults = {"issuetype":"10001"} |
There was a problem hiding this comment.
Cool. Added TODO b610296 to look into this.
| You can specify the mapping between `git-bug` status and JIRA status id's using | ||
| the following: | ||
| ``` | ||
| bug-open-id = 1 |
|
So much teasing and no push ;) |
Ah, yeah sorry. I can push when I am home tonight. I wanted to test and then report on the test results with the next update, but now I have to deal with this: On one hand, it's good they support user API tokens... On the other hand, we'll probably need both code paths because companies are slow to upgrade their JIRA deployments. |
056e90c to
0ef9b80
Compare
|
I did a little testing with my jira cloud instance and things are looking good. I did:
I had to hack in support for the new jira token auth. I'll need to review the new git-bug token management API to get that plumbed in correctly (not hacky) though... and do a little more comprehensive testing. Feel free to comment further on the current state of the patch though. I don't think too much will change to get in the token auth support. |
Ha bummer :( Github is doing that as well ... https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/ |
MichaelMure
left a comment
There was a problem hiding this comment.
Just a few things I noticed. Generally look very good, great work :)
As you mentioned, credentials stored through the core and a bit of standardization with the other bridges would be nice.
Automated testing against the jira instance, as it is done with github and gitlab would be very useful as well.
|
I'm working on generalizing the credential code in the core so it's easy to add more kind. |
There was a problem hiding this comment.
Ok, unhackified the two credentials-types jazz. I saw that you created a PR for a new credentials system for the core so I will take a look at that. I believe that all the review comments are addressed at this point. Pushing now...
Edit: here is my list of follow-up work:
8391e86 create unit tests against test instance
1121826 Add unit tests for utilities
0cf5c71 Assign git-bug to jira field on import
c70e22a implement additional query filters for import
8acce9c Download and cache workflow representation
67bf520 After JIRA mock, create integration tests
9ecefaa Create JIRA mock and add REST unit tests
0597088 use OS keyring for credentials
d3e8f79 You shouldn't count on the Total value in paginations
| ) | ||
|
|
||
| const ( | ||
| keyOrigin = "origin" |
| // Create a bug.Comment from a JIRA comment | ||
| func (self *jiraImporter) ensureComment( | ||
| repo *cache.RepoCache, b *cache.BugCache, item Comment) error { | ||
| // ensure person |
There was a problem hiding this comment.
Oh interesting. In the languages I usually work with splitting arguments at different indention would be frowned upon. Good to know though, I'll go ahead and fix this one here and try to follow that moving forward.
| password := conf[keyPassword] | ||
| if password == "" { | ||
| var err error | ||
| password, err = input.PromptPassword() |
There was a problem hiding this comment.
ineffectual assignment to password (from ineffassign)
d4c6fff to
262102b
Compare
|
Did some testing last night and fixed a couple of bugs. I still haven't rebased on the new credential system, so I guess that is up next. Things are looking good so far though and I think will start using this at work to shake out more bugs and inspire a test plan. I'm going to resolve the open conversations on the review and make sure I didn't miss anything. |
|
Update #5: I had to fix the git config parser in the core in order to correctly parse out a JSON map as a git config value. I also added the import/export warning events and used them. Lastly, I added a "reverse map" for bug ids, so that git-bug knows how to interpret JIRA statuses on import (if there are many). |
8862a2e to
1e23ffd
Compare
|
Hey @cheshirekow what's up with this ? Do you need help ? |
|
I rebased last week and resolved conflicts but it doesn't build due to interface requirements on the bridge. I guess you changed the bridge API? I haven't had time to dig in further. As of the last commit all your comments have been addressed I think. It's fully functional and I've been using this branch as my daily driver for some weeks now. Some help adapting to whatever the upstream changes were would be great! |
|
Alright, I'll finish #294 and rebase/merge this. If you have the time, an automated test similar as the other bridges would be great. |
|
First merge, use of the new prompts and some cleanup. This need more work especially on the credential part. |
|
Thanks for the push. I built this morning and my pull/push from JIRA worked just fine. |
|
@cheshirekow do you think it would be possible to detect automatically the credential (session or token) ? That would simplify both the code and the UX. |
|
Also, there is a mismatch between the name and value of this constant, what's the good concept ? |
Your idea in the other thread of trying some query with both credential types and just seeing what works makes sense.
As I mentioned in the other thread, I'm not sure which is better to use, but I'm happy with either. Which do you prefer? I might suggest changing the name of the variable and keeping the metadata key just so I don't have to re-import my 1500-ish bugs that are already using "jira-derived-id" in their metadata. I'll go ahead and make that change. |
|
Successful import from |
So, that would only matter for importing a private repo. For importing a public repo, any credential would do. For exporting, the bridge will match credentials based on the login, using whatever credential is needed for this specific piece of data. So what could be done is for the bridges to store an additional information in their config: the login to use when importing (ie, the one used during the configuration). That would make more sense than using the first random one found. |
|
So, does that means it's merge time ? What's left to do here ? |
|
Ho, at least one thing would be to complete the Readme |
Ready from my end.
You mean add "Jira" to the tables? Ok, I just pushed a change to do that. |
|
Weeeeeeeeeee 🎉 🎉 🎉 🎉 🎉 🎉 |

No description provided.