Skip to content

feat: api to get pipeline list of blueprints by blueprint_id#2722

Merged
klesh merged 5 commits into
apache:mainfrom
merico-ai:feat#2664
Aug 11, 2022
Merged

feat: api to get pipeline list of blueprints by blueprint_id#2722
klesh merged 5 commits into
apache:mainfrom
merico-ai:feat#2664

Conversation

@abeizn
Copy link
Copy Markdown
Contributor

@abeizn abeizn commented Aug 10, 2022

Summary

Add a new api /blueprints/{id}/pipelines, to return pipelines triggered by blueprints.

results:

{
    "count":3,
    "pipelines":[
        {
            "id":2,
            "createdAt":"2022-08-10T11:54:17.378Z",
            "updatedAt":"2022-08-10T11:58:30.361Z",
            "name":"MY BLUEPRINT 1660132457363",
            "blueprintId":2,
            "plan":[
                [
                    {
                        "plugin":"github",
                        "options":{
                            "repo":"incubator-devlake-website",
                            "owner":"apache",
                            "connectionId":1,
                            "transformationRules":{
                                "prType":"",
                                "refdiff":null,
                                "prComponent":"",
                                "issueTypeBug":"",
                                "issuePriority":"",
                                "issueSeverity":"",
                                "issueComponent":"",
                                "issueTypeIncident":"",
                                "issueTypeRequirement":""
                            }
                        },
                        "subtasks":[
                            "collectApiIssues",
                            "extractApiIssues",
                            "collectApiPullRequests",
                            "extractApiPullRequests",
                            "collectApiComments",
                            "extractApiComments",
                            "collectApiEvents",
                            "extractApiEvents",
                            "collectApiPullRequestCommits",
                            "extractApiPullRequestCommits",
                            "collectApiPullRequestReviews",
                            "extractApiPullRequestReviews",
                            "CollectApiPrReviewCommentsMeta",
                            "extractApiPrReviewComments",
                            "collectApiMilestones",
                            "extractMilestones",
                            "collectAccounts",
                            "extractAccounts",
                            "collectAccountOrg",
                            "ExtractAccountOrg",
                            "enrichPullRequestIssues",
                            "convertRepo",
                            "convertIssues",
                            "convertIssueLabels",
                            "convertPullRequestCommits",
                            "convertPullRequests",
                            "convertPullRequestReviews",
                            "convertPullRequestLabels",
                            "convertPullRequestIssues",
                            "convertIssueComments",
                            "convertPullRequestComments",
                            "convertMilestones",
                            "convertAccounts"
                        ]
                    },
                    {
                        "plugin":"gitextractor",
                        "options":{
                            "url":"https://git:xxxx@github.com/apache/incubator-devlake-website.git",
                            "repoId":"github:GithubRepo:1:484251804"
                        },
                        "subtasks":null
                    }
                ]
            ],
            "totalTasks":2,
            "finishedTasks":1,
            "beganAt":"2022-08-10T11:54:17.598Z",
            "finishedAt":"2022-08-10T11:58:30.36Z",
            "status":"TASK_COMPLETED",
            "message":"",
            "spentSeconds":253,
            "stage":1
        },
        {
            "id":3,
            "createdAt":"2022-08-11T03:14:22.749Z",
            "updatedAt":"2022-08-11T03:16:43.598Z",
            "name":"MY BLUEPRINT 1660187658064",
            "blueprintId":2,
            "plan":[
                [
                    {
                        "plugin":"github",
                        "options":{
                            "repo":"incubator-devlake-website",
                            "owner":"apache",
                            "connectionId":1,
                            "transformationRules":{
                                "prType":"",
                                "refdiff":null,
                                "prComponent":"",
                                "issueTypeBug":"",
                                "issuePriority":"",
                                "issueSeverity":"",
                                "issueComponent":"",
                                "issueTypeIncident":"",
                                "issueTypeRequirement":""
                            }
                        },
                        "subtasks":[
                            "collectApiIssues",
                            "extractApiIssues",
                            "collectApiPullRequests",
                            "extractApiPullRequests",
                            "collectApiComments",
                            "extractApiComments",
                            "collectApiEvents",
                            "extractApiEvents",
                            "collectApiPullRequestCommits",
                            "extractApiPullRequestCommits",
                            "collectApiPullRequestReviews",
                            "extractApiPullRequestReviews",
                            "CollectApiPrReviewCommentsMeta",
                            "extractApiPrReviewComments",
                            "collectApiMilestones",
                            "extractMilestones",
                            "collectAccounts",
                            "extractAccounts",
                            "collectAccountOrg",
                            "ExtractAccountOrg",
                            "enrichPullRequestIssues",
                            "convertRepo",
                            "convertIssues",
                            "convertIssueLabels",
                            "convertPullRequestCommits",
                            "convertPullRequests",
                            "convertPullRequestReviews",
                            "convertPullRequestLabels",
                            "convertPullRequestIssues",
                            "convertIssueComments",
                            "convertPullRequestComments",
                            "convertMilestones",
                            "convertAccounts"
                        ]
                    },
                    {
                        "plugin":"gitextractor",
                        "options":{
                            "url":"https://xxxx@github.com/apache/incubator-devlake-website.git",
                            "repoId":"github:GithubRepo:1:484251804"
                        },
                        "subtasks":null
                    }
                ]
            ],
            "totalTasks":2,
            "finishedTasks":2,
            "beganAt":"2022-08-11T03:14:23.059Z",
            "finishedAt":"2022-08-11T03:16:43.597Z",
            "status":"TASK_COMPLETED",
            "message":"",
            "spentSeconds":140,
            "stage":1
        },
        {
            "id":4,
            "createdAt":"2022-08-11T03:14:25.955Z",
            "updatedAt":"2022-08-11T03:14:26.086Z",
            "name":"MY BLUEPRINT 1660187658064",
            "blueprintId":2,
            "plan":[
                [
                    {
                        "plugin":"github",
                        "options":{
                            "repo":"incubator-devlake-website",
                            "owner":"apache",
                            "connectionId":1,
                            "transformationRules":{
                                "prType":"",
                                "refdiff":null,
                                "prComponent":"",
                                "issueTypeBug":"",
                                "issuePriority":"",
                                "issueSeverity":"",
                                "issueComponent":"",
                                "issueTypeIncident":"",
                                "issueTypeRequirement":""
                            }
                        },
                        "subtasks":[
                            "collectApiIssues",
                            "extractApiIssues",
                            "collectApiPullRequests",
                            "extractApiPullRequests",
                            "collectApiComments",
                            "extractApiComments",
                            "collectApiEvents",
                            "extractApiEvents",
                            "collectApiPullRequestCommits",
                            "extractApiPullRequestCommits",
                            "collectApiPullRequestReviews",
                            "extractApiPullRequestReviews",
                            "CollectApiPrReviewCommentsMeta",
                            "extractApiPrReviewComments",
                            "collectApiMilestones",
                            "extractMilestones",
                            "collectAccounts",
                            "extractAccounts",
                            "collectAccountOrg",
                            "ExtractAccountOrg",
                            "enrichPullRequestIssues",
                            "convertRepo",
                            "convertIssues",
                            "convertIssueLabels",
                            "convertPullRequestCommits",
                            "convertPullRequests",
                            "convertPullRequestReviews",
                            "convertPullRequestLabels",
                            "convertPullRequestIssues",
                            "convertIssueComments",
                            "convertPullRequestComments",
                            "convertMilestones",
                            "convertAccounts"
                        ]
                    },
                    {
                        "plugin":"gitextractor",
                        "options":{
                            "url":"https://xxxx@github.com/apache/incubator-devlake-website.git",
                            "repoId":"github:GithubRepo:1:484251804"
                        },
                        "subtasks":null
                    }
                ]
            ],
            "totalTasks":2,
            "finishedTasks":0,
            "beganAt":"2022-08-11T03:14:26.078Z",
            "finishedAt":null,
            "status":"TASK_RUNNING",
            "message":"",
            "spentSeconds":0,
            "stage":1
        }
    ]
}

Does this close any open issues?

close #2664

Screenshots

image

Other Information

Any other information that is important to this PR.

Comment thread services/blueprint.go Outdated
}

// GetBlueprintPipelines returns a list of pipelines based on blueprint id
func GetBlueprintPipelines(id uint64) ([]*models.Pipeline, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should extend the GetPipelines and re-use it instead of creating a new function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Copy Markdown
Contributor

@klesh klesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@klesh klesh merged commit a7556dd into apache:main Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature][Api] Want api to get pipeline list of blueprints

2 participants