-
Notifications
You must be signed in to change notification settings - Fork 225
add gitlab source to contrib #382
add gitlab source to contrib #382
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vincent-pli If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @vincent-pli. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
dd96050
to
725af5f
Compare
/ok-to-test |
/assign @evankanderson |
725af5f
to
48f7a4d
Compare
/assign @evankanderson |
/assign @n3wscott |
48f7a4d
to
81397f6
Compare
81397f6
to
a3dc5d6
Compare
logCfg := zap.NewProductionConfig() | ||
logCfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder | ||
logger, err := logCfg.Build() | ||
logger = logger.With(zap.String(logkey.ControllerType, "gitlab-controller")) |
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.
This one should be after the error check, to avoid using the instance if errored.
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.
Thank, will fix it soon
a3dc5d6
to
8c1b5c0
Compare
@@ -0,0 +1,92 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
@@ -0,0 +1,144 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
@@ -0,0 +1,382 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
@@ -0,0 +1,188 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
@@ -0,0 +1,268 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
contrib/gitlab/pkg/reconciler/doc.go
Outdated
@@ -0,0 +1,18 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
@@ -0,0 +1,384 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
@@ -0,0 +1,769 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
@@ -0,0 +1,72 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
@@ -0,0 +1,123 @@ | |||
/* | |||
Copyright 2018 The Knative Authors |
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.
Copyright 2018 The Knative Authors | |
Copyright 2019 The Knative Authors |
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.
Wow, thanks
8c1b5c0
to
dcea5c8
Compare
The following is the coverage report on pkg/.
|
Hi @vincent-pli! I'm sorry this hasn't been approved yet. 😞 We've been busy with Kubecon prep, but once that's done (this week) we should be back to normal. |
So indeed there is already a gitlabsource at gitlab.com: It is listed in the table at: I thought the plan was not to push all sources to this repo, otherwise I would have moved the source a long time ago. |
@vincent-pli did you know about the GitLab source @sebgoa mentioned before you started work in this PR? I'm curious because if you didn't that sounds like a bug in our docs. |
@sebgoa @grantr If it's conflict with the strategy, I could persuade our customers, thanks. |
So I propose we move https://gitlab.com/triggermesh/gitlabsource in this knative repo and we all start to work on the same codebase. It seems a waste to duplicate efforts. |
@vincent-pli Thanks for working on that! 💜 GitLab backend engineer working mostly on GitLab Serverless here. Let me spend some time reviewing this pull request, it looks really interesting! We would like to understand better how can we combine https://gitlab.com/triggermesh/gitlabsource with this and the work we are doing at GitLab to make most of what Knative offers! |
"os" | ||
|
||
gitlab "github.com/knative/eventing-sources/contrib/gitlab/pkg/adapter" | ||
gl "gopkg.in/go-playground/webhooks.v5/gitlab" |
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.
Interesting, I wasn't aware that this library exists! I wonder what happens if we plan to actually send webhooks as signed JWTs 🤔
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.
😄
- job_events | ||
- pipeline_events | ||
- wiki_page_events | ||
type: string |
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 wonder if this actually makes sense to prefix these events with a webhook:
prefix, or something like this. We are currently only using webhooks, but I can see us adding more Serverless events. I don't have a strong opinion about doing that right now, something to think about in terms of maintaining backwards compatibility easier.
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.
Make sense if we try to support more event source
@@ -0,0 +1,144 @@ | |||
/* |
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 it be adapter/webhooks.go
? 🤔
url = pe.ObjectAttributes.URL | ||
case gl.BuildEvents: | ||
be := payload.(gl.BuildEventPayload) | ||
url = be.Repository.URL |
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.
That is really confusing that build events do not have object_attributes
in the payload, but pipelines events do. This is not consistent across events, perhaps we should open an issue in GitLab about that.
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 with you
log.Printf("url %s", url) | ||
//Hack here, since gitlab/githab could use ssh url. it's not typical URL style, like this: git@github.com:knative/eventing-sources.git | ||
//I guess it could be setting in the gitlab/github, but leave the code here to prevent exception | ||
if url != "" { |
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.
Can you explain in which cases this problem can occur? We do have git_http_url
in a few objects, but I see that we are not using it here 🤔
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 use ssh url like "git@github.com:tektoncd/pipeline.git", it's not a typical url which could parse by net/url
, so I hack it 😄
|
||
// Code generated by client-gen. DO NOT EDIT. | ||
|
||
package fake |
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'm just curious, since this is generated code, has it been generated by go-client
directly, or have you used operator-sdk
to generate it?
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.
It's generated by go-client
directly
@sebgoa What is your take on moving forward with this? Code here looks nice, it seems to be a little better unit tested and maybe is a little more complete than https://gitlab.com/triggermesh/gitlabsource (eg. see reconciler, fake client etc). Is there anything we could add here to make it better / more complete? Are we missing something that is available in https://gitlab.com/triggermesh/gitlabsource but is not available here? 🤔 |
secretToken: args.secretToken, | ||
} | ||
|
||
projectName, err := getProjectName(args.source.Spec.ProjectURL) |
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.
What happens if someone actually wants to add a group-level cluster and use group-level webhooks? Do we plan to support that?
@grzesiek We plan add them case by case later 😅 |
@vincent-pli Our goal here is to make it possible to use this from the GitLab itself, please see https://gitlab.com/gitlab-org/gitlab-ce/issues/62522. I'm really curious what you think about this idea. @sebgoa I'm curious about your opinion too. |
what's the state here, compared to #450 ? |
Should we close this in favor of https://gitlab.com/triggermesh/gitlabsource ? |
@n3wscott there was no reaction, in over a month ... closing it ? |
Closed, thanks |
Proposed Changes
Add gitlab source to
contrib/
Add new crd: GitLabSource and related Controller