Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
6d33d407
Unverified
Commit
6d33d407
authored
Mar 14, 2019
by
Sander van Harmelen
Committed by
GitHub
Mar 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #578 from hanleym/master
Added support for job events.
parents
5e45e085
7a935cc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
+44
-0
event_parsing.go
event_parsing.go
+3
-0
event_types.go
event_types.go
+41
-0
No files found.
event_parsing.go
View file @
6d33d407
...
...
@@ -13,6 +13,7 @@ type EventType string
const
(
EventTypeBuild
EventType
=
"Build Hook"
EventTypeIssue
EventType
=
"Issue Hook"
EventTypeJob
EventType
=
"Job Hook"
EventTypeMergeRequest
EventType
=
"Merge Request Hook"
EventTypeNote
EventType
=
"Note Hook"
EventTypePipeline
EventType
=
"Pipeline Hook"
...
...
@@ -68,6 +69,8 @@ func ParseWebhook(eventType EventType, payload []byte) (event interface{}, err e
event
=
&
BuildEvent
{}
case
EventTypeIssue
:
event
=
&
IssueEvent
{}
case
EventTypeJob
:
event
=
&
JobEvent
{}
case
EventTypeMergeRequest
:
event
=
&
MergeEvent
{}
case
EventTypePipeline
:
...
...
event_types.go
View file @
6d33d407
...
...
@@ -163,6 +163,47 @@ type IssueEvent struct {
}
`json:"assignee"`
}
// JobEvent represents a job event.
//
// GitLab API docs:
// TODO: link to docs instead of src once they are published.
// https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/data_builder/build.rb
type
JobEvent
struct
{
ObjectKind
string
`json:"object_kind"`
Ref
string
`json:"ref"`
Tag
bool
`json:"tag"`
BeforeSHA
string
`json:"before_sha"`
SHA
string
`json:"sha"`
BuildID
int
`json:"build_id"`
BuildName
string
`json:"build_name"`
BuildStage
string
`json:"build_stage"`
BuildStatus
string
`json:"build_status"`
BuildStartedAt
string
`json:"build_started_at"`
BuildFinishedAt
string
`json:"build_finished_at"`
BuildDuration
float64
`json:"build_duration"`
BuildAllowFailure
bool
`json:"build_allow_failure"`
ProjectID
int
`json:"project_id"`
ProjectName
string
`json:"project_name"`
User
struct
{
ID
int
`json:"id"`
Name
string
`json:"name"`
Email
string
`json:"email"`
}
`json:"user"`
Commit
struct
{
ID
int
`json:"id"`
SHA
string
`json:"sha"`
Message
string
`json:"message"`
AuthorName
string
`json:"author_name"`
AuthorEmail
string
`json:"author_email"`
AuthorURL
string
`json:"author_url"`
Status
string
`json:"status"`
Duration
int
`json:"duration"`
StartedAt
string
`json:"started_at"`
FinishedAt
string
`json:"finished_at"`
}
`json:"commit"`
Repository
*
Repository
`json:"repository"`
}
// CommitCommentEvent represents a comment on a commit event.
//
// GitLab API docs:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment