klesh commented on code in PR #7657:
URL:
https://github.com/apache/incubator-devlake/pull/7657#discussion_r1650295273
##########
backend/plugins/azuredevops_go/api/blueprint_v200.go:
##########
@@ -126,62 +111,91 @@ func makePipelinePlanV200(
scopeDetails []*srvhelper.ScopeDetail[models.AzuredevopsRepo,
models.AzuredevopsScopeConfig],
) (coreModels.PipelinePlan, errors.Error) {
plans := make(coreModels.PipelinePlan, 0, 3*len(scopeDetails))
+
for _, scope := range scopeDetails {
- azuredevopsRepo, scopeConfig := scope.Scope, scope.ScopeConfig
- var stage coreModels.PipelineStage
- var err errors.Error
+ repo, scopeConfig := scope.Scope, scope.ScopeConfig
+
+ if len(scopeConfig.Entities) == 0 {
Review Comment:
scopeConfig.Entities are considered as "All Entities".
##########
backend/plugins/azuredevops_go/api/blueprint_v200.go:
##########
@@ -71,52 +69,39 @@ func makeScopeV200(
sc := make([]plugin.Scope, 0, 3*len(scopeDetails))
for _, scope := range scopeDetails {
- azuredevopsRepo, scopeConfig := scope.Scope, scope.ScopeConfig
- if azuredevopsRepo.Type != models.RepositoryTypeADO {
+ repo, scopeConfig := scope.Scope, scope.ScopeConfig
+
+ if len(scopeConfig.Entities) == 0 {
Review Comment:
Currently, we are treating this condition as Selected All because it has no
point to collect a scope without any entity.
##########
backend/plugins/azuredevops_go/models/migrationscripts/20246008_support_disabled_repos.go:
##########
@@ -0,0 +1,54 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+ "github.com/apache/incubator-devlake/core/context"
+ "github.com/apache/incubator-devlake/core/dal"
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/helpers/migrationhelper"
+)
+
+type disabledRepos struct{}
+
+type SupportDisabledRepos struct {
+ IsDisabled bool
+}
+
+func (SupportDisabledRepos) TableName() string {
+ return "_tool_azuredevops_go_repos"
+}
+
+func (*disabledRepos) Up(baseRes context.BasicRes) errors.Error {
+ err := migrationhelper.AutoMigrateTables(baseRes,
&SupportDisabledRepos{})
+ if err != nil {
+ return err
+ }
+
+ return baseRes.GetDal().UpdateColumn(
+ &SupportDisabledRepos{}, "is_disabled", false,
+ dal.Where("is_disabled IS NULL"))
+}
+
+func (*disabledRepos) Version() uint64 {
+ return 20240806100000
Review Comment:
the numbers from the file name and the version are different and both
incorrect.
##########
backend/plugins/azuredevops_go/api/blueprint_v200.go:
##########
@@ -126,62 +111,91 @@ func makePipelinePlanV200(
scopeDetails []*srvhelper.ScopeDetail[models.AzuredevopsRepo,
models.AzuredevopsScopeConfig],
) (coreModels.PipelinePlan, errors.Error) {
plans := make(coreModels.PipelinePlan, 0, 3*len(scopeDetails))
+
for _, scope := range scopeDetails {
- azuredevopsRepo, scopeConfig := scope.Scope, scope.ScopeConfig
- var stage coreModels.PipelineStage
- var err errors.Error
+ repo, scopeConfig := scope.Scope, scope.ScopeConfig
+
+ if len(scopeConfig.Entities) == 0 {
+ logger.Printf("Precondition failed. Found empty
ScopeConfig for Scope: %v. Skipping",
+ repo.Name)
+ continue
+ }
options := make(map[string]interface{})
Review Comment:
We have some utility functions to help generate `tasks` and `scopes` , not
sure if it could help but you may want to take a look
https://github.com/apache/incubator-devlake/blob/5e3a4d7337ded3b27db1931e074a5a46cb1aaca8/backend/plugins/pagerduty/api/blueprint_v200.go
##########
backend/plugins/azuredevops_go/tasks/pr_commit_collector.go:
##########
@@ -39,7 +39,7 @@ var CollectApiPullRequestCommitsMeta = plugin.SubTaskMeta{
EntryPoint: CollectApiPullRequestCommits,
EnabledByDefault: true,
Description: "Collect PullRequestCommits data from Azure DevOps
API.",
- DomainTypes: []string{plugin.DOMAIN_TYPE_CROSS,
plugin.DOMAIN_TYPE_CODE_REVIEW},
Review Comment:
"Code review" should be included alongside "Cross Domain".
"Cross Domain" means it would produce "accounts" records as a byproduct.
"Source Code Management" should not be included because it represents the
`git repo` code base itself.
"Domain Types" are meant to select which subtasks to run but not limit what
they could produce. It is simpler this way and most likey more desirable for
users.
--
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]