You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by "mappjzc (via GitHub)" <gi...@apache.org> on 2023/02/20 13:23:23 UTC
[GitHub] [incubator-devlake] mappjzc opened a new pull request, #4461: Bamboo scopes and remote api
mappjzc opened a new pull request, #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461
### Summary
`curl --location --request GET 'devlake:8080/plugins/bamboo/connections/3/remote-scopes?groupId=&pageToken='`
```json
{
"children": [{
"type": "scope",
"parentId": null,
"id": "TEST1",
"name": "test_project",
"data": {
"connectionId": 0,
"projectKey": "TEST1",
"name": "test_project",
"description": "just a test project",
"link": "http://54.172.92.89:8085/rest/api/latest/project/TEST1",
"rel": ""
}
}],
"nextPageToken": ""
}
```
`curl --location --request GET 'devlake:8080/plugins/bamboo/connections/3/search-remote-scopes?search=test&page=1&pageSize=100'`
```json
{
"children": [{
"type": "scope",
"parentId": null,
"id": "",
"name": "",
"data": {
"connectionId": 0,
"projectKey": "",
"name": "",
"description": "",
"link": "http://54.172.92.89:8085/rest/api/latest/project/",
"rel": ""
}
}],
"page": 1,
"pageSize": 100
}
```
### Does this close any open issues?
related #3322
### Screenshots



.






