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

Matching on GitHub events #243

Closed
bigkevmcd opened this issue Nov 28, 2019 · 5 comments
Closed

Matching on GitHub events #243

bigkevmcd opened this issue Nov 28, 2019 · 5 comments

Comments

@bigkevmcd
Copy link
Member

bigkevmcd commented Nov 28, 2019

Proposal

Now that we have GitHub/GitLab interception, it'd be nice if we could match only on specific branch/repo combinations for things.

e.g. if you want to only execute triggers on a push to "master" for a repo, or maybe a build when a pull request is opened in a repo.

Perhaps something like...

  triggers:
    - name: foo-trig
      interceptor:
        github:
          secretRef:
            secretName: foo
            secretKey: bar
            namespace: baz
          eventTypes:
          - pull_request:
              repo: tektoncd/triggers
              action: opened
      bindings:
      - name: pipeline-binding
      template:
        name: pipeline-template

or for merges:

          eventTypes:
          - push:
              repo: tektoncd/triggers
              branch: master

For GitLab support, I'm not sure if this would use merge_request (GitLab terminology) or pull_request, that's a fairly trivial change tho'.

If configured to match only on pull_request events, it would return an error if it didn't match the repo/action combination, for unknown events/unconfigured events, it would just return the body unchanged.

@bigkevmcd
Copy link
Member Author

bigkevmcd commented Nov 28, 2019

A more radical proposal, is to separate interception and filtering, and allow for filtering (interception) and modification, for example, trimming a SHA to 6 characters, or splitting the branch from refs/heads/master.

This is because currently, "interception" allows the interceptor to modify the body, which is injected to the binding process, separating filtering from this modification, would allow the use of CEL to implement the filtering, and move the modification problem elsewhere

@dibyom
Copy link
Member

dibyom commented Dec 2, 2019

A more radical proposal, is to separate interception and filtering, and allow for filtering (interception) and modification, for example, trimming a SHA to 6 characters, or splitting the branch from refs/heads/master.

Yeah, we are working on implementing Filtering as it own thing that's separate from interceptors in #49 . The main use cases we see for filtering are the ones you mentioned above such filtering on branches, repo name etc. 👼

@dibyom
Copy link
Member

dibyom commented Jan 27, 2020

I think we can close this issue now since we have CEL based filtering to do this!

@dibyom
Copy link
Member

dibyom commented Jan 27, 2020

/close

@tekton-robot
Copy link

@dibyom: Closing this issue.

In response to this:

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants