Merge pull request #123 from shaheed121/fix_gitlab_payload
Modify Gitlab Job and Pipeline events
This commit is contained in:
+38
-14
@@ -112,7 +112,8 @@ type PipelineEventPayload struct {
|
|||||||
Project Project `json:"project"`
|
Project Project `json:"project"`
|
||||||
Commit Commit `json:"commit"`
|
Commit Commit `json:"commit"`
|
||||||
ObjectAttributes PipelineObjectAttributes `json:"object_attributes"`
|
ObjectAttributes PipelineObjectAttributes `json:"object_attributes"`
|
||||||
Jobs []Job `json:"jobs"`
|
MergeRequest MergeRequest `json:"merge_request"`
|
||||||
|
Builds []Build `json:"builds"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommentEventPayload contains the information for GitLab's comment event
|
// CommentEventPayload contains the information for GitLab's comment event
|
||||||
@@ -158,20 +159,22 @@ type JobEventPayload struct {
|
|||||||
Tag bool `json:"tag"`
|
Tag bool `json:"tag"`
|
||||||
BeforeSHA string `json:"before_sha"`
|
BeforeSHA string `json:"before_sha"`
|
||||||
SHA string `json:"sha"`
|
SHA string `json:"sha"`
|
||||||
JobID int64 `json:"Job_id"`
|
BuildID int64 `json:"build_id"`
|
||||||
JobName string `json:"Job_name"`
|
BuildName string `json:"build_name"`
|
||||||
JobStage string `json:"Job_stage"`
|
BuildStage string `json:"build_stage"`
|
||||||
JobStatus string `json:"Job_status"`
|
BuildStatus string `json:"build_status"`
|
||||||
JobStartedAt customTime `json:"Job_started_at"`
|
BuildStartedAt customTime `json:"build_started_at"`
|
||||||
JobFinishedAt customTime `json:"Job_finished_at"`
|
BuildFinishedAt customTime `json:"build_finished_at"`
|
||||||
JobDuration int64 `json:"Job_duration"`
|
BuildDuration int64 `json:"build_duration"`
|
||||||
Job bool `json:"Job"`
|
BuildAllowFailure bool `json:"build_allow_failure"`
|
||||||
JobFailureReason string `json:"job_failure_reason"`
|
BuildFailureReason string `json:"build_failure_reason"`
|
||||||
|
PipelineID int64 `json:"pipeline_id"`
|
||||||
ProjectID int64 `json:"project_id"`
|
ProjectID int64 `json:"project_id"`
|
||||||
ProjectName string `json:"project_name"`
|
ProjectName string `json:"project_name"`
|
||||||
User User `json:"user"`
|
User User `json:"user"`
|
||||||
Commit BuildCommit `json:"commit"`
|
Commit BuildCommit `json:"commit"`
|
||||||
Repository Repository `json:"repository"`
|
Repository Repository `json:"repository"`
|
||||||
|
Runner Runner `json:"runner"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SystemHookPayload contains the ObjectKind to match with real hook events
|
// SystemHookPayload contains the ObjectKind to match with real hook events
|
||||||
@@ -197,8 +200,8 @@ type Issue struct {
|
|||||||
IID int64 `json:"iid"`
|
IID int64 `json:"iid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Job contains all of the GitLab job information
|
// Build contains all of the GitLab Build information
|
||||||
type Job struct {
|
type Build struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
Stage string `json:"stage"`
|
Stage string `json:"stage"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@@ -240,6 +243,7 @@ type Wiki struct {
|
|||||||
type Commit struct {
|
type Commit struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
|
Title string `json:"title"`
|
||||||
Timestamp customTime `json:"timestamp"`
|
Timestamp customTime `json:"timestamp"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Author Author `json:"author"`
|
Author Author `json:"author"`
|
||||||
@@ -308,24 +312,36 @@ type Repository struct {
|
|||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Homepage string `json:"homepage"`
|
Homepage string `json:"homepage"`
|
||||||
|
GitSSHURL string `json:"git_ssh_url"`
|
||||||
|
GitHTTPURL string `json:"git_http_url"`
|
||||||
|
VisibilityLevel int64 `json:"visibility_level"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectAttributes contains all of the GitLab object attributes information
|
// ObjectAttributes contains all of the GitLab object attributes information
|
||||||
type ObjectAttributes struct {
|
type ObjectAttributes struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
|
AssigneeIDS []int64 `json:"assignee_ids"`
|
||||||
AssigneeID int64 `json:"assignee_id"`
|
AssigneeID int64 `json:"assignee_id"`
|
||||||
AuthorID int64 `json:"author_id"`
|
AuthorID int64 `json:"author_id"`
|
||||||
ProjectID int64 `json:"project_id"`
|
ProjectID int64 `json:"project_id"`
|
||||||
CreatedAt customTime `json:"created_at"`
|
CreatedAt customTime `json:"created_at"`
|
||||||
UpdatedAt customTime `json:"updated_at"`
|
UpdatedAt customTime `json:"updated_at"`
|
||||||
ChangePosition Position `json:"change_position"`
|
UpdatedByID int64 `json:"updated_by_id"`
|
||||||
OriginalPosition Position `json:"original_position"`
|
LastEditedAt customTime `json:"last_edited_at"`
|
||||||
|
LastEditedByID int64 `json:"last_edited_by_id"`
|
||||||
|
RelativePosition int64 `json:"relative_position"`
|
||||||
Position Position `json:"position"`
|
Position Position `json:"position"`
|
||||||
BranchName string `json:"branch_name"`
|
BranchName string `json:"branch_name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
MilestoneID int64 `json:"milestone_id"`
|
MilestoneID int64 `json:"milestone_id"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
|
StateID int64 `json:"state_id"`
|
||||||
|
Confidential bool `json:"confidential"`
|
||||||
|
DiscussionLocked bool `json:"discussion_locked"`
|
||||||
|
DueDate customTime `json:"due_date"`
|
||||||
|
TimeEstimate int64 `json:"time_estimate"`
|
||||||
|
TotalTimeSpent int64 `json:"total_time_spent"`
|
||||||
IID int64 `json:"iid"`
|
IID int64 `json:"iid"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Action string `json:"action"`
|
Action string `json:"action"`
|
||||||
@@ -374,6 +390,13 @@ type PipelineObjectAttributes struct {
|
|||||||
CreatedAt customTime `json:"created_at"`
|
CreatedAt customTime `json:"created_at"`
|
||||||
FinishedAt customTime `json:"finished_at"`
|
FinishedAt customTime `json:"finished_at"`
|
||||||
Duration int64 `json:"duration"`
|
Duration int64 `json:"duration"`
|
||||||
|
Variables []Variable `json:"variables"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variable contains pipeline variables
|
||||||
|
type Variable struct {
|
||||||
|
Key string `json:"key"`
|
||||||
|
Value string `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position defines a specific location, identified by paths line numbers and
|
// Position defines a specific location, identified by paths line numbers and
|
||||||
@@ -421,6 +444,7 @@ type MergeRequest struct {
|
|||||||
LastCommit LastCommit `json:"last_commit"`
|
LastCommit LastCommit `json:"last_commit"`
|
||||||
WorkInProgress bool `json:"work_in_progress"`
|
WorkInProgress bool `json:"work_in_progress"`
|
||||||
Assignee Assignee `json:"assignee"`
|
Assignee Assignee `json:"assignee"`
|
||||||
|
URL string `json:"url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assignee contains all of the GitLab assignee information
|
// Assignee contains all of the GitLab assignee information
|
||||||
|
|||||||
Vendored
+20
-12
@@ -1,24 +1,26 @@
|
|||||||
{
|
{
|
||||||
"object_kind": "job",
|
"object_kind": "build",
|
||||||
"ref": "gitlab-script-trigger",
|
"ref": "gitlab-script-trigger",
|
||||||
"tag": false,
|
"tag": false,
|
||||||
"before_sha": "2293ada6b400935a1378653304eaf6221e0fdb8f",
|
"before_sha": "2293ada6b400935a1378653304eaf6221e0fdb8f",
|
||||||
"sha": "2293ada6b400935a1378653304eaf6221e0fdb8f",
|
"sha": "2293ada6b400935a1378653304eaf6221e0fdb8f",
|
||||||
"job_id": 1977,
|
"build_id": 1977,
|
||||||
"job_name": "test",
|
"build_name": "test",
|
||||||
"job_stage": "test",
|
"build_stage": "test",
|
||||||
"job_status": "created",
|
"build_status": "created",
|
||||||
"job_started_at": null,
|
"build_started_at": null,
|
||||||
"job_finished_at": null,
|
"build_finished_at": null,
|
||||||
"job_duration": null,
|
"build_duration": null,
|
||||||
"job_allow_failure": false,
|
"build_allow_failure": false,
|
||||||
"job_failure_reason": "script_failure",
|
"build_failure_reason": "script_failure",
|
||||||
|
"pipeline_id": 2366,
|
||||||
"project_id": 380,
|
"project_id": 380,
|
||||||
"project_name": "gitlab-org/gitlab-test",
|
"project_name": "gitlab-org/gitlab-test",
|
||||||
"user": {
|
"user": {
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"name": "User",
|
"name": "User",
|
||||||
"email": "user@gitlab.com"
|
"email": "user@gitlab.com",
|
||||||
|
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon"
|
||||||
},
|
},
|
||||||
"commit": {
|
"commit": {
|
||||||
"id": 2366,
|
"id": 2366,
|
||||||
@@ -38,5 +40,11 @@
|
|||||||
"git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git",
|
"git_ssh_url": "git@192.168.64.1:gitlab-org/gitlab-test.git",
|
||||||
"git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git",
|
"git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git",
|
||||||
"visibility_level": 20
|
"visibility_level": 20
|
||||||
|
},
|
||||||
|
"runner": {
|
||||||
|
"active": true,
|
||||||
|
"is_shared": false,
|
||||||
|
"id": 380987,
|
||||||
|
"description": "shared-runners-manager-6.gitlab.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+21
-2
@@ -6,6 +6,7 @@
|
|||||||
"tag": false,
|
"tag": false,
|
||||||
"sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2",
|
"sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2",
|
||||||
"before_sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2",
|
"before_sha": "bcbb5ec396a2c0f828686f14fac9b80b780504f2",
|
||||||
|
"source": "merge_request_event",
|
||||||
"status": "success",
|
"status": "success",
|
||||||
"stages":[
|
"stages":[
|
||||||
"build",
|
"build",
|
||||||
@@ -21,11 +22,24 @@
|
|||||||
"value": "us-west-1"
|
"value": "us-west-1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"merge_request": {
|
||||||
|
"id": 1,
|
||||||
|
"iid": 1,
|
||||||
|
"title": "Test",
|
||||||
|
"source_branch": "test",
|
||||||
|
"source_project_id": 1,
|
||||||
|
"target_branch": "master",
|
||||||
|
"target_project_id": 1,
|
||||||
|
"state": "opened",
|
||||||
|
"merge_status": "can_be_merged",
|
||||||
|
"url": "http://192.168.64.1:3005/gitlab-org/gitlab-test/merge_requests/1"
|
||||||
},
|
},
|
||||||
"user":{
|
"user":{
|
||||||
"name": "Administrator",
|
"name": "Administrator",
|
||||||
"username": "root",
|
"username": "root",
|
||||||
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon"
|
"avatar_url": "http://www.gravatar.com/avatar/e32bd13e2add097461cb96824b7a829c?s=80\u0026d=identicon",
|
||||||
|
"email": "user_email@gitlab.com"
|
||||||
},
|
},
|
||||||
"project":{
|
"project":{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@@ -50,7 +64,7 @@
|
|||||||
"email": "user@gitlab.com"
|
"email": "user@gitlab.com"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jobs":[
|
"builds":[
|
||||||
{
|
{
|
||||||
"id": 380,
|
"id": 380,
|
||||||
"stage": "deploy",
|
"stage": "deploy",
|
||||||
@@ -61,6 +75,7 @@
|
|||||||
"finished_at": null,
|
"finished_at": null,
|
||||||
"when": "manual",
|
"when": "manual",
|
||||||
"manual": true,
|
"manual": true,
|
||||||
|
"allow_failure": false,
|
||||||
"user":{
|
"user":{
|
||||||
"name": "Administrator",
|
"name": "Administrator",
|
||||||
"username": "root",
|
"username": "root",
|
||||||
@@ -82,6 +97,7 @@
|
|||||||
"finished_at": null,
|
"finished_at": null,
|
||||||
"when": "on_success",
|
"when": "on_success",
|
||||||
"manual": false,
|
"manual": false,
|
||||||
|
"allow_failure": false,
|
||||||
"user":{
|
"user":{
|
||||||
"name": "Administrator",
|
"name": "Administrator",
|
||||||
"username": "root",
|
"username": "root",
|
||||||
@@ -108,6 +124,7 @@
|
|||||||
"finished_at": "2016-08-12 15:26:29 UTC",
|
"finished_at": "2016-08-12 15:26:29 UTC",
|
||||||
"when": "on_success",
|
"when": "on_success",
|
||||||
"manual": false,
|
"manual": false,
|
||||||
|
"allow_failure": false,
|
||||||
"user":{
|
"user":{
|
||||||
"name": "Administrator",
|
"name": "Administrator",
|
||||||
"username": "root",
|
"username": "root",
|
||||||
@@ -134,6 +151,7 @@
|
|||||||
"finished_at": "2016-08-12 15:25:26 UTC",
|
"finished_at": "2016-08-12 15:25:26 UTC",
|
||||||
"when": "on_success",
|
"when": "on_success",
|
||||||
"manual": false,
|
"manual": false,
|
||||||
|
"allow_failure": false,
|
||||||
"user":{
|
"user":{
|
||||||
"name": "Administrator",
|
"name": "Administrator",
|
||||||
"username": "root",
|
"username": "root",
|
||||||
@@ -160,6 +178,7 @@
|
|||||||
"finished_at": null,
|
"finished_at": null,
|
||||||
"when": "on_success",
|
"when": "on_success",
|
||||||
"manual": false,
|
"manual": false,
|
||||||
|
"allow_failure": false,
|
||||||
"user":{
|
"user":{
|
||||||
"name": "Administrator",
|
"name": "Administrator",
|
||||||
"username": "root",
|
"username": "root",
|
||||||
|
|||||||
Reference in New Issue
Block a user