-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for gitlab and bitbucket webhooks #13389
Conversation
pkg/build/api/types.go
Outdated
BuildTriggerCauseGithubMsg = "GitHub WebHook" | ||
BuildTriggerCauseGenericMsg = "Generic WebHook" | ||
BuildTriggerCauseGitlabMsg = "Gitlab WebHook" | ||
BuildTriggerCauseBitBucketMsg = "BitBucket WebHook" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit, it's Bitbucket not BitBucket (also other places in the pr)
pkg/build/api/types.go
Outdated
BuildTriggerCauseImageMsg = "Image change" | ||
BuildTriggerCauseGithubMsg = "GitHub WebHook" | ||
BuildTriggerCauseGenericMsg = "Generic WebHook" | ||
BuildTriggerCauseGitlabMsg = "Gitlab WebHook" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should be GitLab (consistent with other places in the PR)
pkg/build/api/v1/types.go
Outdated
|
||
// GitLabWebHook represents data for a GitLab webhook that fired a specific | ||
// build. | ||
GitLabWebHook *GitLabWebHookCause `protobuf:"bytes,5,opt,name=gitLabWebHook"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing json section
pkg/build/api/v1/types.go
Outdated
|
||
// BitBucketWebHook represents data for a BitBucket webhook that fired a | ||
// specific build. | ||
BitBucketWebHook *BitBucketWebHookCause `protobuf:"bytes,6,opt,name=bitBucketWebHook"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing json section
pkg/build/api/v1/types.go
Outdated
// build. | ||
type GitLabWebHookCause struct { | ||
// Revision is the git source revision information of the trigger. | ||
Revision *SourceRevision `protobuf:"bytes,1,opt,name=revision"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing json section
pkg/build/api/v1/types.go
Outdated
Revision *SourceRevision `protobuf:"bytes,1,opt,name=revision"` | ||
|
||
// Secret is the obfuscated webhook secret that triggered a build. | ||
Secret string `protobuf:"bytes,2,opt,name=secret"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing json section
pkg/build/api/v1/types.go
Outdated
// build. | ||
type BitBucketWebHookCause struct { | ||
// Revision is the git source revision information of the trigger. | ||
Revision *SourceRevision `protobuf:"bytes,1,opt,name=revision"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing json section
pkg/build/api/v1/types.go
Outdated
Revision *SourceRevision `protobuf:"bytes,1,opt,name=revision"` | ||
|
||
// Secret is the obfuscated webhook secret that triggered a build. | ||
Secret string `protobuf:"bytes,2,opt,name=secret"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing json section
pkg/build/api/v1/types.go
Outdated
@@ -780,6 +808,13 @@ type BuildTriggerPolicy struct { | |||
|
|||
// imageChange contains parameters for an ImageChange type of trigger | |||
ImageChange *ImageChangeTrigger `json:"imageChange,omitempty" protobuf:"bytes,4,opt,name=imageChange"` | |||
|
|||
// GitLabWebHook contains the parameters for a GitLab webhook type of trigger | |||
GitLabWebHook *WebHookTrigger `protobuf:"bytes,5,opt,name=gitLabWebHook"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing json section
pkg/build/api/v1/types.go
Outdated
|
||
// BitBucketWebHook contains the parameters for a BitBucket webhook type of | ||
// trigger | ||
BitBucketWebHook *WebHookTrigger `protobuf:"bytes,6,opt,name=bitBucketWebHook"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing json section
Name string `json:"name"` | ||
} | ||
|
||
// Extract services webhooks from github.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be bitbucket
pkg/build/webhook/gitlab/gitlab.go
Outdated
} | ||
|
||
// NOTE - unlike github, the head commit is not highlighted ... only the commit array is provided, | ||
// where it the last commit is the latest commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grammar
pkg/build/webhook/gitlab/gitlab.go
Outdated
Commits []commit `json:"commits,omitempty"` | ||
} | ||
|
||
// Extract services webhooks from github.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be gitlab
CommonSpec: api.CommonSpec{ | ||
Source: api.BuildSource{ | ||
Git: &api.GitBuildSource{ | ||
URI: "git://github.com/my/repo.git", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be gitlab.com?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be any URI? I think the intended use is a custom gitlab server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want to make it clearer you can make it git://someurl.com/my/repo.git
CommonSpec: api.CommonSpec{ | ||
Source: api.BuildSource{ | ||
Git: &api.GitBuildSource{ | ||
URI: "git://github.com/my/repo.git", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be gitlab.com?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be any URI? I think the intended use is a custom gitlab server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
pkg/build/webhook/webhook.go
Outdated
@@ -61,6 +61,7 @@ func FindTriggerPolicy(triggerType buildapi.BuildTriggerType, config *buildapi.B | |||
// defined webhook secrets and if it is valid, returns its information. | |||
func ValidateWebHookSecret(webHookTriggers []buildapi.BuildTriggerPolicy, secret string) (*buildapi.WebHookTrigger, error) { | |||
for _, trigger := range webHookTriggers { | |||
//TODO Could we switch this to a switch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, might be cleaner as a switch
@@ -327,6 +327,42 @@ func mockBuildConfigImageParms(imageName, imageStream, imageTag string) *buildap | |||
Secret: "secret102", | |||
}, | |||
}, | |||
{ | |||
Type: buildapi.GitLabWebHookBuildTriggerType, | |||
GitLabWebHook: &buildapi.WebHookTrigger{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe change the name of this file if it is going to include gitlab and bitbucket tests also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely agree. In another PR, I had to make a webhookgeneric_test, which doesn't look good. On it.
fyi @oatmealraisin is taking on the first set of comments here from @coreydaley ... he'll push / squash when complete |
Did you update |
On Wed, Mar 15, 2017 at 11:58 AM, Clayton Coleman ***@***.***> wrote:
Did you update set triggers?
We explicitly did not do that per interpretation of discussion during
sprint planning with @bparees.
That discussion centered around ` --from-webhook` and `--git-post-receive`
from `oc start-build`
But perhaps we confused things wrt not doing `oc set triggers` (which also
has a --from-webhook as well) ?
… —
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13389 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADbadCQp-BGtNrnzGEBtpZMNXL7b7g97ks5rmAqJgaJpZM4MdLKN>
.
|
I'm ok with not expanding new-build or new-app or start-build, but you need
to manage with "set triggers". Otherwise it's not possible from the CLI
On Wed, Mar 15, 2017 at 12:04 PM, Gabe Montero <[email protected]>
wrote:
… On Wed, Mar 15, 2017 at 11:58 AM, Clayton Coleman <
***@***.***>
wrote:
> Did you update set triggers?
>
We explicitly did not do that per interpretation of discussion during
sprint planning with @bparees.
That discussion centered around ` --from-webhook` and `--git-post-receive`
from `oc start-build`
But perhaps we confused things wrt not doing `oc set triggers` (which also
has a --from-webhook as well) ?
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#13389 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ADbadCQp-
BGtNrnzGEBtpZMNXL7b7g97ks5rmAqJgaJpZM4MdLKN>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#13389 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pzjZf2BrAd2kjnK4AZk_itAmvUWrks5rmAwCgaJpZM4MdLKN>
.
|
On Wed, Mar 15, 2017 at 12:26 PM, Clayton Coleman <[email protected]>
wrote:
I'm ok with not expanding new-build or new-app or start-build, but you need
to manage with "set triggers". Otherwise it's not possible from the CLI
10-4 we'll update
…
On Wed, Mar 15, 2017 at 12:04 PM, Gabe Montero ***@***.***>
wrote:
> On Wed, Mar 15, 2017 at 11:58 AM, Clayton Coleman <
> ***@***.***>
> wrote:
>
> > Did you update set triggers?
> >
> We explicitly did not do that per interpretation of discussion during
> sprint planning with @bparees.
>
> That discussion centered around ` --from-webhook` and
`--git-post-receive`
> from `oc start-build`
>
> But perhaps we confused things wrt not doing `oc set triggers` (which
also
> has a --from-webhook as well) ?
>
> > —
> > You are receiving this because you authored the thread.
> > Reply to this email directly, view it on GitHub
> > <#13389 (comment)
>,
> > or mute the thread
> > <https://github.com/notifications/unsubscribe-auth/ADbadCQp-
> BGtNrnzGEBtpZMNXL7b7g97ks5rmAqJgaJpZM4MdLKN>
>
> > .
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#13389 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-
auth/ABG_pzjZf2BrAd2kjnK4AZk_itAmvUWrks5rmAwCgaJpZM4MdLKN>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13389 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADbadCmYJ9g5bG_-tG4CQobzVml-QxKoks5rmBE_gaJpZM4MdLKN>
.
|
c6d73d2
to
6c909d2
Compare
@coreydaley Thanks for the review! I've updated the PR based on your comments. |
pkg/build/webhook/webhook_test.go
Outdated
@@ -126,6 +162,40 @@ func TestFindTriggerPolicyMatchedGithubWebHook(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestFindTriggerPolicyMatchedGitlabWebHook(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitLab
|
||
func TestInstantiateBuildTriggerCauseGitLabWebHook(t *testing.T) { | ||
buildTriggerCauses := []buildapi.BuildTriggerCause{} | ||
changeMessage := buildapi.BuildTriggerCauseGitlabMsg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitLab
if cause.GitLabWebHook.Secret != hiddenSecret { | ||
t.Errorf("Expected obfuscated secret to be: %s", hiddenSecret) | ||
} | ||
if cause.Message != api.BuildTriggerCauseGitlabMsg { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitLab
pkg/build/api/v1/types.go
Outdated
|
||
// GitLabWebHook represents data for a GitLab webhook that fired a specific | ||
// build. | ||
GitLabWebHook *GitLabWebHookCause `json:"gitLabWebHook, omitempty" protobuf:"bytes,5,opt,name=gitLabWebHook"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space after comma
pkg/build/api/v1/types.go
Outdated
|
||
// BitbucketWebHook represents data for a Bitbucket webhook that fired a | ||
// specific build. | ||
BitbucketWebHook *BitbucketWebHookCause `json:"bitbucketWebhook, omitempty" protobuf:"bytes,6,opt,name=bitbucketWebHook"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove space after comma, upcase H on hook
@smarterclayton @csrwng - I was talking with @bparees a bit about the Per the details I put in the PR's description, I think we had left sprint planning with a decision of not adding them, but even if I am mis-remembering, in any event, both @bparees and I are still on the fence. What is y'all's respective takes? Note - earlier @smarterclayton said he was fine with us not updating new-app ... but that does not necessarily imply not being OK with updating new-app |
6c909d2
to
c244872
Compare
@coreydaley Added your requests! |
pkg/build/api/v1/types.go
Outdated
|
||
// BitbucketWebHook represents data for a Bitbucket webhook that fired a | ||
// specific build. | ||
BitbucketWebHook *BitbucketWebHookCause `json:"bitbucketWebhook,omitempty" protobuf:"bytes,6,opt,name=bitbucketWebHook"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consistency: capitalize the h in Webhook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
I'm still ok not adding them automatically. They increase object size significantly. And they're just not used that often. |
c244872
to
a804f94
Compare
OK I've pushed the trigger changes for gitlab/bitbucket ... per @smarterclayton we are NOT automatically adding gitlab / bitbucket on new-app |
a804f94
to
bb1d6b9
Compare
Yeah, the wait for a build stuff is the mystery. Some tracing there would have helped, but perhaps tracing would be too chatty in the normal case ?? In fact, of you look at the build log dump after the build describe, it appears that the build completed successfully, including the push:
Certainly seems more test framework than code base ... going to try and test again. [test] |
I'll push the necessary rebase updates shortly |
b4b8d16
to
7e0966f
Compare
7e0966f
to
7a8cbfd
Compare
OK post-rebase the test just passed again, and a second one is now running (perhaps the extra test comment I posted yesterday) |
the second test hit 2 known flakes ... flake #13067 and flake #12072 other than that everything passed (and the prior test passed completely) with the api approval (thanks @liggitt ) a question to @bparees - assuming we can debug the start build and wait issue in a separate pull (I can boot that up today) and that it seens ext test infrastructure related since the build actually succeeded, and the latest failures being known flakes, with a successful test run sandwiched in between, is this in "ygtm" state, and we should start the fork ami process? |
yup. |
cool - thx @bparees |
7ca43e3
to
f71456f
Compare
going to add some temporary debug in I previously checked out this pr's branch in an aws instance I spun up yesterday and ran the vagrant build-base-images command successfully. |
a3fdd34
to
9d300e8
Compare
Evaluated for origin test up to 9d300e8 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/475/) (Base Commit: 959be87) |
merging as is. We will revisit refactoring the existing webhookcause structs to use the new common embedded struct once @smarterclayton is back/weighs in on the protobuf implications. [merge] |
The merge jobs are still cooking, but we already have the conformance install setup hitting something that looks similar to flake #13594 |
flake #13606 though i'm not convinced it's a flake vs broken. [merge] |
same issue with https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/235/ as with https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/234/ Certainly seems more like a consistent problem vs. flake |
Seems like a long shot, but just in case, any chance rebasing this PR to the latest origin would help things? |
[merge]
…On Mon, Apr 3, 2017 at 2:05 PM, OpenShift Bot ***@***.***> wrote:
continuous-integration/openshift-jenkins/merge FAILURE (
https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/235/)
(Base Commit: 889fcc4
<889fcc4>
)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13389 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEvl3qnp0ubbpz57toSNrRH35dlIl-I7ks5rsTT0gaJpZM4MdLKN>
.
--
Ben Parees | OpenShift
|
rebasing will never affect the results of a test/merge, PRs are always tested/merged by applying the PR changes onto the latest master code (which is the same thing a rebase would do). @stevekuznetsov thinks he's fixed the issue these PRs were hitting, hopefully the merge will go through now. |
Evaluated for origin merge up to 9d300e8 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/237/) (Base Commit: 8b6ea7f) (Image: devenv-rhel7_6114) |
@openshift/devex PTAL
per the discussion during sprint planning, we did not updatea the --from-webhook, etc. options with
oc start-build
, nor did we changeoc new-app
to either automatically add the triggers for gitlab and webhook or add yet another option tooc new-app
to let the user choose to automatically add the triggers.Of course we can further debate those points along with the content of the code changes as everyone sees fit.