Feat bitbucket server support#6689
Conversation
| "github.com/go-playground/validator/v10" | ||
| ) | ||
|
|
||
| var vld *validator.Validate |
There was a problem hiding this comment.
I think you'd better to use the latest helper. The code you are using can work, but the latest helper will be more clear and simple.
Examples: https://github.com/apache/incubator-devlake/blob/main/backend/plugins/github/api/init.go#L31
For more help about new helper, @klesh will help you.
There was a problem hiding this comment.
Hey, @klesh. I reviewed the api.DsHelper. From what I saw it makes the code cleaner in init.go but it complicates the code in other parts. For example, to retrieve a repo, even in the GitHub plugin, we have to make the database query (https://github.com/apache/incubator-devlake/blob/b6c9e6cf6aa4a0e07443c6f98eea2e7adf528e41/backend/plugins/github/api/blueprint_v200.go#L86). At least that's from my first look. Perhaps I don't understand it well enough. I'll look at it in a bit more depth. Help in any way would be appreciated :)
There was a problem hiding this comment.
I made a basic integration, similar to the one in BitBucket plugin.
There was a problem hiding this comment.
Nice work, I took a glance and it seems very good to me.
However, we are testing v0.21 and it will be releasing it soon, so we are going to merge the PR as soon as the release branch is checked out.
I will take another closer look but I think the overall work is very impressive, thanks for your contribution.
| if err != nil { | ||
| return nil, err | ||
| } | ||
| return &plugin.ApiResourceOutput{Body: connections, Status: http.StatusOK}, nil |
There was a problem hiding this comment.
To avoid sensitive tokens leakage, a Sanitize function is expected.
Example: https://github.com/apache/incubator-devlake/blob/main/backend/plugins/github/models/connection.go#L253
And this function should be inited to dsHelper(Example: https://github.com/apache/incubator-devlake/blob/main/backend/plugins/github/api/init.go#L47).
| // @Failure 400 {string} errcode.Error "Bad Request" | ||
| // @Failure 500 {string} errcode.Error "Internal Error" | ||
| // @Router /plugins/bitbucket_server/test [POST] | ||
| func TestConnection(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) { |
There was a problem hiding this comment.
A new handle for testing connection is required.
Example: https://github.com/apache/incubator-devlake/blob/main/backend/plugins/github/impl/impl.go#L190
| s := queryData.Search[0] | ||
| gid, searchName := getSearch(s) | ||
| // query.Set("sort", "name") | ||
| // query.Set("fields", "values.name,values.full_name,values.language,values.description,values.owner.display_name,values.created_on,values.updated_on,values.links.clone,values.links.html,pagelen,page,size") |
There was a problem hiding this comment.
These commented codes can be deleted directly.
|
@ViktorGrigorov7 |
|
@d4x1 I do think it will be easier for the users to have BitBucket Cloud and BitBucket Server buttons. However the differences between BitBucket Cloud and BitBucket Server are significant. For example, the cloud version supports issues, deployments, etc. and these are not supported in the Server version. Also I don't think there's a lot of replicated code since the endpoints of the Server are very different from the Cloud. |
Agreed! |
Signed-off-by: Marais Van Zyl <marais@projexis.co.za>
Signed-off-by: Marais Van Zyl <marais@projexis.co.za>
Signed-off-by: Marais Van Zyl <marais@projexis.co.za>
Signed-off-by: Marais Van Zyl <marais@projexis.co.za>
…etter suits bb terminology)
| @@ -1,4 +1,4 @@ | |||
| #!/bin/sh | |||
…bitbucket and bitbucket_server
| export const BitBucketConfig: IPluginConfig = { | ||
| plugin: 'bitbucket', | ||
| name: 'BitBucket', | ||
| icon: ({ color }) => <Icon fill={color} />, |
There was a problem hiding this comment.
Do not modify this, otherwise the theme color will not be applied.
| TRANSFORMATION: | ||
| 'https://devlake.apache.org/docs/v0.20/Configuration/BitBucket#step-3---adding-transformation-rules-optional', | ||
| }, | ||
| BITBUCKET_SERVER: { |
There was a problem hiding this comment.
It’s not needed here either. There is no such plugin in 0.20.
29e3855 to
258d0ae
Compare
|
Hi all, Just wondering when this change will land in a new beta release? |
|
bitbucket server will be available on |
* feat: initial commit for bitbucket-server * chore: remove bb-cloud code from server Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: remove more bb cloud references Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: set line ending to lf Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore(bitbucket-server): spelling mistake * chore(bitbucket-server): update swagger paths * chore(bitbucket-server): fix migration name * chore(bitbucket-server): renames from bitbucket * chore: change test endpoint * refactor: getting scopes to function * chore: update repo/project remote search Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: update paging * fix(bitbucket-server): remote scopes paging * fix(bitbucket-server): remote scopes * refactor: small changes to account for server apis * test: update raw repository data * test: repo test * chore: refactor fields * several fixes * fix: made prs and pr comments extractable, renamed account to user (better suits bb terminology) * fix: user convert * fix: pr comment convertor * fix: pr_commit_collector and pr_commit_extractor * fix: commit collector/extractor * feat: branch collector, fixes * fix: made collection of commits happen across all branches * fix: deleted build_collector - no use * feat: bitbucket-server in ui + several fixes * fix: renamed bitbucket-server to bitbucket_server * fix: pr base_repo_id issue * feat: grafana dashboard * fix: pr collection issue * fix: pr_collector end * test: e2e for prs * test: e2e for pr_commits * fix: extraction commit author + e2e tests for commits * fix: renamed account_convertor to user_convertor * chore: removed dead comments * fix: rebase issues * fix: test connection * refactor: using dsHelper * fix: scope config crud * feat: implemented transformations, removed previous transformations * refactor: renamed migration * chore: removed dead code * fix: domain types, enabling tasks by default * fix: merge commit sha for pull requests * fix: pr commits pagination issue, remote scopes pagination * fix: pagination fix for all collections in bitbucket_server * fix: recollect issues * fix: merge commit sha through activities api * refactor: removed useless code and bumped up concurrency * refactor: reduced repeating code * fix: renamed bitbucket_server structs and fixed RootPkgPath for both bitbucket and bitbucket_server * fix: remove commit sha parents * fix: pagination issue, removed not used concurrency * fix: conflict BitBucket * fix: cicd detected issues * fix: models * fix: ui issues, linting issues, removed dead code * fix: test issues * fix: branches are not incremental * fix: branches are not incremental * fix: all collectors are now stateless * fix: removed useless tasks * fix: stateful collectors --------- Signed-off-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Lynwee <linwei.hou@merico.dev>
* feat: initial commit for bitbucket-server * chore: remove bb-cloud code from server Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: remove more bb cloud references Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: set line ending to lf Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore(bitbucket-server): spelling mistake * chore(bitbucket-server): update swagger paths * chore(bitbucket-server): fix migration name * chore(bitbucket-server): renames from bitbucket * chore: change test endpoint * refactor: getting scopes to function * chore: update repo/project remote search Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: update paging * fix(bitbucket-server): remote scopes paging * fix(bitbucket-server): remote scopes * refactor: small changes to account for server apis * test: update raw repository data * test: repo test * chore: refactor fields * several fixes * fix: made prs and pr comments extractable, renamed account to user (better suits bb terminology) * fix: user convert * fix: pr comment convertor * fix: pr_commit_collector and pr_commit_extractor * fix: commit collector/extractor * feat: branch collector, fixes * fix: made collection of commits happen across all branches * fix: deleted build_collector - no use * feat: bitbucket-server in ui + several fixes * fix: renamed bitbucket-server to bitbucket_server * fix: pr base_repo_id issue * feat: grafana dashboard * fix: pr collection issue * fix: pr_collector end * test: e2e for prs * test: e2e for pr_commits * fix: extraction commit author + e2e tests for commits * fix: renamed account_convertor to user_convertor * chore: removed dead comments * fix: rebase issues * fix: test connection * refactor: using dsHelper * fix: scope config crud * feat: implemented transformations, removed previous transformations * refactor: renamed migration * chore: removed dead code * fix: domain types, enabling tasks by default * fix: merge commit sha for pull requests * fix: pr commits pagination issue, remote scopes pagination * fix: pagination fix for all collections in bitbucket_server * fix: recollect issues * fix: merge commit sha through activities api * refactor: removed useless code and bumped up concurrency * refactor: reduced repeating code * fix: renamed bitbucket_server structs and fixed RootPkgPath for both bitbucket and bitbucket_server * fix: remove commit sha parents * fix: pagination issue, removed not used concurrency * fix: conflict BitBucket * fix: cicd detected issues * fix: models * fix: ui issues, linting issues, removed dead code * fix: test issues * fix: branches are not incremental * fix: branches are not incremental * fix: all collectors are now stateless * fix: removed useless tasks * fix: stateful collectors --------- Signed-off-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Lynwee <linwei.hou@merico.dev>
* feat: initial commit for bitbucket-server * chore: remove bb-cloud code from server Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: remove more bb cloud references Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: set line ending to lf Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore(bitbucket-server): spelling mistake * chore(bitbucket-server): update swagger paths * chore(bitbucket-server): fix migration name * chore(bitbucket-server): renames from bitbucket * chore: change test endpoint * refactor: getting scopes to function * chore: update repo/project remote search Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: update paging * fix(bitbucket-server): remote scopes paging * fix(bitbucket-server): remote scopes * refactor: small changes to account for server apis * test: update raw repository data * test: repo test * chore: refactor fields * several fixes * fix: made prs and pr comments extractable, renamed account to user (better suits bb terminology) * fix: user convert * fix: pr comment convertor * fix: pr_commit_collector and pr_commit_extractor * fix: commit collector/extractor * feat: branch collector, fixes * fix: made collection of commits happen across all branches * fix: deleted build_collector - no use * feat: bitbucket-server in ui + several fixes * fix: renamed bitbucket-server to bitbucket_server * fix: pr base_repo_id issue * feat: grafana dashboard * fix: pr collection issue * fix: pr_collector end * test: e2e for prs * test: e2e for pr_commits * fix: extraction commit author + e2e tests for commits * fix: renamed account_convertor to user_convertor * chore: removed dead comments * fix: rebase issues * fix: test connection * refactor: using dsHelper * fix: scope config crud * feat: implemented transformations, removed previous transformations * refactor: renamed migration * chore: removed dead code * fix: domain types, enabling tasks by default * fix: merge commit sha for pull requests * fix: pr commits pagination issue, remote scopes pagination * fix: pagination fix for all collections in bitbucket_server * fix: recollect issues * fix: merge commit sha through activities api * refactor: removed useless code and bumped up concurrency * refactor: reduced repeating code * fix: renamed bitbucket_server structs and fixed RootPkgPath for both bitbucket and bitbucket_server * fix: remove commit sha parents * fix: pagination issue, removed not used concurrency * fix: conflict BitBucket * fix: cicd detected issues * fix: models * fix: ui issues, linting issues, removed dead code * fix: test issues * fix: branches are not incremental * fix: branches are not incremental * fix: all collectors are now stateless * fix: removed useless tasks * fix: stateful collectors --------- Signed-off-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Lynwee <linwei.hou@merico.dev>
* feat: initial commit for bitbucket-server * chore: remove bb-cloud code from server Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: remove more bb cloud references Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: set line ending to lf Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore(bitbucket-server): spelling mistake * chore(bitbucket-server): update swagger paths * chore(bitbucket-server): fix migration name * chore(bitbucket-server): renames from bitbucket * chore: change test endpoint * refactor: getting scopes to function * chore: update repo/project remote search Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: update paging * fix(bitbucket-server): remote scopes paging * fix(bitbucket-server): remote scopes * refactor: small changes to account for server apis * test: update raw repository data * test: repo test * chore: refactor fields * several fixes * fix: made prs and pr comments extractable, renamed account to user (better suits bb terminology) * fix: user convert * fix: pr comment convertor * fix: pr_commit_collector and pr_commit_extractor * fix: commit collector/extractor * feat: branch collector, fixes * fix: made collection of commits happen across all branches * fix: deleted build_collector - no use * feat: bitbucket-server in ui + several fixes * fix: renamed bitbucket-server to bitbucket_server * fix: pr base_repo_id issue * feat: grafana dashboard * fix: pr collection issue * fix: pr_collector end * test: e2e for prs * test: e2e for pr_commits * fix: extraction commit author + e2e tests for commits * fix: renamed account_convertor to user_convertor * chore: removed dead comments * fix: rebase issues * fix: test connection * refactor: using dsHelper * fix: scope config crud * feat: implemented transformations, removed previous transformations * refactor: renamed migration * chore: removed dead code * fix: domain types, enabling tasks by default * fix: merge commit sha for pull requests * fix: pr commits pagination issue, remote scopes pagination * fix: pagination fix for all collections in bitbucket_server * fix: recollect issues * fix: merge commit sha through activities api * refactor: removed useless code and bumped up concurrency * refactor: reduced repeating code * fix: renamed bitbucket_server structs and fixed RootPkgPath for both bitbucket and bitbucket_server * fix: remove commit sha parents * fix: pagination issue, removed not used concurrency * fix: conflict BitBucket * fix: cicd detected issues * fix: models * fix: ui issues, linting issues, removed dead code * fix: test issues * fix: branches are not incremental * fix: branches are not incremental * fix: all collectors are now stateless * fix: removed useless tasks * fix: stateful collectors --------- Signed-off-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Lynwee <linwei.hou@merico.dev>
* feat: initial commit for bitbucket-server * chore: remove bb-cloud code from server Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: remove more bb cloud references Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: set line ending to lf Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore(bitbucket-server): spelling mistake * chore(bitbucket-server): update swagger paths * chore(bitbucket-server): fix migration name * chore(bitbucket-server): renames from bitbucket * chore: change test endpoint * refactor: getting scopes to function * chore: update repo/project remote search Signed-off-by: Marais Van Zyl <marais@projexis.co.za> * chore: update paging * fix(bitbucket-server): remote scopes paging * fix(bitbucket-server): remote scopes * refactor: small changes to account for server apis * test: update raw repository data * test: repo test * chore: refactor fields * several fixes * fix: made prs and pr comments extractable, renamed account to user (better suits bb terminology) * fix: user convert * fix: pr comment convertor * fix: pr_commit_collector and pr_commit_extractor * fix: commit collector/extractor * feat: branch collector, fixes * fix: made collection of commits happen across all branches * fix: deleted build_collector - no use * feat: bitbucket-server in ui + several fixes * fix: renamed bitbucket-server to bitbucket_server * fix: pr base_repo_id issue * feat: grafana dashboard * fix: pr collection issue * fix: pr_collector end * test: e2e for prs * test: e2e for pr_commits * fix: extraction commit author + e2e tests for commits * fix: renamed account_convertor to user_convertor * chore: removed dead comments * fix: rebase issues * fix: test connection * refactor: using dsHelper * fix: scope config crud * feat: implemented transformations, removed previous transformations * refactor: renamed migration * chore: removed dead code * fix: domain types, enabling tasks by default * fix: merge commit sha for pull requests * fix: pr commits pagination issue, remote scopes pagination * fix: pagination fix for all collections in bitbucket_server * fix: recollect issues * fix: merge commit sha through activities api * refactor: removed useless code and bumped up concurrency * refactor: reduced repeating code * fix: renamed bitbucket_server structs and fixed RootPkgPath for both bitbucket and bitbucket_server * fix: remove commit sha parents * fix: pagination issue, removed not used concurrency * fix: conflict BitBucket * fix: cicd detected issues * fix: models * fix: ui issues, linting issues, removed dead code * fix: test issues * fix: branches are not incremental * fix: branches are not incremental * fix: all collectors are now stateless * fix: removed useless tasks * fix: stateful collectors --------- Signed-off-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Marais Van Zyl <marais@projexis.co.za> Co-authored-by: Lynwee <linwei.hou@merico.dev>


pr-type/bug-fix,pr-type/feature-development, etc.Summary
What does this PR do?
This PR makes possible integration with the bitbucket server. It adds it to both the backend and the config ui.
Does this close any open issues?
Closes #4568
Screenshots
Other Information