Repository navigation
Conversation
MichaelMure
left a comment
There was a problem hiding this comment.
Hey thanks for looking into that. The Jira bridge definitely need some love.
As you'll see in my review, there is a few thing you can't do. I also have a bunch of questions.
Regarding the filtering, the last time it was discussed I was hoping to use the query language to allow the user to define what they want to import. At the moment this language is only used to query bugs with ls but it could be a great fit. What do you think?
The query package implement a lexer/parser for that language that produce a generic description of a query/filter. I was thinking that bridges could accept such a user-defined query. The bridge when importing could (if possible) translate those filter into native bugtracker specific query. When something is not or can't be supported, the filtering would happen on the Bug after being imported but before writing on disk.
| // see: https://github.com/go-git/go-git | ||
| // see: https://github.com/src-d/go-git/issues/760 | ||
| return newGoGitGlobalConfig(repo.r) | ||
| return newGitConfig(gitCli{path: repo.path}, true) |
There was a problem hiding this comment.
could you explain this change?
There was a problem hiding this comment.
The CLI-based git repo is planned to be removed.
There was a problem hiding this comment.
There is a bug in the marshalling which is deleting the anti-slashes from the values. I've replaced with the git cli implementation. This should be solved in the go library. Didn't reported yet.
There was a problem hiding this comment.
There is a bug in the marshalling which is deleting the anti-slashes from the values. I've replaced with the git cli implementation. This should be solved in the go library. Didn't reported yet.
Please report it, it could cause many problems.
| metaKeyJiraKey = "jira-key" | ||
| metaKeyJiraUser = "jira-user" | ||
| metaKeyJiraProject = "jira-project" | ||
| metaKeyJiraBridge = "jira-bridge" |
There was a problem hiding this comment.
this is a breaking change, it's going to break the import of people already using that bridge.
There was a problem hiding this comment.
not sure, I've planned to use the bridge as the selector. ie: the bridge that import should do the export. I think it's a more strict this way. This is because I'm replacing the project constraint with the filter if defined.
There was a problem hiding this comment.
We can have a back-ward mechanism, will preserve the project meta key and use it if there is no jira bridge key defined. The jira bridge meta key will be only used when the user will have provided a filter overriding the project filter.
| keyPrefix := fmt.Sprintf("git-bug.bridge.%s.", name) | ||
|
|
||
| pairs, err := repo.LocalConfig().ReadAll(keyPrefix) | ||
| pairs, err := repo.AnyConfig().ReadAll(keyPrefix) |
There was a problem hiding this comment.
why would you need to read the global config? The bridge config only make sense and is stored locally.
There was a problem hiding this comment.
For sharing bridges definition in multiple projects. This way I can define them only once for the multiple repositories we're working on in the same jira project.
|
|
||
| type Importer interface { | ||
| Init(ctx context.Context, repo *cache.RepoCache, conf Configuration) error | ||
| Init(ctx context.Context, repo *cache.RepoCache, name string, conf Configuration) error |
There was a problem hiding this comment.
I don't understand why you would need to pass the bridge name. This name is purely arbitrary for the user to identify configured bridges, so it's not valuable for anything else. Am I missing something?
There was a problem hiding this comment.
For replacing the project id, will be used for the export filtering in the bridge. I missed that change, will update the pull request with.
There was a problem hiding this comment.
I was thinking about sharing the bridges configuration in the repository itself. All the contributors are using the same no ? This way when a contributor clone the repository, he'll get the associated bridges with. He will only have to give his credentials.
|
I've reviewed the other pull requests and I think #241 is addressing the same. I'm not sure about the query translator, because we want to filter issues which do not share the same model. I think it's better to let the user define it in the native language. For now, the bridge is synching in only what I wanted, and synching out only the bugs I've worked on. So I'm fine with that for now. Another big thank for your work. I really enjoy using the product. |
…t-side the local config)
…in cache, unresolved in repo configuration)
ef96536 to
9dfef20
Compare
It seems to me that a lot of your changes are related to this. Unfortunately that's not something I'm willing to merge but let me try to explain why. The complex and annoying part when configuring a bridge is the authentication part: generating an API token with the correct access, recording a password ... It's both complex code-wise, error prone and simply annoying for the user. BUT, once this is done for a bugtracker, this credential is shared across repositories. What's left when setting up a new bridge in another repo is defining 1) the type of bridge, 2) the URL, 3) the login, and then 4) you can reuse the credential. When done right this can be a matter of seconds. I'm saying "when done right" because the Jira bridge is not as smart as it could. If you try the Github bridge, you will see that it auto-detect the correct project on Github from the git remotes. The Jira bridge could do something similar, leading to a really efficient process. The way the Jira bridge is designed, a local git repo is mapped to a Project in Jira. Is that assumption accurate? If so, you can just have one bridge defined per repo. It's simple and understandable. On the other hand, if you have bridges shared globally on the machine, you break many assumptions on how bridges works. I'm sure you have seen some of those breakage when going that way. What does it means when you pull the Jira bugs in one repo, then do that again in another repo ? What about the "last import time" which allows you to not download everything each time you pull? Edit: in short, you are a bit going against the grain on the bridges design. This design came up after a number of (painful) iteration so I would need a good reason to change things. It seems to me that there is a simpler and better way: make the configurator smarter. |
I'm not so sure about that. Here is my reasoning:
At least one downside I can think of is that the git-bug QL won't have concepts for every native concepts. But it does have a lot and should (?) cover most of the actual usage. Is that really a limitation? |
Thanks! Sadly this require sometimes to say no :-( What do you think of my alternate proposal? |
|
No worries, that's part of the game.
|
Go plugins at the moment are fairly broken and barely useful. Even with them, you will still have to follow the changes in git-bug core and maintain your bridge. Hopefully we can find a solution that can suit both of us. I have a few questions:
Due to the nature of Jira, people can define their own workflow and deeply change how the bugtracker behave, which makes it difficult to implement a bridge that works for everyone. I'm wondering if it would make sense to import some extra Jira field as label, like |
|
I think it's easier to contribute to JIRA the logic we want to select the issues to be exported. I can just map the project on-to a dedicated field which will be set server side dynamically. This way we will align to the simpler model of git-bug that I'm interested to work with. I agree with your objective of keeping it simple if possible. |
|
I'm closing this pull request. Thanks for your time. |
|
@nxmatic while the core of this PR can't be merged, it seems that you have found a bunch of small issues while journeying the code. Could you PR or report those? That'd be very useful. Going further, I hope we can keep collaborating on this in the future, to make a tool you enjoy working with. |
|
yes sure I will in the next days. Is there a channel where we can chat ? |
|
There is a gitter chat at https://gitter.im/the-git-bug/Lobby |
Hi
I needed to select JIRA issues with more constraints (working on old projects with monilitic projects. In the meanwhile I've discovered other problems, which are also fixed in the branch. I've checked on my side that the existing tests are still passing.
I didn't took the time for contributing new tests covering the feature.
I hope you'll agree to merge the jira filtering feature in the trunk. Thank you for your work, git-bug is a really amazing product.