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/01/05 08:37:31 UTC

(incubator-devlake) branch kw-gitlab-server-extract-deployment-failure created (now dd0c7502a)

This is an automated email from the ASF dual-hosted git repository.

klesh pushed a change to branch kw-gitlab-server-extract-deployment-failure
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


      at dd0c7502a fix: gitlab server extract deployment may fail

This branch includes the following new commits:

     new dd0c7502a fix: gitlab server extract deployment may fail

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: fix: gitlab server extract deployment may fail

Posted by kl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch kw-gitlab-server-extract-deployment-failure
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit dd0c7502af3d9c487d4d2f6683b3ba61af3c4c26
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Fri Jan 5 16:36:52 2024 +0800

    fix: gitlab server extract deployment may fail
---
 backend/plugins/gitlab/models/deployment.go          | 20 ++++++++++----------
 backend/plugins/gitlab/tasks/deployment_extractor.go | 16 ++++++++--------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/backend/plugins/gitlab/models/deployment.go b/backend/plugins/gitlab/models/deployment.go
index 858f2bc21..50b6564d2 100644
--- a/backend/plugins/gitlab/models/deployment.go
+++ b/backend/plugins/gitlab/models/deployment.go
@@ -29,9 +29,9 @@ type GitlabDeployment struct {
 	ConnectionId uint64 `json:"connection_id" gorm:"primaryKey"`
 	GitlabId     int    `json:"gitlab_id" gorm:"primaryKey"`
 
-	CreatedDate time.Time `json:"created_date"`
-	UpdatedDate time.Time `json:"updated_date"`
-	Status      string    `json:"status"` //created, running, success, failed, canceled, or blocked
+	CreatedDate time.Time  `json:"created_date"`
+	UpdatedDate *time.Time `json:"updated_date"`
+	Status      string     `json:"status"` //created, running, success, failed, canceled, or blocked
 
 	DeploymentId int    `json:"id" gorm:"primaryKey"`
 	Iid          int    `json:"iid"`
@@ -78,13 +78,13 @@ type GitlabDeployment struct {
 	DeployableUserWebsiteURL   string `json:"deployable_user_website_url" gorm:"type:varchar(255)"`
 	DeployableUserOrganization string `json:"deployable_user_organization" gorm:"type:varchar(255)"`
 
-	DeployablePipelineCreatedAt time.Time `json:"deployable_pipeline_created_at"`
-	DeployablePipelineID        int       `json:"deployable_pipeline_id"`
-	DeployablePipelineRef       string    `json:"deployable_pipeline_ref" gorm:"type:varchar(255)"`
-	DeployablePipelineSha       string    `json:"deployable_pipeline_sha" gorm:"type:varchar(255)"`
-	DeployablePipelineStatus    string    `json:"deployable_pipeline_status" gorm:"type:varchar(255)"`
-	DeployablePipelineUpdatedAt time.Time `json:"deployable_pipeline_updated_at"`
-	DeployablePipelineWebURL    string    `json:"deployable_pipeline_web_url" gorm:"type:varchar(255)"`
+	DeployablePipelineCreatedAt *time.Time `json:"deployable_pipeline_created_at"`
+	DeployablePipelineID        int        `json:"deployable_pipeline_id"`
+	DeployablePipelineRef       string     `json:"deployable_pipeline_ref" gorm:"type:varchar(255)"`
+	DeployablePipelineSha       string     `json:"deployable_pipeline_sha" gorm:"type:varchar(255)"`
+	DeployablePipelineStatus    string     `json:"deployable_pipeline_status" gorm:"type:varchar(255)"`
+	DeployablePipelineUpdatedAt *time.Time `json:"deployable_pipeline_updated_at"`
+	DeployablePipelineWebURL    string     `json:"deployable_pipeline_web_url" gorm:"type:varchar(255)"`
 
 	UserAvatarURL string `json:"user_avatar_url" gorm:"type:varchar(255)"`
 	UserID        int    `json:"user_id"`
diff --git a/backend/plugins/gitlab/tasks/deployment_extractor.go b/backend/plugins/gitlab/tasks/deployment_extractor.go
index 98607d337..0e02ab2f0 100644
--- a/backend/plugins/gitlab/tasks/deployment_extractor.go
+++ b/backend/plugins/gitlab/tasks/deployment_extractor.go
@@ -70,7 +70,7 @@ func ExtractDeployment(taskCtx plugin.SubTaskContext) errors.Error {
 
 type GitlabDeploymentResp struct {
 	CreatedAt   time.Time                   `json:"created_at"`
-	UpdatedAt   time.Time                   `json:"updated_at"`
+	UpdatedAt   *time.Time                  `json:"updated_at"`
 	Status      string                      `json:"status"`
 	Deployable  GitlabDeploymentDeployable  `json:"deployable"`
 	Environment GitlabDeploymentEnvironment `json:"environment"`
@@ -179,13 +179,13 @@ type GitlabDeploymentFullUser struct {
 }
 
 type GitlabDeploymentPipeline struct {
-	CreatedAt time.Time `json:"created_at"`
-	ID        int       `json:"id"`
-	Ref       string    `json:"ref"`
-	Sha       string    `json:"sha"`
-	Status    string    `json:"status"`
-	UpdatedAt time.Time `json:"updated_at"`
-	WebURL    string    `json:"web_url"`
+	CreatedAt *time.Time `json:"created_at"`
+	ID        int        `json:"id"`
+	Ref       string     `json:"ref"`
+	Sha       string     `json:"sha"`
+	Status    string     `json:"status"`
+	UpdatedAt *time.Time `json:"updated_at"`
+	WebURL    string     `json:"web_url"`
 }
 
 type GitlabDeploymentDeployable struct {