mindlesscloud opened a new issue, #4463:
URL: https://github.com/apache/incubator-devlake/issues/4463

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar feature requirement.
   
   
   ### Use case
   
   The issues  were associated with the git commits by the remote links of 
issues. The repo URL was transformed from the commit URL with a hardcoded 
regex. For more flexibility, the regex should be configurable.
   
   ### Description
   
   ## Example
   Let's take BitBucket as an example
   - BitBucket Server 
     - commit url:/projects/{projectKey}/repos/{repoName}/commits/{commitId}
     - repo url:/scm/{projectKey}/{repoName}.git
   - BitBucket cloud
     - commit url:/{userName}/{repoName}/commits/{commitId}
     - repo url:/{userName}/{repoName}.git
    As the example is indicated, The repo URL could be assembled from pieces 
extracted from the commit URL.
   
   ## Solution
   The solution mainly focuses on the versatility and the friendliness of the 
configuration.
   - Versatility: no matter what data source (BitBucket, GitHub, Gitee, etc.) 
in the remote link of the user's Jira issue is used, what URL splicing method 
is used (BitBucket Cloud and Server versions are quite different).
   - Configuration friendliness: no need for users to input particularly 
long/complex regular rules.
   
   1. The output goes into the table`issue_repo_commits`
   
   field | type |  example |
   -- | -- | -- |
   issue_id | varchar(255) |  
   commit_sha | char(40) |  
   repo_url | varchar(255) | 
https://atc.bmw-brilliance.cn/bitbucket/projects/JIRAUI/repos/bba_ui_jira/commits/1e23e7f1a0cb539c7408c38e5a37de3bc836bc94https://github.com/apache/incubator-devlake/pull/4445/commits/a7c6550b6a273af36e9850291a52601d3dca367chttps://gitlab.com/merico-dev/ee/vdev.co/-/commit/050baf4575caf069275f5fa14db9ad4a21a79883
   host | varchar(255) | 
<br>atc.bmw-brilliance.cngithub.comgitlab.com<br/><br>github.com<br/><br>gitlab.com<br/>
   namespace | varchar(255) | 
<br>JIRAUI<br/><br>apache<br/><br>merico-dev/ee<br/>
   repo_name | varchar(255) | 
<br>bba_ui_jira<br/><br>incubator-devlake<br/><br>vdev.co<br/>
   
   2. modify the `Jira transformation` to supply a configuration item, which 
accepts the URL patterns and generates regexes
   
   
   Data Source | Remote Link Examples | UI configuration - Remote Link Pattern 
| generated regex |
   -- | -- | -- | -- |
   BitBucket Server | 
https://atc.bmw-brilliance.cn/bitbucket/projects/JIRAUI/repos/bba_ui_jira/commits/1e23e7f1a0cb539c7408c38e5a37de3bc836bc94
 |  
https://atc.bmw-brilliance.cn/bitbucket/projects/{namespace}/repos/{repo_name}/commits/{commit_sha}
 |  
   BitBucket Cloud | 
https://bitbucket.org/zhangliangatbitbucket/incubator-devlake/commits/fef8d697fbb9a2b336be6fa2e2848f585c86a622
 | https://bitbucket.org/{namespace}/{repo_name}/commits/{commit_sha} |  
   GitHub Cloud | 
https://github.com/apache/incubator-devlake/commit/a7c6550b6a273af36e9850291a52601d3dca367c
 | https://github.com/{namespace}/{repo_name}/commit/{commit_sha} |  
   GitLab Cloud | 
https://gitlab.com/merico-dev/ee/vdev.co/-/commit/050baf4575caf069275f5fa14db9ad4a21a79883
 | https://gitlab.com/{namespace}/{repo_name}/-/commit/{commit_sha} |  
   
   ### Compatibility
   - Configuration
   1. Add configuration to extract namespace, repo_name, and commit_sha from 
Jira remote link
   2. Keep the configuration to extract commit sha from Jira remote link as a 
fallback
   3. Keep the existing logic of transforming the commit URL to the repo URL as 
a fallback.
   - Value of column `repo_url`
   1. assemble the repo URL from the host, namespace, and repo_name if the new 
configuration is available.
   2. the existing logic will be executed as a fallback if the new 
configuration is not available.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to