Skip to content

Commit 2b28df2

Browse files
fix: gitlab server extract deployment may fail (#6754) (#6756)
Co-authored-by: Klesh Wong <zhenmian.huang@merico.dev>
1 parent c10065d commit 2b28df2

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

backend/plugins/gitlab/models/deployment.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ type GitlabDeployment struct {
2929
ConnectionId uint64 `json:"connection_id" gorm:"primaryKey"`
3030
GitlabId int `json:"gitlab_id" gorm:"primaryKey"`
3131

32-
CreatedDate time.Time `json:"created_date"`
33-
UpdatedDate time.Time `json:"updated_date"`
34-
Status string `json:"status"` //created, running, success, failed, canceled, or blocked
32+
CreatedDate time.Time `json:"created_date"`
33+
UpdatedDate *time.Time `json:"updated_date"`
34+
Status string `json:"status"` //created, running, success, failed, canceled, or blocked
3535

3636
DeploymentId int `json:"id" gorm:"primaryKey"`
3737
Iid int `json:"iid"`
@@ -78,13 +78,13 @@ type GitlabDeployment struct {
7878
DeployableUserWebsiteURL string `json:"deployable_user_website_url" gorm:"type:varchar(255)"`
7979
DeployableUserOrganization string `json:"deployable_user_organization" gorm:"type:varchar(255)"`
8080

81-
DeployablePipelineCreatedAt time.Time `json:"deployable_pipeline_created_at"`
82-
DeployablePipelineID int `json:"deployable_pipeline_id"`
83-
DeployablePipelineRef string `json:"deployable_pipeline_ref" gorm:"type:varchar(255)"`
84-
DeployablePipelineSha string `json:"deployable_pipeline_sha" gorm:"type:varchar(255)"`
85-
DeployablePipelineStatus string `json:"deployable_pipeline_status" gorm:"type:varchar(255)"`
86-
DeployablePipelineUpdatedAt time.Time `json:"deployable_pipeline_updated_at"`
87-
DeployablePipelineWebURL string `json:"deployable_pipeline_web_url" gorm:"type:varchar(255)"`
81+
DeployablePipelineCreatedAt *time.Time `json:"deployable_pipeline_created_at"`
82+
DeployablePipelineID int `json:"deployable_pipeline_id"`
83+
DeployablePipelineRef string `json:"deployable_pipeline_ref" gorm:"type:varchar(255)"`
84+
DeployablePipelineSha string `json:"deployable_pipeline_sha" gorm:"type:varchar(255)"`
85+
DeployablePipelineStatus string `json:"deployable_pipeline_status" gorm:"type:varchar(255)"`
86+
DeployablePipelineUpdatedAt *time.Time `json:"deployable_pipeline_updated_at"`
87+
DeployablePipelineWebURL string `json:"deployable_pipeline_web_url" gorm:"type:varchar(255)"`
8888

8989
UserAvatarURL string `json:"user_avatar_url" gorm:"type:varchar(255)"`
9090
UserID int `json:"user_id"`

backend/plugins/gitlab/tasks/deployment_extractor.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func ExtractDeployment(taskCtx plugin.SubTaskContext) errors.Error {
7070

7171
type GitlabDeploymentResp struct {
7272
CreatedAt time.Time `json:"created_at"`
73-
UpdatedAt time.Time `json:"updated_at"`
73+
UpdatedAt *time.Time `json:"updated_at"`
7474
Status string `json:"status"`
7575
Deployable GitlabDeploymentDeployable `json:"deployable"`
7676
Environment GitlabDeploymentEnvironment `json:"environment"`
@@ -178,13 +178,13 @@ type GitlabDeploymentFullUser struct {
178178
}
179179

180180
type GitlabDeploymentPipeline struct {
181-
CreatedAt time.Time `json:"created_at"`
182-
ID int `json:"id"`
183-
Ref string `json:"ref"`
184-
Sha string `json:"sha"`
185-
Status string `json:"status"`
186-
UpdatedAt time.Time `json:"updated_at"`
187-
WebURL string `json:"web_url"`
181+
CreatedAt *time.Time `json:"created_at"`
182+
ID int `json:"id"`
183+
Ref string `json:"ref"`
184+
Sha string `json:"sha"`
185+
Status string `json:"status"`
186+
UpdatedAt *time.Time `json:"updated_at"`
187+
WebURL string `json:"web_url"`
188188
}
189189

190190
type GitlabDeploymentDeployable struct {

0 commit comments

Comments
 (0)