You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/12/13 09:31:28 UTC
[GitHub] [incubator-devlake] warren830 opened a new pull request, #3922: fix(github): adapt bp v100 to v200
warren830 opened a new pull request, #3922:
URL: https://github.com/apache/incubator-devlake/pull/3922
### Summary
What does this PR do?
### Does this close any open issues?
Closes xx
### Screenshots
Our input for bp v100:
```json
{
"name": "test blueprint normal",
"mode": "NORMAL",
"settings": {
"version": "1.0.0",
"connections": [
{
"plugin": "github",
"connectionId": 1,
"scope": [
{
"options": {
"owner": "warren830",
"repo": "gorm"
},
"transformation": {
"prType": "hey,man,wasup",
"refdiff": {
"tagsPattern": "pattern",
"tagsLimit": 10,
"tagsOrder": "reverse semver"
},
"productionPattern": "xxxx"
}
}
]
}
]
},
"isManual": true
}
```
we can succeed to create bp
and blow is the screenshot for the result of trigger:
<img width="884" alt="image" src="https://user-images.githubusercontent.com/39366025/207277729-8eec0690-a40b-4a30-b729-caaecaf285ac.png">
<img width="944" alt="image" src="https://user-images.githubusercontent.com/39366025/207280209-0f76aa0f-7a99-4592-bb17-a607999bf944.png">
### Other Information
Any other information that is important to this PR.
--
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: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] warren830 merged pull request #3922: fix(github): adapt bp v100 to v200
Posted by GitBox <gi...@apache.org>.
warren830 merged PR #3922:
URL: https://github.com/apache/incubator-devlake/pull/3922
--
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: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3922: fix(github): adapt bp v100 to v200
Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3922:
URL: https://github.com/apache/incubator-devlake/pull/3922#discussion_r1046917533
##########
models/domainlayer/devops/cicd_pipeline_commmit.go:
##########
@@ -25,7 +25,7 @@ type CiCDPipelineCommit struct {
CommitSha string `gorm:"primaryKey;type:varchar(255)"`
Branch string `gorm:"type:varchar(255)"`
RepoId string `gorm:"index;type:varchar(255)"`
- RepoUrl string
+ Repo string
Review Comment:
This should be changed long ago...
##########
plugins/github/api/blueprint_V200_test.go:
##########
@@ -149,7 +148,6 @@ func NewMockBasicRes() *mocks.BasicRes {
GithubId: 12345,
Name: "test/testRepo",
TransformationRuleId: 1,
- CreatedDate: time.Time{},
Review Comment:
Already changed the type of CreatedDate to pointer
##########
plugins/github/impl/impl.go:
##########
@@ -169,14 +174,9 @@ func (plugin Github) PrepareTaskData(taskCtx core.TaskContext, options map[strin
return nil, errors.BadInput.Wrap(err, "invalid value for `createdDateAfter`")
}
}
- apiClient, err := tasks.CreateApiClient(taskCtx, connection)
- if err != nil {
- return nil, errors.Default.Wrap(err, "unable to get github API client instance")
- }
taskData := &tasks.GithubTaskData{
Options: op,
ApiClient: apiClient,
- Repo: githubRepo,
Review Comment:
We don't need set repo here, we only need to set githubId to options
##########
plugins/bitbucket/tasks/pipeline_convertor.go:
##########
@@ -77,7 +77,7 @@ func ConvertPipelines(taskCtx core.SubTaskContext) errors.Error {
Generate(bitbucketPipeline.ConnectionId, bitbucketPipeline.RepoId),
CommitSha: bitbucketPipeline.CommitSha,
Branch: bitbucketPipeline.RefName,
- RepoUrl: bitbucketPipeline.WebUrl,
+ Repo: bitbucketPipeline.WebUrl,
Review Comment:
This should be changed long ago...
##########
plugins/github/api/blueprint.go:
##########
@@ -139,7 +135,7 @@ func makePipelinePlan(subtaskMetas []core.SubTaskMeta, scope []*core.BlueprintSc
if j == len(plan) {
plan = append(plan, nil)
}
- repo, err = memorizedGetApiRepo(repo, op, apiClient)
+ repo, err = MemorizedGetApiRepo(repo, op, apiClient)
Review Comment:
this MemorizedGetApiRepo will also be used in impl.PrepareTaskData
##########
plugins/github/api/blueprint.go:
##########
@@ -118,7 +114,7 @@ func makePipelinePlan(subtaskMetas []core.SubTaskMeta, scope []*core.BlueprintSc
return nil, err
}
// collect git data by gitextractor if CODE was requested
- repo, err = memorizedGetApiRepo(repo, op, apiClient)
+ repo, err = MemorizedGetApiRepo(repo, op, apiClient)
Review Comment:
this MemorizedGetApiRepo will also be used in impl.PrepareTaskData
##########
plugins/github/api/blueprint.go:
##########
@@ -65,11 +61,11 @@ func MakePipelinePlan(subtaskMetas []core.SubTaskMeta, connectionId uint64, scop
return plan, nil
}
-func makePipelinePlan(subtaskMetas []core.SubTaskMeta, scope []*core.BlueprintScopeV100, apiClient helper.ApiClientGetter, connection *models.GithubConnection) (core.PipelinePlan, errors.Error) {
+func makePipelinePlan(subtaskMetas []core.SubTaskMeta, scopeV100s []*core.BlueprintScopeV100, apiClient helper.ApiClientGetter, connection *models.GithubConnection) (core.PipelinePlan, errors.Error) {
Review Comment:
better name
##########
plugins/github/api/scope.go:
##########
@@ -70,7 +70,8 @@ func PutScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Err
keeper[repo.GithubId] = struct{}{}
}
repo.ConnectionId = connectionId
- repo.CreatedDate = now
+ // Fixme: why do we set this to now?
+ repo.CreatedDate = &now
Review Comment:
Actually, I have no idea why do we set the value here
##########
plugins/github/api/blueprint.go:
##########
@@ -246,7 +242,7 @@ func getApiRepo(op *tasks.GithubOptions, apiClient helper.ApiClientGetter) (*tas
return repoRes, nil
}
-func memorizedGetApiRepo(repo *tasks.GithubApiRepo, op *tasks.GithubOptions, apiClient helper.ApiClientGetter) (*tasks.GithubApiRepo, errors.Error) {
+func MemorizedGetApiRepo(repo *tasks.GithubApiRepo, op *tasks.GithubOptions, apiClient helper.ApiClientGetter) (*tasks.GithubApiRepo, errors.Error) {
Review Comment:
this MemorizedGetApiRepo will also be used in impl.PrepareTaskData
##########
plugins/dora/e2e/raw_tables/cicd_pipeline_commits.csv:
##########
@@ -1,4 +1,4 @@
-pipeline_id,commit_sha,branch,repo_id,repo_url
+pipeline_id,commit_sha,branch,repo_id,repo
Review Comment:
This should be changed long ago...
##########
plugins/github/api/blueprint.go:
##########
@@ -43,14 +43,10 @@ func MakePipelinePlan(subtaskMetas []core.SubTaskMeta, connectionId uint64, scop
if err != nil {
return nil, err
}
- token := strings.Split(connection.Token, ",")[0]
-
apiClient, err := helper.NewApiClient(
context.TODO(),
connection.Endpoint,
- map[string]string{
- "Authorization": fmt.Sprintf("Bearer %s", token),
- },
+ nil,
Review Comment:
we don't need token here
--
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: commits-unsubscribe@devlake.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org