-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: opsgenie adopts the new dshelpers * fix: typo of circleci proxy endpoint tag * refactor: teambition adopts the new dshelpers * refactor: trello adopts the new dshelpers * refactor: zentao adopts the new dshelpers * fix: linting * fix: teambition e2e * fix: teambition e2e
- Loading branch information
Showing
28 changed files
with
532 additions
and
879 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
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 api | ||
|
||
import ( | ||
"github.com/apache/incubator-devlake/plugins/teambition/models" | ||
"github.com/apache/incubator-devlake/plugins/teambition/tasks" | ||
|
||
"github.com/apache/incubator-devlake/core/errors" | ||
coreModels "github.com/apache/incubator-devlake/core/models" | ||
"github.com/apache/incubator-devlake/core/models/domainlayer/devops" | ||
"github.com/apache/incubator-devlake/core/models/domainlayer/didgen" | ||
"github.com/apache/incubator-devlake/core/plugin" | ||
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api" | ||
"github.com/apache/incubator-devlake/helpers/srvhelper" | ||
) | ||
|
||
func MakeDataSourcePipelinePlanV200( | ||
subtaskMetas []plugin.SubTaskMeta, | ||
connectionId uint64, | ||
bpScopes []*coreModels.BlueprintScope, | ||
) (coreModels.PipelinePlan, []plugin.Scope, errors.Error) { | ||
connection, err := dsHelper.ConnSrv.FindByPk(connectionId) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
scopeDetails, err := dsHelper.ScopeSrv.MapScopeDetails(connectionId, bpScopes) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
plan, err := makePipelinePlanV200(subtaskMetas, scopeDetails, connection) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
scopes, err := makeScopesV200(scopeDetails, connection) | ||
return plan, scopes, err | ||
} | ||
|
||
func makePipelinePlanV200( | ||
subtaskMetas []plugin.SubTaskMeta, | ||
scopeDetails []*srvhelper.ScopeDetail[models.TeambitionProject, srvhelper.NoScopeConfig], | ||
connection *models.TeambitionConnection, | ||
) (coreModels.PipelinePlan, errors.Error) { | ||
plan := make(coreModels.PipelinePlan, len(scopeDetails)) | ||
for i, scopeDetail := range scopeDetails { | ||
stage := plan[i] | ||
if stage == nil { | ||
stage = coreModels.PipelineStage{} | ||
} | ||
|
||
scope := scopeDetail.Scope | ||
// construct task options for circleci | ||
task, err := helper.MakePipelinePlanTask( | ||
"teambition", | ||
subtaskMetas, | ||
nil, | ||
tasks.TeambitionOptions{ | ||
ConnectionId: connection.ID, | ||
ProjectId: scope.Id, | ||
}, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
stage = append(stage, task) | ||
plan[i] = stage | ||
} | ||
|
||
return plan, nil | ||
} | ||
|
||
func makeScopesV200( | ||
scopeDetails []*srvhelper.ScopeDetail[models.TeambitionProject, srvhelper.NoScopeConfig], | ||
connection *models.TeambitionConnection, | ||
) ([]plugin.Scope, errors.Error) { | ||
scopes := make([]plugin.Scope, 0, len(scopeDetails)) | ||
|
||
idgen := didgen.NewDomainIdGenerator(&models.TeambitionProject{}) | ||
for _, scopeDetail := range scopeDetails { | ||
scope, _ := scopeDetail.Scope, scopeDetail.ScopeConfig | ||
id := idgen.Generate(connection.ID, scope.Id) | ||
|
||
// add cicd_scope to scopes | ||
// if utils.StringsContains(scopeConfig.Entities, plugin.DOMAIN_TYPE_CICD) { | ||
scopes = append(scopes, devops.NewCicdScope(id, scope.Name)) | ||
// } | ||
} | ||
|
||
return scopes, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
backend/plugins/teambition/e2e/snapshot_tables/_tool_teambition_projects.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
connection_id,id,name,logo,description,organization_id,visibility,is_template,creator_id,is_archived,is_suspended,unique_id_prefix,created,updated,start_date,end_date,customfields,created_at,updated_at,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark | ||
1,64132c94f0d59df1c9825ab8,缺陷管理,https://tcs-ga.teambition.net/thumbnail/312qf26a0a3a77f700a4fded1f2a4c19b257/w/600/h/300,"",640b1c30c933fd85bb11ca31,project,0,5f27709685e4266322e2690a,0,0,"",2023-03-16 14:49:56.415,2023-03-16 14:49:56.415,,,[],2023-03-23 14:24:57.135,2023-03-23 14:24:57.135,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_projects,1,"" | ||
connection_id,id,name,logo,description,organization_id,visibility,is_template,creator_id,is_archived,is_suspended,unique_id_prefix,created,updated,start_date,end_date,customfields,created_at,updated_at,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,scope_config_id | ||
1,64132c94f0d59df1c9825ab8,缺陷管理,https://tcs-ga.teambition.net/thumbnail/312qf26a0a3a77f700a4fded1f2a4c19b257/w/600/h/300,"",640b1c30c933fd85bb11ca31,project,0,5f27709685e4266322e2690a,0,0,"",2023-03-16 14:49:56.415,2023-03-16 14:49:56.415,,,[],2023-03-23 14:24:57.135,2023-03-23 14:24:57.135,"{""ConnectionId"":1,""OrganizationId"":"""",""ProjectId"":""64132c94f0d59df1c9825ab8""}",_raw_teambition_api_projects,1,"",0 |
Oops, something went wrong.