Skip to content
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

Add event type filtering to the gitlab interceptor. #235

Merged
merged 1 commit into from
Nov 26, 2019

Conversation

dlorenc
Copy link
Contributor

@dlorenc dlorenc commented Nov 26, 2019

Changes

This mirrors the event type fltering that exists for Github.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

The GitLab interceptor now supports filtering based on incoming event types.

This mirrors the event type fltering that exists for Github.
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 26, 2019
@tekton-robot
Copy link

The following is the coverage report on pkg/.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/zz_generated.deepcopy.go 17.6% 17.4% -0.3
pkg/interceptors/gitlab/gitlab.go 75.0% 85.0% 10.0

if subtle.ConstantTimeCompare([]byte(header), secretToken) == 0 {
return nil, errors.New("Invalid X-Gitlab-Token")
// Make sure to use a constant time comparison here.
if subtle.ConstantTimeCompare([]byte(header), secretToken) == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!

@@ -7517,4 +7517,3 @@ Import: github.com/tektoncd/triggers/vendor/knative.dev/pkg
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this was intentional?

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 26, 2019
@wlynch
Copy link
Member

wlynch commented Nov 26, 2019

/lgtm

LGTM, though once we have expression filtering (#49), we may want to consider removing this event filtering from the interceptor. I think it might be clearer / more consistent to have all "if field matches foo" logic to live in the expression, since it will be a more general and flexible location for that to be done. Since it doesn't exist yet, this is fine for now! ^_^

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 26, 2019
@tekton-robot tekton-robot merged commit c23bc85 into master Nov 26, 2019
@dlorenc dlorenc deleted the gitlabevent branch November 26, 2019 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants