Skip to content

Commit a804f94

Browse files
committed
support for gitlab and bitbucket webhooks
1 parent b7370b1 commit a804f94

40 files changed

+3707
-447
lines changed

api/protobuf-spec/github_com_openshift_origin_pkg_build_api_v1.proto

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/swagger-spec/oapi-v1.json

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23207,7 +23207,9 @@
2320723207
"id": "v1.BuildTriggerPolicy",
2320823208
"description": "BuildTriggerPolicy describes a policy for a single trigger that results in a new Build.",
2320923209
"required": [
23210-
"type"
23210+
"type",
23211+
"GitLabWebHook",
23212+
"BitBucketWebHook"
2321123213
],
2321223214
"properties": {
2321323215
"type": {
@@ -23225,6 +23227,14 @@
2322523227
"imageChange": {
2322623228
"$ref": "v1.ImageChangeTrigger",
2322723229
"description": "imageChange contains parameters for an ImageChange type of trigger"
23230+
},
23231+
"GitLabWebHook": {
23232+
"$ref": "v1.WebHookTrigger",
23233+
"description": "GitLabWebHook contains the parameters for a GitLab webhook type of trigger"
23234+
},
23235+
"BitBucketWebHook": {
23236+
"$ref": "v1.WebHookTrigger",
23237+
"description": "BitBucketWebHook contains the parameters for a BitBucket webhook type of trigger"
2322823238
}
2322923239
}
2323023240
},
@@ -24113,6 +24123,10 @@
2411324123
"v1.BuildTriggerCause": {
2411424124
"id": "v1.BuildTriggerCause",
2411524125
"description": "BuildTriggerCause holds information about a triggered build. It is used for displaying build trigger data for each build and build configuration in oc describe. It is also used to describe which triggers led to the most recent update in the build configuration.",
24126+
"required": [
24127+
"GitLabWebHook",
24128+
"BitBucketWebHook"
24129+
],
2411624130
"properties": {
2411724131
"message": {
2411824132
"type": "string",
@@ -24129,6 +24143,14 @@
2412924143
"imageChangeBuild": {
2413024144
"$ref": "v1.ImageChangeCause",
2413124145
"description": "imageChangeBuild stores information about an imagechange event that triggered a new build."
24146+
},
24147+
"GitLabWebHook": {
24148+
"$ref": "v1.GitLabWebHookCause",
24149+
"description": "GitLabWebHook represents data for a GitLab webhook that fired a specific build."
24150+
},
24151+
"BitBucketWebHook": {
24152+
"$ref": "v1.BitBucketWebHookCause",
24153+
"description": "BitBucketWebHook represents data for a BitBucket webhook that fired a specific build."
2413224154
}
2413324155
}
2413424156
},
@@ -24174,6 +24196,42 @@
2417424196
}
2417524197
}
2417624198
},
24199+
"v1.GitLabWebHookCause": {
24200+
"id": "v1.GitLabWebHookCause",
24201+
"description": "GitLabWebHookCause has information about a GitLab webhook that triggered a build.",
24202+
"required": [
24203+
"Revision",
24204+
"Secret"
24205+
],
24206+
"properties": {
24207+
"Revision": {
24208+
"$ref": "v1.SourceRevision",
24209+
"description": "Revision is the git source revision information of the trigger."
24210+
},
24211+
"Secret": {
24212+
"type": "string",
24213+
"description": "Secret is the obfuscated webhook secret that triggered a build."
24214+
}
24215+
}
24216+
},
24217+
"v1.BitBucketWebHookCause": {
24218+
"id": "v1.BitBucketWebHookCause",
24219+
"description": "BitBucketWebHookCause has information about a BitBucket webhook that triggered a build.",
24220+
"required": [
24221+
"Revision",
24222+
"Secret"
24223+
],
24224+
"properties": {
24225+
"Revision": {
24226+
"$ref": "v1.SourceRevision",
24227+
"description": "Revision is the git source revision information of the trigger."
24228+
},
24229+
"Secret": {
24230+
"type": "string",
24231+
"description": "Secret is the obfuscated webhook secret that triggered a build."
24232+
}
24233+
}
24234+
},
2417724235
"v1.DockerStrategyOptions": {
2417824236
"id": "v1.DockerStrategyOptions",
2417924237
"description": "DockerStrategyOptions contains extra strategy options for Docker builds",

api/swagger-spec/openshift-openapi-spec.json

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48166,6 +48166,23 @@
4816648166
}
4816748167
}
4816848168
},
48169+
"v1.BitBucketWebHookCause": {
48170+
"description": "BitBucketWebHookCause has information about a BitBucket webhook that triggered a build.",
48171+
"required": [
48172+
"Revision",
48173+
"Secret"
48174+
],
48175+
"properties": {
48176+
"Revision": {
48177+
"description": "Revision is the git source revision information of the trigger.",
48178+
"$ref": "#/definitions/v1.SourceRevision"
48179+
},
48180+
"Secret": {
48181+
"description": "Secret is the obfuscated webhook secret that triggered a build.",
48182+
"type": "string"
48183+
}
48184+
}
48185+
},
4816948186
"v1.Build": {
4817048187
"description": "Build encapsulates the inputs needed to produce a new deployable image, as well as the status of the execution and a reference to the Pod which executed the build.",
4817148188
"properties": {
@@ -48663,7 +48680,19 @@
4866348680
},
4866448681
"v1.BuildTriggerCause": {
4866548682
"description": "BuildTriggerCause holds information about a triggered build. It is used for displaying build trigger data for each build and build configuration in oc describe. It is also used to describe which triggers led to the most recent update in the build configuration.",
48683+
"required": [
48684+
"GitLabWebHook",
48685+
"BitBucketWebHook"
48686+
],
4866648687
"properties": {
48688+
"BitBucketWebHook": {
48689+
"description": "BitBucketWebHook represents data for a BitBucket webhook that fired a specific build.",
48690+
"$ref": "#/definitions/v1.BitBucketWebHookCause"
48691+
},
48692+
"GitLabWebHook": {
48693+
"description": "GitLabWebHook represents data for a GitLab webhook that fired a specific build.",
48694+
"$ref": "#/definitions/v1.GitLabWebHookCause"
48695+
},
4866748696
"genericWebHook": {
4866848697
"description": "genericWebHook holds data about a builds generic webhook trigger.",
4866948698
"$ref": "#/definitions/v1.GenericWebHookCause"
@@ -48685,9 +48714,19 @@
4868548714
"v1.BuildTriggerPolicy": {
4868648715
"description": "BuildTriggerPolicy describes a policy for a single trigger that results in a new Build.",
4868748716
"required": [
48688-
"type"
48717+
"type",
48718+
"GitLabWebHook",
48719+
"BitBucketWebHook"
4868948720
],
4869048721
"properties": {
48722+
"BitBucketWebHook": {
48723+
"description": "BitBucketWebHook contains the parameters for a BitBucket webhook type of trigger",
48724+
"$ref": "#/definitions/v1.WebHookTrigger"
48725+
},
48726+
"GitLabWebHook": {
48727+
"description": "GitLabWebHook contains the parameters for a GitLab webhook type of trigger",
48728+
"$ref": "#/definitions/v1.WebHookTrigger"
48729+
},
4869148730
"generic": {
4869248731
"description": "generic contains the parameters for a Generic webhook type of trigger",
4869348732
"$ref": "#/definitions/v1.WebHookTrigger"
@@ -50955,6 +50994,23 @@
5095550994
}
5095650995
}
5095750996
},
50997+
"v1.GitLabWebHookCause": {
50998+
"description": "GitLabWebHookCause has information about a GitLab webhook that triggered a build.",
50999+
"required": [
51000+
"Revision",
51001+
"Secret"
51002+
],
51003+
"properties": {
51004+
"Revision": {
51005+
"description": "Revision is the git source revision information of the trigger.",
51006+
"$ref": "#/definitions/v1.SourceRevision"
51007+
},
51008+
"Secret": {
51009+
"description": "Secret is the obfuscated webhook secret that triggered a build.",
51010+
"type": "string"
51011+
}
51012+
}
51013+
},
5095851014
"v1.GitRepoVolumeSource": {
5095951015
"description": "Represents a volume that is populated with the contents of a git repository. Git repo volumes do not support ownership management. Git repo volumes support SELinux relabeling.",
5096051016
"required": [

pkg/build/api/types.go

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,13 @@ type CommonSpec struct {
128128
}
129129

130130
const (
131-
BuildTriggerCauseManualMsg = "Manually triggered"
132-
BuildTriggerCauseConfigMsg = "Build configuration change"
133-
BuildTriggerCauseImageMsg = "Image change"
134-
BuildTriggerCauseGithubMsg = "GitHub WebHook"
135-
BuildTriggerCauseGenericMsg = "Generic WebHook"
131+
BuildTriggerCauseManualMsg = "Manually triggered"
132+
BuildTriggerCauseConfigMsg = "Build configuration change"
133+
BuildTriggerCauseImageMsg = "Image change"
134+
BuildTriggerCauseGithubMsg = "GitHub WebHook"
135+
BuildTriggerCauseGenericMsg = "Generic WebHook"
136+
BuildTriggerCauseGitLabMsg = "GitLab WebHook"
137+
BuildTriggerCauseBitbucketMsg = "Bitbucket WebHook"
136138
)
137139

138140
// BuildTriggerCause holds information about a triggered build. It is used for
@@ -155,6 +157,14 @@ type BuildTriggerCause struct {
155157
// ImageChangeBuild stores information about an imagechange event that
156158
// triggered a new build.
157159
ImageChangeBuild *ImageChangeCause
160+
161+
// GitLabWebHook represents data for a GitLab webhook that fired a specific
162+
// build.
163+
GitLabWebHook *GitLabWebHookCause
164+
165+
// BitbucketWebHook represents data for a Bitbucket webhook that fired a
166+
// specific build.
167+
BitbucketWebHook *BitbucketWebHookCause
158168
}
159169

160170
// GenericWebHookCause holds information about a generic WebHook that
@@ -178,6 +188,26 @@ type GitHubWebHookCause struct {
178188
Secret string
179189
}
180190

191+
// GitLabWebHookCause has information about a GitLab webhook that triggered a
192+
// build.
193+
type GitLabWebHookCause struct {
194+
// Revision is the git source revision information of the trigger.
195+
Revision *SourceRevision
196+
197+
// Secret is the obfuscated webhook secret that triggered a build.
198+
Secret string
199+
}
200+
201+
// BitbucketWebHookCause has information about a Bitbucket webhook that triggered a
202+
// build.
203+
type BitbucketWebHookCause struct {
204+
// Revision is the git source revision information of the trigger.
205+
Revision *SourceRevision
206+
207+
// Secret is the obfuscated webhook secret that triggered a build.
208+
Secret string
209+
}
210+
181211
// ImageChangeCause contains information about the image that triggered a
182212
// build.
183213
type ImageChangeCause struct {
@@ -868,6 +898,13 @@ type BuildTriggerPolicy struct {
868898

869899
// ImageChange contains parameters for an ImageChange type of trigger
870900
ImageChange *ImageChangeTrigger
901+
902+
// GitLabWebHook contains the parameters for a GitLab webhook type of trigger
903+
GitLabWebHook *WebHookTrigger
904+
905+
// BitbucketWebHook contains the parameters for a Bitbucket webhook type of
906+
// trigger
907+
BitbucketWebHook *WebHookTrigger
871908
}
872909

873910
// BuildTriggerType refers to a specific BuildTriggerPolicy implementation.
@@ -879,6 +916,8 @@ var KnownTriggerTypes = sets.NewString(
879916
string(GenericWebHookBuildTriggerType),
880917
string(ImageChangeBuildTriggerType),
881918
string(ConfigChangeBuildTriggerType),
919+
string(GitLabWebHookBuildTriggerType),
920+
string(BitbucketWebHookBuildTriggerType),
882921
)
883922

884923
const (
@@ -892,6 +931,14 @@ const (
892931
GenericWebHookBuildTriggerType BuildTriggerType = "Generic"
893932
GenericWebHookBuildTriggerTypeDeprecated BuildTriggerType = "generic"
894933

934+
// GitLabWebHookBuildTriggerType represents a trigger that launches builds on
935+
// GitLab webhook invocations
936+
GitLabWebHookBuildTriggerType BuildTriggerType = "GitLab"
937+
938+
// BitbucketWebHookBuildTriggerType represents a trigger that launches builds on
939+
// Bitbucket webhook invocations
940+
BitbucketWebHookBuildTriggerType BuildTriggerType = "Bitbucket"
941+
895942
// ImageChangeBuildTriggerType represents a trigger that launches builds on
896943
// availability of a new version of an image
897944
ImageChangeBuildTriggerType BuildTriggerType = "ImageChange"

0 commit comments

Comments
 (0)