This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new a58fa1b64 fix(gitlab): fix failed task when collecting deployments
(#6234)
a58fa1b64 is described below
commit a58fa1b64a1fa71b64315b5a6430eb2bda8da2ea
Author: Lynwee <[email protected]>
AuthorDate: Fri Oct 13 11:53:26 2023 +0800
fix(gitlab): fix failed task when collecting deployments (#6234)
* fix(gitlab): fix failed task when collecting deployments
* fix(gitlab): order deployments by `created_at`
* fix(gitlab): order by `created_at` by default
---
backend/plugins/gitlab/tasks/deployment_collector.go | 2 ++
backend/plugins/gitlab/tasks/deployment_convertor.go | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/backend/plugins/gitlab/tasks/deployment_collector.go
b/backend/plugins/gitlab/tasks/deployment_collector.go
index 721ab558e..cdd45f712 100644
--- a/backend/plugins/gitlab/tasks/deployment_collector.go
+++ b/backend/plugins/gitlab/tasks/deployment_collector.go
@@ -60,6 +60,8 @@ func CollectDeployment(taskCtx plugin.SubTaskContext)
errors.Error {
if err != nil {
return query, err
}
+ // https://gitlab.com/gitlab-org/gitlab/-/issues/328500
+ query.Set("order_by", "created_at")
if collectorWithState.Since != nil {
query.Set("updated_after",
collectorWithState.Since.Format(time.RFC3339))
}
diff --git a/backend/plugins/gitlab/tasks/deployment_convertor.go
b/backend/plugins/gitlab/tasks/deployment_convertor.go
index a5faf8986..e2348a98e 100644
--- a/backend/plugins/gitlab/tasks/deployment_convertor.go
+++ b/backend/plugins/gitlab/tasks/deployment_convertor.go
@@ -89,9 +89,9 @@ func ConvertDeployment(taskCtx plugin.SubTaskContext)
errors.Error {
}
}
domainDeployCommit := &devops.CicdDeploymentCommit{
- DomainEntity:
domainlayer.NewDomainEntity(idGen.Generate(data.Options.ConnectionId,
gitlabDeployment.DeploymentId)),
+ DomainEntity:
domainlayer.NewDomainEntity(idGen.Generate(data.Options.ConnectionId,
data.Options.ProjectId, gitlabDeployment.DeploymentId)),
CicdScopeId:
projectIdGen.Generate(data.Options.ConnectionId, data.Options.ProjectId),
- CicdDeploymentId:
idGen.Generate(data.Options.ConnectionId, gitlabDeployment.DeploymentId),
+ CicdDeploymentId:
idGen.Generate(data.Options.ConnectionId, data.Options.ProjectId,
gitlabDeployment.DeploymentId),
Name: fmt.Sprintf("%s:%d",
gitlabDeployment.Name, gitlabDeployment.DeploymentId),
Result: devops.GetResult(&devops.ResultRule{
Failed: []string{"UNDEPLOYED",
"failed"},