--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112913308
##########
backend/plugins/bamboo/api/remote.go:
##########
@@ -0,0 +1,319 @@
+/*
+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 (
+ "context"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/url"
+ "strconv"
+
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/plugin"
+ "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+ "github.com/apache/incubator-devlake/plugins/bamboo/models"
+)
+
+type RemoteScopesChild struct {
+ Type string `json:"type"`
+ ParentId *string `json:"parentId"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Data interface{} `json:"data"`
+}
+
+type RemoteScopesOutput struct {
+ Children []RemoteScopesChild `json:"children"`
+ NextPageToken string `json:"nextPageToken"`
+}
+
+type SearchRemoteScopesOutput struct {
+ Children []RemoteScopesChild `json:"children"`
+ Page int `json:"page"`
+ PageSize int `json:"pageSize"`
+}
+
+type PageData struct {
+ Page int `json:"page"`
+ PageSize int `json:"per_page"`
+}
+
+const BambooRemoteScopesPerPage int = 100
+const TypeProject string = "scope"
+const TypeGroup string = "group"
+
+// RemoteScopes list all available scope for users
+// @Summary list all available scope for users
+// @Description list all available scope for users
+// @Tags plugins/bamboo
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param groupId query string false "group ID"
+// @Param pageToken query string false "page Token"
+// @Success 200 {object} RemoteScopesOutput
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/bamboo/connections/{connectionId}/remote-scopes [GET]
+func RemoteScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
+ connectionId, _ := extractParam(input.Params)
+ if connectionId == 0 {
+ return nil, errors.BadInput.New("invalid connectionId")
+ }
+
+ connection := &models.BambooConnection{}
+ err := connectionHelper.First(connection, input.Params)
+ if err != nil {
+ return nil, err
+ }
+
+ groupId, ok := input.Query["groupId"]
+ if !ok || len(groupId) == 0 {
+ groupId = []string{""}
+ }
+
+ pageToken, ok := input.Query["pageToken"]
+ if !ok || len(pageToken) == 0 {
+ pageToken = []string{""}
+ }
+
+ // get gid and pageData
+ gid := groupId[0]
+ pageData, err := GetPageDataFromPageToken(pageToken[0])
+ if err != nil {
+ return nil, errors.BadInput.New("failed to get paget token")
+ }
+
+ // create api client
+ apiClient, err := api.NewApiClientFromConnection(context.TODO(), basicRes, connection)
+ if err != nil {
+ return nil, err
+ }
+
+ var res *http.Response
+ outputBody := &RemoteScopesOutput{}
+
+ query, err := GetQueryFromPageData(pageData)
+ if err != nil {
+ return nil, err
+ }
+
+ res, err = apiClient.Get("/project.json", query, nil)
+
+ if err != nil {
+ return nil, err
+ }
+
+ resBody := models.ApiBambooProjectResponse{}
+ err = api.UnmarshalResponse(res, &resBody)
+ if err != nil {
+ return nil, err
+ }
+
+ // append project to output
+ for _, apiProject := range resBody.Projects.Projects {
+ project := (&models.BambooProject{}).Convert(&apiProject)
+ child := RemoteScopesChild{
+ Type: TypeProject,
+ Id: project.ProjectKey,
+ Name: project.Name,
+ Data: project,
+ }
+ child.ParentId = &gid
+ if *child.ParentId == "" {
+ child.ParentId = nil
+ }
+
+ outputBody.Children = append(outputBody.Children, child)
+ }
+
+ // check project count
+ if len(resBody.Projects.Projects) < pageData.PageSize {
+ pageData = nil
+ }
+
+ // get the next page token
+ outputBody.NextPageToken = ""
+ if pageData != nil {
+ pageData.Page += 1
+ pageData.PageSize = BambooRemoteScopesPerPage
+
+ outputBody.NextPageToken, err = GetPageTokenFromPageData(pageData)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ return &plugin.ApiResourceOutput{Body: outputBody, Status: http.StatusOK}, nil
+}
+
+// SearchRemoteScopes use the Search API and only return project
+// @Summary use the Search API and only return project
+// @Description use the Search API and only return project
+// @Tags plugins/bamboo
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param search query string false "search"
+// @Param page query int false "page number"
+// @Param pageSize query int false "page size per page"
+// @Success 200 {object} SearchRemoteScopesOutput
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/bamboo/connections/{connectionId}/search-remote-scopes [GET]
+func SearchRemoteScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
+ connectionId, _ := extractParam(input.Params)
+ if connectionId == 0 {
+ return nil, errors.BadInput.New("invalid connectionId")
+ }
+
+ connection := &models.BambooConnection{}
+ err := connectionHelper.First(connection, input.Params)
+ if err != nil {
+ return nil, err
+ }
+
+ search, ok := input.Query["search"]
+ if !ok || len(search) == 0 {
+ search = []string{""}
+ }
+
+ var p int
+ var err1 error
+ page, ok := input.Query["page"]
+ if !ok || len(page) == 0 {
+ p = 1
+ } else {
+ p, err1 = strconv.Atoi(page[0])
+ if err != nil {
+ return nil, errors.BadInput.Wrap(err1, fmt.Sprintf("failed to Atoi page:%s", page[0]))
+ }
+ }
+ var ps int
+ pageSize, ok := input.Query["pageSize"]
+ if !ok || len(pageSize) == 0 {
+ ps = BambooRemoteScopesPerPage
+ } else {
+ ps, err1 = strconv.Atoi(pageSize[0])
+ if err1 != nil {
+ return nil, errors.BadInput.Wrap(err1, fmt.Sprintf("failed to Atoi pageSize:%s", pageSize[0]))
+ }
+ }
+ // create api client
+ apiClient, err := api.NewApiClientFromConnection(context.TODO(), basicRes, connection)
+ if err != nil {
+ return nil, err
+ }
+
+ // set query
+ query, err := GetQueryForSearchProject(search[0], p, ps)
+ if err != nil {
+ return nil, err
+ }
+
+ // request search
+ res, err := apiClient.Get("search/projects.json", query, nil)
+ if err != nil {
+ return nil, err
+ }
+ resBody := models.ApiBambooSearchProjectResponse{}
+ err = api.UnmarshalResponse(res, &resBody)
+ if err != nil {
+ return nil, err
+ }
+
+ outputBody := &SearchRemoteScopesOutput{}
+
+ // append project to output
+ for _, apiResult := range resBody.SearchResults {
+ var project models.BambooProject
+ apiProject, err := GetApiProject(apiResult.SearchEntity.Key, apiClient)
+ if err != nil {
+ return nil, err
+ }
+
+ project.Convert(apiProject)
+ child := RemoteScopesChild{
+ Type: TypeProject,
+ Id: project.ProjectKey,
+ ParentId: nil,
+ Name: project.Name,
+ Data: project,
+ }
+
+ outputBody.Children = append(outputBody.Children, child)
+ }
+
+ outputBody.Page = p
+ outputBody.PageSize = ps
+
+ return &plugin.ApiResourceOutput{Body: outputBody, Status: http.StatusOK}, nil
+}
+
+func GetPageTokenFromPageData(pageData *PageData) (string, errors.Error) {
+ // Marshal json
+ pageTokenDecode, err := json.Marshal(pageData)
+ if err != nil {
+ return "", errors.Default.Wrap(err, fmt.Sprintf("Marshal pageToken failed %+v", pageData))
+ }
+
+ // Encode pageToken Base64
+ return base64.StdEncoding.EncodeToString(pageTokenDecode), nil
+}
+
+func GetPageDataFromPageToken(pageToken string) (*PageData, errors.Error) {
+ if pageToken == "" {
+ return &PageData{
+ Page: 1,
+ PageSize: BambooRemoteScopesPerPage,
+ }, nil
+ }
+
+ // Decode pageToken Base64
+ pageTokenDecode, err := base64.StdEncoding.DecodeString(pageToken)
+ if err != nil {
+ return nil, errors.Default.Wrap(err, fmt.Sprintf("decode pageToken failed %s", pageToken))
+ }
+ // Unmarshal json
+ pt := &PageData{}
+ err = json.Unmarshal(pageTokenDecode, pt)
+ if err != nil {
+ return nil, errors.Default.Wrap(err, fmt.Sprintf("json Unmarshal pageTokenDecode failed %s", pageTokenDecode))
+ }
+
+ return pt, nil
+}
+
+func GetQueryFromPageData(pageData *PageData) (url.Values, errors.Error) {
Review Comment:
url.Values is enough
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112663414
##########
backend/plugins/bamboo/models/plan.go:
##########
@@ -43,26 +43,25 @@ type BambooPlan struct {
common.NoPKModel
}
-func (BambooPlan) Convert(apiProject *ApiBambooPlan) *BambooPlan {
- b := &BambooPlan{
- PlanKey: apiProject.Key,
- Name: apiProject.Name,
- Expand: apiProject.Expand,
- ProjectKey: apiProject.ProjectKey,
- ProjectName: apiProject.ProjectName,
- Description: apiProject.Description,
- ShortName: apiProject.ShortName,
- BuildName: apiProject.BuildName,
- ShortKey: apiProject.ShortKey,
- Type: apiProject.Type,
- Enabled: apiProject.Enabled,
- Href: apiProject.Href,
- Rel: apiProject.Rel,
- IsFavourite: apiProject.IsFavourite,
- IsActive: apiProject.IsActive,
- IsBuilding: apiProject.IsBuilding,
- AverageBuildTimeInSeconds: apiProject.AverageBuildTimeInSeconds,
- }
Review Comment:
Why do Hou change this?
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112662245
##########
backend/plugins/bamboo/impl/impl.go:
##########
@@ -63,6 +63,8 @@ func (p Bamboo) TransformationRule() interface{} {
}
func (p Bamboo) MakeDataSourcePipelinePlanV200(connectionId uint64, scopes []*plugin.BlueprintScopeV200, syncPolicy plugin.BlueprintSyncPolicy) (plugin.PipelinePlan, []plugin.Scope, errors.Error) {
+ // 测试
+ fmt.Printf("MakeDataSourcePipelinePlanV200\r\n")
Review Comment:
Please delete this
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112926651
##########
backend/plugins/bamboo/models/job.go:
##########
@@ -37,17 +37,16 @@ type BambooJob struct {
common.NoPKModel
}
-func (BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
- b := &BambooJob{
- JobKey: apiRes.SearchEntity.Key,
- Id: apiRes.Id,
- Name: apiRes.SearchEntity.JobName,
- PlanName: apiRes.SearchEntity.PlanName,
- ProjectName: apiRes.SearchEntity.ProjectName,
- Description: apiRes.SearchEntity.Description,
- BranchName: apiRes.SearchEntity.BranchName,
- Type: apiRes.SearchEntity.Type,
- }
+func (b *BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
Review Comment:
I don't think any one would do that thing, well, if you change it to this, BambooJob will have two methods, one's receiver is pointer, one's is value. Hmm, maybe we'd better use func ConvertJob() is better
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112657568
##########
backend/plugins/bamboo/api/blueprint_v200.go:
##########
@@ -57,6 +57,11 @@ func MakePipelinePlanV200(
return nil, nil, err
}
+ // 测试
+ fmt.Printf("MakePipelinePlanV200\r\n")
+ fmt.Printf("pp:%+v\r\n", pp)
+ fmt.Printf("sc:%+v\r\n", sc)
Review Comment:
Please delete this block
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112661199
##########
backend/plugins/bamboo/api/scope.go:
##########
@@ -0,0 +1,241 @@
+/*
+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 (
+ "context"
+ "net/http"
+ "strconv"
+ "time"
+
+ "github.com/apache/incubator-devlake/core/dal"
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/plugin"
+ "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+ "github.com/apache/incubator-devlake/plugins/bamboo/models"
+ "github.com/mitchellh/mapstructure"
+)
+
+type apiProject struct {
+ models.BambooProject
+ TransformationRuleName string `json:"transformationRuleName,omitempty"`
+}
+
+type req struct {
+ Data []*models.BambooProject `json:"data"`
+}
+
+// PutScope create or update bamboo project
+// @Summary create or update bamboo project
+// @Description Create or update bamboo project
+// @Tags plugins/bamboo
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param scope body req true "json"
+// @Success 200 {object} []models.BambooProject
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/bamboo/connections/{connectionId}/scopes [PUT]
+func PutScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
+ connectionId, _ := extractParam(input.Params)
+
+ if connectionId == 0 {
+ return nil, errors.BadInput.New("invalid connectionId")
+ }
+ var projects req
+ err := errors.Convert(mapstructure.Decode(input.Body, &projects))
+ if err != nil {
+ return nil, errors.BadInput.Wrap(err, "decoding Bamboo project error")
+ }
+ keeper := make(map[string]struct{})
+ now := time.Now()
+ for _, project := range projects.Data {
+ if _, ok := keeper[project.ProjectKey]; ok {
+ return nil, errors.BadInput.New("duplicated item")
+ } else {
+ keeper[project.ProjectKey] = struct{}{}
+ }
+ project.ConnectionId = connectionId
+ project.CreatedAt = now
Review Comment:
CreatedAt will be generated by db
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112659755
##########
backend/plugins/bamboo/api/remote.go:
##########
@@ -0,0 +1,336 @@
+/*
+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 (
+ "context"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/url"
+ "strconv"
+
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/plugin"
+ "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+ "github.com/apache/incubator-devlake/plugins/bamboo/models"
+)
+
+type RemoteScopesChild struct {
+ Type string `json:"type"`
+ ParentId *string `json:"parentId"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Data interface{} `json:"data"`
+}
+
+type RemoteScopesOutput struct {
+ Children []RemoteScopesChild `json:"children"`
+ NextPageToken string `json:"nextPageToken"`
+}
+
+type SearchRemoteScopesOutput struct {
+ Children []RemoteScopesChild `json:"children"`
+ Page int `json:"page"`
+ PageSize int `json:"pageSize"`
+}
+
+type PageData struct {
+ Page int `json:"page"`
+ PageSize int `json:"per_page"`
+}
+
+type GroupResponse struct {
Review Comment:
Bamboo doesn’t have group
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112915111
##########
backend/plugins/bamboo/impl/impl.go:
##########
@@ -186,11 +187,25 @@ func (p Bamboo) ApiResources() map[string]map[string]plugin.ApiResourceHandler {
"PATCH": api.PatchConnection,
"DELETE": api.DeleteConnection,
},
+ "connections/:connectionId/scopes": {
+ "GET": api.GetScopeList,
+ "PUT": api.PutScope,
+ },
+ "connections/:connectionId/remote-scopes": {
+ "GET": api.RemoteScopes,
+ },
+ "connections/:connectionId/search-remote-scopes": {
+ "GET": api.SearchRemoteScopes,
+ },
+ "connections/:connectionId/scopes/:projectKey": {
+ "GET": api.GetScope,
+ "PATCH": api.UpdateScope,
+ },
}
}
func (p Bamboo) MakePipelinePlan(connectionId uint64, scope []*plugin.BlueprintScopeV100) (plugin.PipelinePlan, errors.Error) {
- return nil, errors.Default.New("Bamboo does not support blueprint v100")
+ return nil, errors.Default.New("Bamboo don't support blueprint v100")
Review Comment:
`does not` is right
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112662475
##########
backend/plugins/bamboo/impl/impl.go:
##########
@@ -186,11 +188,27 @@ func (p Bamboo) ApiResources() map[string]map[string]plugin.ApiResourceHandler {
"PATCH": api.PatchConnection,
"DELETE": api.DeleteConnection,
},
+ "connections/:connectionId/scopes": {
+ "GET": api.GetScopeList,
+ "PUT": api.PutScope,
+ },
+ "connections/:connectionId/remote-scopes": {
+ "GET": api.RemoteScopes,
+ },
+ "connections/:connectionId/search-remote-scopes": {
+ "GET": api.SearchRemoteScopes,
+ },
+ "connections/:connectionId/scopes/:projectKey": {
+ "GET": api.GetScope,
+ "PATCH": api.UpdateScope,
+ },
}
}
func (p Bamboo) MakePipelinePlan(connectionId uint64, scope []*plugin.BlueprintScopeV100) (plugin.PipelinePlan, errors.Error) {
- return nil, errors.Default.New("Bamboo does not support blueprint v100")
+ // 测试
+ fmt.Printf("MakePipelinePlan\r\n")
Review Comment:
Please delete
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 merged PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112912814
##########
backend/plugins/bamboo/api/remote.go:
##########
@@ -0,0 +1,319 @@
+/*
+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 (
+ "context"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/url"
+ "strconv"
+
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/plugin"
+ "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+ "github.com/apache/incubator-devlake/plugins/bamboo/models"
+)
+
+type RemoteScopesChild struct {
+ Type string `json:"type"`
+ ParentId *string `json:"parentId"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Data interface{} `json:"data"`
+}
+
+type RemoteScopesOutput struct {
+ Children []RemoteScopesChild `json:"children"`
+ NextPageToken string `json:"nextPageToken"`
+}
+
+type SearchRemoteScopesOutput struct {
+ Children []RemoteScopesChild `json:"children"`
+ Page int `json:"page"`
+ PageSize int `json:"pageSize"`
+}
+
+type PageData struct {
+ Page int `json:"page"`
+ PageSize int `json:"per_page"`
+}
+
+const BambooRemoteScopesPerPage int = 100
+const TypeProject string = "scope"
+const TypeGroup string = "group"
+
+// RemoteScopes list all available scope for users
+// @Summary list all available scope for users
+// @Description list all available scope for users
+// @Tags plugins/bamboo
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param groupId query string false "group ID"
+// @Param pageToken query string false "page Token"
+// @Success 200 {object} RemoteScopesOutput
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/bamboo/connections/{connectionId}/remote-scopes [GET]
+func RemoteScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
+ connectionId, _ := extractParam(input.Params)
+ if connectionId == 0 {
+ return nil, errors.BadInput.New("invalid connectionId")
+ }
+
+ connection := &models.BambooConnection{}
+ err := connectionHelper.First(connection, input.Params)
+ if err != nil {
+ return nil, err
+ }
+
+ groupId, ok := input.Query["groupId"]
+ if !ok || len(groupId) == 0 {
+ groupId = []string{""}
+ }
+
+ pageToken, ok := input.Query["pageToken"]
+ if !ok || len(pageToken) == 0 {
+ pageToken = []string{""}
+ }
+
+ // get gid and pageData
+ gid := groupId[0]
+ pageData, err := GetPageDataFromPageToken(pageToken[0])
+ if err != nil {
+ return nil, errors.BadInput.New("failed to get paget token")
+ }
+
+ // create api client
+ apiClient, err := api.NewApiClientFromConnection(context.TODO(), basicRes, connection)
+ if err != nil {
+ return nil, err
+ }
+
+ var res *http.Response
+ outputBody := &RemoteScopesOutput{}
+
+ query, err := GetQueryFromPageData(pageData)
+ if err != nil {
+ return nil, err
+ }
+
+ res, err = apiClient.Get("/project.json", query, nil)
+
+ if err != nil {
+ return nil, err
+ }
+
+ resBody := models.ApiBambooProjectResponse{}
+ err = api.UnmarshalResponse(res, &resBody)
+ if err != nil {
+ return nil, err
+ }
+
+ // append project to output
+ for _, apiProject := range resBody.Projects.Projects {
+ project := (&models.BambooProject{}).Convert(&apiProject)
+ child := RemoteScopesChild{
+ Type: TypeProject,
+ Id: project.ProjectKey,
+ Name: project.Name,
+ Data: project,
+ }
+ child.ParentId = &gid
+ if *child.ParentId == "" {
+ child.ParentId = nil
+ }
+
+ outputBody.Children = append(outputBody.Children, child)
+ }
+
+ // check project count
+ if len(resBody.Projects.Projects) < pageData.PageSize {
+ pageData = nil
+ }
+
+ // get the next page token
+ outputBody.NextPageToken = ""
+ if pageData != nil {
+ pageData.Page += 1
+ pageData.PageSize = BambooRemoteScopesPerPage
+
+ outputBody.NextPageToken, err = GetPageTokenFromPageData(pageData)
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ return &plugin.ApiResourceOutput{Body: outputBody, Status: http.StatusOK}, nil
+}
+
+// SearchRemoteScopes use the Search API and only return project
+// @Summary use the Search API and only return project
+// @Description use the Search API and only return project
+// @Tags plugins/bamboo
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param search query string false "search"
+// @Param page query int false "page number"
+// @Param pageSize query int false "page size per page"
+// @Success 200 {object} SearchRemoteScopesOutput
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/bamboo/connections/{connectionId}/search-remote-scopes [GET]
+func SearchRemoteScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
+ connectionId, _ := extractParam(input.Params)
+ if connectionId == 0 {
+ return nil, errors.BadInput.New("invalid connectionId")
+ }
+
+ connection := &models.BambooConnection{}
+ err := connectionHelper.First(connection, input.Params)
+ if err != nil {
+ return nil, err
+ }
+
+ search, ok := input.Query["search"]
+ if !ok || len(search) == 0 {
+ search = []string{""}
+ }
+
+ var p int
+ var err1 error
+ page, ok := input.Query["page"]
+ if !ok || len(page) == 0 {
+ p = 1
+ } else {
+ p, err1 = strconv.Atoi(page[0])
+ if err != nil {
+ return nil, errors.BadInput.Wrap(err1, fmt.Sprintf("failed to Atoi page:%s", page[0]))
+ }
+ }
+ var ps int
+ pageSize, ok := input.Query["pageSize"]
+ if !ok || len(pageSize) == 0 {
+ ps = BambooRemoteScopesPerPage
+ } else {
+ ps, err1 = strconv.Atoi(pageSize[0])
+ if err1 != nil {
+ return nil, errors.BadInput.Wrap(err1, fmt.Sprintf("failed to Atoi pageSize:%s", pageSize[0]))
+ }
+ }
+ // create api client
+ apiClient, err := api.NewApiClientFromConnection(context.TODO(), basicRes, connection)
+ if err != nil {
+ return nil, err
+ }
+
+ // set query
+ query, err := GetQueryForSearchProject(search[0], p, ps)
+ if err != nil {
+ return nil, err
+ }
+
+ // request search
+ res, err := apiClient.Get("search/projects.json", query, nil)
+ if err != nil {
+ return nil, err
+ }
+ resBody := models.ApiBambooSearchProjectResponse{}
+ err = api.UnmarshalResponse(res, &resBody)
+ if err != nil {
+ return nil, err
+ }
+
+ outputBody := &SearchRemoteScopesOutput{}
+
+ // append project to output
+ for _, apiResult := range resBody.SearchResults {
+ var project models.BambooProject
+ apiProject, err := GetApiProject(apiResult.SearchEntity.Key, apiClient)
+ if err != nil {
+ return nil, err
+ }
+
+ project.Convert(apiProject)
+ child := RemoteScopesChild{
+ Type: TypeProject,
+ Id: project.ProjectKey,
+ ParentId: nil,
+ Name: project.Name,
+ Data: project,
+ }
+
+ outputBody.Children = append(outputBody.Children, child)
+ }
+
+ outputBody.Page = p
+ outputBody.PageSize = ps
+
+ return &plugin.ApiResourceOutput{Body: outputBody, Status: http.StatusOK}, nil
+}
+
+func GetPageTokenFromPageData(pageData *PageData) (string, errors.Error) {
+ // Marshal json
+ pageTokenDecode, err := json.Marshal(pageData)
+ if err != nil {
+ return "", errors.Default.Wrap(err, fmt.Sprintf("Marshal pageToken failed %+v", pageData))
+ }
+
+ // Encode pageToken Base64
+ return base64.StdEncoding.EncodeToString(pageTokenDecode), nil
+}
+
+func GetPageDataFromPageToken(pageToken string) (*PageData, errors.Error) {
+ if pageToken == "" {
+ return &PageData{
+ Page: 1,
+ PageSize: BambooRemoteScopesPerPage,
+ }, nil
+ }
+
+ // Decode pageToken Base64
+ pageTokenDecode, err := base64.StdEncoding.DecodeString(pageToken)
+ if err != nil {
+ return nil, errors.Default.Wrap(err, fmt.Sprintf("decode pageToken failed %s", pageToken))
+ }
+ // Unmarshal json
+ pt := &PageData{}
+ err = json.Unmarshal(pageTokenDecode, pt)
+ if err != nil {
+ return nil, errors.Default.Wrap(err, fmt.Sprintf("json Unmarshal pageTokenDecode failed %s", pageTokenDecode))
+ }
+
+ return pt, nil
+}
+
+func GetQueryFromPageData(pageData *PageData) (url.Values, errors.Error) {
+ query := url.Values{}
+ query.Set("showEmpty", fmt.Sprintf("%v", true))
+ query.Set("max-result", fmt.Sprintf("%v", pageData.PageSize))
+ query.Set("start-index", fmt.Sprintf("%v", (pageData.Page-1)*pageData.PageSize))
Review Comment:
use pageData.skip to replace (pageData.Page-1)*pageData.PageSize
--
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] mappjzc commented on a diff in pull request #4461: Bamboo scopes and remote api
Posted by "mappjzc (via GitHub)" <gi...@apache.org>.
mappjzc commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112668266
##########
backend/plugins/bamboo/api/blueprint_V200_test.go:
##########
@@ -94,13 +95,17 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
var expectRepoId = "bamboo:BambooProject:1:TEST"
- var testSubTaskMeta = []plugin.SubTaskMeta{}
+ var testSubTaskMeta = []plugin.SubTaskMeta{
+ tasks.ConvertProjectsMeta,
+ }
var expectPlans = plugin.PipelinePlan{
{
{
- Plugin: "bamboo",
- Subtasks: []string{},
+ Plugin: "bamboo",
+ Subtasks: []string{
+ tasks.ConvertProjectsMeta.Name,
+ },
Review Comment:
we need subtask to unit test the subtask create part.
##########
backend/plugins/bamboo/models/job.go:
##########
@@ -37,17 +37,16 @@ type BambooJob struct {
common.NoPKModel
}
-func (BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
- b := &BambooJob{
- JobKey: apiRes.SearchEntity.Key,
- Id: apiRes.Id,
- Name: apiRes.SearchEntity.JobName,
- PlanName: apiRes.SearchEntity.PlanName,
- ProjectName: apiRes.SearchEntity.ProjectName,
- Description: apiRes.SearchEntity.Description,
- BranchName: apiRes.SearchEntity.BranchName,
- Type: apiRes.SearchEntity.Type,
- }
+func (b *BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
Review Comment:
a := &BambooJob{}
b := a.Convert()
that will make a and b to be diffrent.
So it need to be fixed.
##########
backend/plugins/bamboo/models/plan.go:
##########
@@ -43,26 +43,25 @@ type BambooPlan struct {
common.NoPKModel
}
-func (BambooPlan) Convert(apiProject *ApiBambooPlan) *BambooPlan {
- b := &BambooPlan{
- PlanKey: apiProject.Key,
- Name: apiProject.Name,
- Expand: apiProject.Expand,
- ProjectKey: apiProject.ProjectKey,
- ProjectName: apiProject.ProjectName,
- Description: apiProject.Description,
- ShortName: apiProject.ShortName,
- BuildName: apiProject.BuildName,
- ShortKey: apiProject.ShortKey,
- Type: apiProject.Type,
- Enabled: apiProject.Enabled,
- Href: apiProject.Href,
- Rel: apiProject.Rel,
- IsFavourite: apiProject.IsFavourite,
- IsActive: apiProject.IsActive,
- IsBuilding: apiProject.IsBuilding,
- AverageBuildTimeInSeconds: apiProject.AverageBuildTimeInSeconds,
- }
Review Comment:
a := &BambooPlan{}
b := a.Convert()
that will make a and b to be diffrent.
So it need to be fixed
##########
backend/plugins/bamboo/tasks/job_extractor.go:
##########
@@ -44,7 +45,7 @@ func ExtractJob(taskCtx plugin.SubTaskContext) errors.Error {
if err != nil {
return nil, err
}
- body := models.BambooJob{}.Convert(res)
+ body := (&models.BambooJob{}).Convert(res)
Review Comment:
for Convert changed
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112662825
##########
backend/plugins/bamboo/models/job.go:
##########
@@ -37,17 +37,16 @@ type BambooJob struct {
common.NoPKModel
}
-func (BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
- b := &BambooJob{
- JobKey: apiRes.SearchEntity.Key,
- Id: apiRes.Id,
- Name: apiRes.SearchEntity.JobName,
- PlanName: apiRes.SearchEntity.PlanName,
- ProjectName: apiRes.SearchEntity.ProjectName,
- Description: apiRes.SearchEntity.Description,
- BranchName: apiRes.SearchEntity.BranchName,
- Type: apiRes.SearchEntity.Type,
- }
+func (b *BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
Review Comment:
Why do you change this?
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112657082
##########
backend/plugins/bamboo/api/blueprint_V200_test.go:
##########
@@ -94,13 +95,17 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
var expectRepoId = "bamboo:BambooProject:1:TEST"
- var testSubTaskMeta = []plugin.SubTaskMeta{}
+ var testSubTaskMeta = []plugin.SubTaskMeta{
+ tasks.ConvertProjectsMeta,
+ }
var expectPlans = plugin.PipelinePlan{
{
{
- Plugin: "bamboo",
- Subtasks: []string{},
+ Plugin: "bamboo",
+ Subtasks: []string{
+ tasks.ConvertProjectsMeta.Name,
+ },
Review Comment:
Why do you change this?
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112911466
##########
backend/plugins/bamboo/api/remote.go:
##########
@@ -0,0 +1,319 @@
+/*
+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 (
+ "context"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/url"
+ "strconv"
+
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/plugin"
+ "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
+ "github.com/apache/incubator-devlake/plugins/bamboo/models"
+)
+
+type RemoteScopesChild struct {
+ Type string `json:"type"`
+ ParentId *string `json:"parentId"`
+ Id string `json:"id"`
+ Name string `json:"name"`
+ Data interface{} `json:"data"`
+}
+
+type RemoteScopesOutput struct {
+ Children []RemoteScopesChild `json:"children"`
+ NextPageToken string `json:"nextPageToken"`
+}
+
+type SearchRemoteScopesOutput struct {
+ Children []RemoteScopesChild `json:"children"`
+ Page int `json:"page"`
+ PageSize int `json:"pageSize"`
+}
+
+type PageData struct {
+ Page int `json:"page"`
+ PageSize int `json:"per_page"`
+}
+
+const BambooRemoteScopesPerPage int = 100
+const TypeProject string = "scope"
+const TypeGroup string = "group"
+
+// RemoteScopes list all available scope for users
+// @Summary list all available scope for users
+// @Description list all available scope for users
+// @Tags plugins/bamboo
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param groupId query string false "group ID"
+// @Param pageToken query string false "page Token"
+// @Success 200 {object} RemoteScopesOutput
+// @Failure 400 {object} shared.ApiBody "Bad Request"
+// @Failure 500 {object} shared.ApiBody "Internal Error"
+// @Router /plugins/bamboo/connections/{connectionId}/remote-scopes [GET]
+func RemoteScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
+ connectionId, _ := extractParam(input.Params)
+ if connectionId == 0 {
+ return nil, errors.BadInput.New("invalid connectionId")
+ }
+
+ connection := &models.BambooConnection{}
+ err := connectionHelper.First(connection, input.Params)
+ if err != nil {
+ return nil, err
+ }
+
+ groupId, ok := input.Query["groupId"]
+ if !ok || len(groupId) == 0 {
+ groupId = []string{""}
+ }
+
+ pageToken, ok := input.Query["pageToken"]
+ if !ok || len(pageToken) == 0 {
+ pageToken = []string{""}
+ }
+
+ // get gid and pageData
+ gid := groupId[0]
Review Comment:
As bamboo doesn't have group, I think we don't need gid
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112929586
##########
backend/plugins/bamboo/models/job.go:
##########
@@ -37,17 +37,16 @@ type BambooJob struct {
common.NoPKModel
}
-func (BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
- b := &BambooJob{
- JobKey: apiRes.SearchEntity.Key,
- Id: apiRes.Id,
- Name: apiRes.SearchEntity.JobName,
- PlanName: apiRes.SearchEntity.PlanName,
- ProjectName: apiRes.SearchEntity.ProjectName,
- Description: apiRes.SearchEntity.Description,
- BranchName: apiRes.SearchEntity.BranchName,
- Type: apiRes.SearchEntity.Type,
- }
+func (b *BambooJob) Convert(apiRes *ApiBambooJob) *BambooJob {
Review Comment:
If you want to keep this, please delete return value
--
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 #4461: Bamboo scopes and remote api
Posted by "warren830 (via GitHub)" <gi...@apache.org>.
warren830 commented on code in PR #4461:
URL: https://github.com/apache/incubator-devlake/pull/4461#discussion_r1112665574
##########
backend/plugins/bamboo/tasks/job_extractor.go:
##########
@@ -44,7 +45,7 @@ func ExtractJob(taskCtx plugin.SubTaskContext) errors.Error {
if err != nil {
return nil, err
}
- body := models.BambooJob{}.Convert(res)
+ body := (&models.BambooJob{}).Convert(res)
Review Comment:
Why do you change this?
--
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