You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2024/05/17 08:51:07 UTC
(incubator-devlake) 01/01: refactor: move deployment converter to github_graphql plugin
This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch kw-refactor-move-deployment-converter-to-github_graphql
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 7445e6f2a095934b46c1ba98eb5e15bca696a2da
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Fri May 17 16:50:30 2024 +0800
refactor: move deployment converter to github_graphql plugin
---
backend/plugins/github_graphql/impl/impl.go | 2 +-
.../tasks/deployment_convertor.go | 13 +++++--------
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/backend/plugins/github_graphql/impl/impl.go b/backend/plugins/github_graphql/impl/impl.go
index 58a8d04f6..45050ad98 100644
--- a/backend/plugins/github_graphql/impl/impl.go
+++ b/backend/plugins/github_graphql/impl/impl.go
@@ -131,7 +131,7 @@ func (p GithubGraphql) SubTaskMetas() []plugin.SubTaskMeta {
// deployment
tasks.CollectDeploymentsMeta,
tasks.ExtractDeploymentsMeta,
- githubTasks.ConvertDeploymentsMeta,
+ tasks.ConvertDeploymentsMeta,
// releases
tasks.CollectReleaseMeta,
diff --git a/backend/plugins/github/tasks/deployment_convertor.go b/backend/plugins/github_graphql/tasks/deployment_convertor.go
similarity index 90%
rename from backend/plugins/github/tasks/deployment_convertor.go
rename to backend/plugins/github_graphql/tasks/deployment_convertor.go
index 47cdd2319..fdc439553 100644
--- a/backend/plugins/github/tasks/deployment_convertor.go
+++ b/backend/plugins/github_graphql/tasks/deployment_convertor.go
@@ -28,12 +28,9 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/github/models"
+ restTasks "github.com/apache/incubator-devlake/plugins/github/tasks"
)
-func init() {
- RegisterSubtaskMeta(&ConvertDeploymentsMeta)
-}
-
const (
RAW_DEPLOYMENT_TABLE = "github_deployment"
)
@@ -78,13 +75,13 @@ func ConvertDeployment(taskCtx plugin.SubTaskContext) errors.Error {
CicdScopeId: deploymentScopeIdGen.Generate(githubDeployment.ConnectionId, githubDeployment.GithubId),
Name: githubDeployment.CommitOid,
Result: devops.GetResult(&devops.ResultRule{
- Success: []string{StatusSuccess, StatusInactive, StatusActive},
- Failure: []string{StatusError, StatusFailure},
+ Success: []string{restTasks.StatusSuccess, restTasks.StatusInactive, restTasks.StatusActive},
+ Failure: []string{restTasks.StatusError, restTasks.StatusFailure},
Default: devops.RESULT_DEFAULT,
}, githubDeployment.State),
Status: devops.GetStatus(&devops.StatusRule{
- Done: []string{StatusSuccess, StatusError, StatusFailure, StatusInactive, StatusActive},
- InProgress: []string{StatusInProgress, StatusQueued, StatusWaiting, StatusPending},
+ Done: []string{restTasks.StatusSuccess, restTasks.StatusError, restTasks.StatusFailure, restTasks.StatusInactive, restTasks.StatusActive},
+ InProgress: []string{restTasks.StatusInProgress, restTasks.StatusQueued, restTasks.StatusWaiting, restTasks.StatusPending},
Default: devops.STATUS_OTHER,
}, githubDeployment.State),
OriginalStatus: githubDeployment.State,