fix: gitlab server extract deployment may fail (#6754) (#6756)
Co-authored-by: Klesh Wong <zhenmian.huang@merico.dev>
diff --git a/backend/plugins/gitlab/models/deployment.go b/backend/plugins/gitlab/models/deployment.go
index c2dad5d..d3a01a0 100644
--- a/backend/plugins/gitlab/models/deployment.go
+++ b/backend/plugins/gitlab/models/deployment.go
@@ -29,9 +29,9 @@
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 @@
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 2640374..d8b2727 100644
--- a/backend/plugins/gitlab/tasks/deployment_extractor.go
+++ b/backend/plugins/gitlab/tasks/deployment_extractor.go
@@ -70,7 +70,7 @@
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"`
@@ -178,13 +178,13 @@
}
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 {