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

leverage tekton SCM trigger support #51

Open
gabemontero opened this issue Mar 4, 2020 · 7 comments
Open

leverage tekton SCM trigger support #51

gabemontero opened this issue Mar 4, 2020 · 7 comments
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@gabemontero
Copy link
Member

today the https://github.com/tektoncd/triggers project provides github/gitlab styled webhook trigger support for creating tekton API object to trigger their CI/CD pipelines.

This is akin to the webhook support in openshift build v1

In theory build v2 could deploy tekton trigger event sinks in conjunction with their controller and define event triggers that will run the same underlying tekton objects which buildv2 maps too.

@gabemontero gabemontero added the buildv1 Items with this label somehow pertain to getting equivalent buildv1 function in buildv2 label Mar 9, 2020
@zhangtbj
Copy link
Contributor

We used the tekton triggers in our source-to-image PoC. It works well.
We defined two kinds of triggers:
Github webhook triggers (source code change and rebuild)
dockerhub webhook triggers (builder or baseimage change and rebuild)

for each webhook triggers, there is a trigger event listener in the cluster that keep monitor the event from each webhook then trigger the Tekton trigger template to do the source-to-image build task.

If you interest, I can show your our PoC demo and what we did by using it.

@zhangtbj zhangtbj added kind/feature Categorizes issue or PR as related to a new feature. Release 0.2.x Label for release 0.2.x labels May 25, 2020
@qu1queee qu1queee added the beta BETA related issue label Oct 6, 2020
@qu1queee qu1queee added this to the release-v1.0.0 milestone Oct 6, 2020
@qu1queee qu1queee removed the Release 0.2.x Label for release 0.2.x label Oct 6, 2020
@gabemontero
Copy link
Member Author

Jotting down some notes/updates from some of my recent upstream Tekton Trigger WG activities

These notes should be consider complimentary or building upon to @zhangtbj 's comments here back in March, as his description there lines up with my improved understanding/interpretation since the initial description in this issue of what is available with tekton triggers.

  1. https://github.com/tektoncd/community/pull/229/files contains a proposal that will improve the experience around plugging in interceptors

  2. while technically SCM based triggers like github, etc. exist in triggers today, I'm currently of the opinion that we could proscribe replacing the built in versions of those for any deployed EventListeners that are intended to serve an associated shipwright deployment, plugging in our own implementations of those github etc. interceptors, as the new TEP would allow

  3. then as @zhangtbj mentioned, our new interceptor (a webhook interceptor that would replace the built in interceptor) would construct trigger templates with the underlying tekton tasks/taskruns etc. created by the shipwright controllers

you can either inline those trigger templates def, or use a reference approach, where the event listener sink then reads it it (see sink.go's processTrigger method, which calls ExecuteInterceptor followed by ResolveTrigger ... fwiw the trigger code looks at the in line fields first, and if it sees nothing there, tries the ref)

  1. mult tenent event listeners (https://github.com/tektoncd/community/blob/master/teps/0009-trigger-crd.md) from pipelines team here at redhat have also gained some traction upstream

I think we'll want to consider the pros/cons cluster scope vs. per namespace EL's as we go down this path

@adambkaplan adambkaplan removed beta BETA related issue buildv1 Items with this label somehow pertain to getting equivalent buildv1 function in buildv2 labels Oct 29, 2020
@adambkaplan
Copy link
Member

Moving this to the post GA backlog. Triggers are an important feature, but not absolutely required.

@qu1queee qu1queee added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jan 15, 2021
@sbose78
Copy link
Member

sbose78 commented Mar 8, 2021

I was exploring the possibility of creating the following resources when the user expresses the intent to use webhooks with GitHub(for example):

  • TriggerBinding
  • TriggerTemplate ( to create a BuildRun )
  • EventListener

This experiment didn't succeed because the admission webhook doesn't let TriggerTemplate specify non-Tekton resources for creation.

Potential next steps:

  • Propose upstream that "Tekton Triggers" as a project be used for creation of arbitrary resource types ( and not just Tekton types ). This would need the design to address security
  • Propose that we make the "supported TriggerTemplate types" configurable, per installation of Tekton.

Questions that need to be answered in future:

  1. Should we have an EventListener per Build
  2. Should we have an EventListener per namespace.
  3. Should we have an EventListener per cluster, for handling builds ( definitely not keen on this ).

@gabemontero
Copy link
Member Author

I was exploring the possibility of creating the following resources when the user expresses the intent to use webhooks with GitHub(for example):

* `TriggerBinding`

* `TriggerTemplate` ( to create a `BuildRun` )

* `EventListener`

This experiment didn't succeed because the admission webhook doesn't let TriggerTemplate specify non-Tekton resources for creation.

Yes a subject that has come up before in the upstream triggers WG.

Main reason it has not happened yet is security concerns, as you noted below.

Potential next steps:

* Propose upstream that "Tekton Triggers" as a project be used for creation of arbitrary resource types ( and not just Tekton types ). This would need the design to address security

@imjasonh and I had a recent slack discussion on this as well. I would sign off on the upstream proposal if

  • it is opt it
  • can be enabled / disabled on a per namespace basis
  • which precise objects that could be added could be specified
  • rbac around this, akin to our csi driver stuff, would be nice too
* Make the "supported types" configurable per installation of Tekton.

@gabemontero
Copy link
Member Author

The impersonation piece I placed into triggers could also help facilitate expanding the list of objects triggers can create.

@gabemontero
Copy link
Member Author

UPDATE: so @sbose78 's #912 is a take at SCM based triggering

This issue was originally just SCM based triggering

For image based triggering, upstream would either start or build off of https://github.com/shipwright-io/community/blob/main/ships/0020-shipwright-image-api.md

For openshift imagestreams, feels very much downstream only at the moment, unless a shipwright image api implementation sheds further light on that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

5 participants