Skip to content

Commit 7a5d72b

Browse files
authored
Merge pull request #173 from mstifflin/mstifflin/add-triggered-from
Expose additional webhook fields on builds and jobs
2 parents 94a8c1b + 3a83f72 commit 7a5d72b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

buildkite/builds.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ type PullRequest struct {
6060
Repository *string `json:"repository,omitempty" yaml:"repository,omitempty"`
6161
}
6262

63+
type TriggeredFrom struct {
64+
BuildID *string `json:"build_id,omitempty" yaml:"build_id,omitempty"`
65+
BuildNumber *int `json:"build_number,omitempty" yaml:"build_number,omitempty"`
66+
BuildPipelineSlug *string `json:"build_pipeline_slug,omitempty" yaml:"build_pipeline_slug,omitempty"`
67+
}
68+
6369
// Build represents a build which has run in buildkite
6470
type Build struct {
6571
ID *string `json:"id,omitempty" yaml:"id,omitempty"`
@@ -93,6 +99,10 @@ type Build struct {
9399

94100
// the pull request this build is associated with
95101
PullRequest *PullRequest `json:"pull_request,omitempty" yaml:"pull_request,omitempty"`
102+
103+
// the build that this build is triggered from
104+
// https://buildkite.com/docs/pipelines/trigger-step
105+
TriggeredFrom *TriggeredFrom `json:"triggered_from,omitempty" yaml:"triggered_from,omitempty"`
96106
}
97107

98108
type MetaDataFilters struct {

buildkite/jobs.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ type Job struct {
5050
ParallelGroupTotal *int `json:"parallel_group_total,omitempty" yaml:"parallel_group_total,omitempty"`
5151
ClusterID *string `json:"cluster_id,omitempty" yaml:"cluster_id,omitempty"`
5252
ClusterQueueID *string `json:"cluster_queue_id,omitempty" yaml:"cluster_queue_id,omitempty"`
53+
TriggeredBuild *TriggeredBuild `json:"triggered_build,omitempty" yaml:"triggered_build,omitempty"`
5354
}
5455

5556
// JobRetrySource represents what triggered this retry.
@@ -85,6 +86,13 @@ type JobEnvs struct {
8586
EnvironmentVariables *map[string]string `json:"env,string" yaml:"env,string"`
8687
}
8788

89+
type TriggeredBuild struct {
90+
ID *string `json:"id,omitempty" yaml:"id,omitempty"`
91+
Number *int `json:"number,omitempty" yaml:"number,omitempty"`
92+
URL *string `json:"url,omitempty" yaml:"url,omitempty"`
93+
WebURL *string `json:"web_url,omitempty" yaml:"web_url,omitempty"`
94+
}
95+
8896
// UnblockJob - unblock a job
8997
//
9098
// buildkite API docs: https://buildkite.com/docs/apis/rest-api/jobs#unblock-a-job

0 commit comments

Comments
 (0)