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: [email protected]

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

Reply via email to