Skip to content

Commit

Permalink
fix: gitlab server extract deployment may fail (#6754) (#6756)
Browse files Browse the repository at this point in the history
Co-authored-by: Klesh Wong <zhenmian.huang@merico.dev>
  • Loading branch information
github-actions[bot] and klesh authored Jan 5, 2024
1 parent c10065d commit 2b28df2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions backend/plugins/gitlab/models/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
Expand Down
16 changes: 8 additions & 8 deletions backend/plugins/gitlab/tasks/deployment_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -178,13 +178,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 {
Expand Down

0 comments on commit 2b28df2

Please sign in to comment.