Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Allow events to initiate Builds #577

Open
imjasonh opened this issue Apr 3, 2018 · 8 comments
Open

Allow events to initiate Builds #577

imjasonh opened this issue Apr 3, 2018 · 8 comments

Comments

@imjasonh
Copy link
Member

imjasonh commented Apr 3, 2018

The eventing controller seems to be focused on routing events to Elafros apps via routes.

If it were also possible to initiate builds in response to events of all of the types supported by eventing, we could make a big stride toward a general-purpose K8s-native CI platform, supporting builds in response to webhooks, or on a schedule, or in response to PubSub events, etc. If builds were able to automatically trigger deployments, we'd get CD as well.

Sharing these concepts and triggering infrastructure could help reduce new code that would have to be written and maintained, and new concepts that would have to be understood by users.

@imjasonh
Copy link
Member Author

imjasonh commented Apr 3, 2018

From my understanding of the eventing API model, it seems like we could start by adding a TemplateInstantiationSpec field to BindAction, which would instantiate the specified BuildTemplate with provided arguments to generate a build to execute.

Beyond that, we'd probably want some way to dynamically pipe values from the event itself to the triggered template instantiation, to be able to pass values like the Git commit SHA that triggered the build, or the time the scheduled build was invoked, or values from the PubSub message, etc.

I'm open to ideas about how best to do that, or if I'm thinking about this in the wrong way and there's a better way to piece things together.

@evankanderson
Copy link
Member

evankanderson commented Apr 3, 2018 via email

@imjasonh
Copy link
Member Author

imjasonh commented Apr 3, 2018

That might be possible, but I'm worried that ties Build CRD too closely with Elafros itself.

In the long-term, I'd love for it to be possible to install the Build CRD controller, and future related CI/CD controllers (possibly including Eventing), possibly without Elafros' controllers, if the user doesn't want to have a full serverless platform installed, and just wants on-cluster CI/CD.

Having Eventing be able to trigger Builds directly is part of that long-term vision.

@evankanderson
Copy link
Member

evankanderson commented Apr 3, 2018 via email

@inlined
Copy link

inlined commented Apr 17, 2018

This is a great use case and should definitely be in our samples folder. I think it's both useful and a good litmus test for how we can eventually support it without hard-coding that support.

The first step should be to make Bind.Spec.Action more generic. This will let us deploy a Bind (reminder: that CRD name will change) that sends events which should trigger a build to the builder service. What sort of trigger are you most interested? Git commits to master? pull requests? If there's a good use case from another event source that would be great too.

@mgreau
Copy link

mgreau commented Jan 30, 2019

In the long-term, I'd love for it to be possible to install the Build CRD controller, and future related CI/CD controllers (possibly including Eventing), possibly without Elafros' controllers, if the user doesn't want to have a full serverless platform installed, and just wants on-cluster CI/CD.

Having Eventing be able to trigger Builds directly is part of that long-term vision.

^ Exactly what I am looking for :)
Being able to install only the Pipeline and Eventing CRDs to trigger a PipelineRun based on a GitHub events, for example, would be really great! (as explained here)

@imjasonh @evankanderson any update on this? Thanks

@evankanderson
Copy link
Member

The current githubsource in https://github.com/knative/eventing-sources using Knative Serving as part of its implementation.

If you can find a github event deliver-er which doesn't use serving, then you should be all set. (You could probably change the implementation to use a Deployment, but you'll have one or more Pods running for each GitHub webhook, whereas with Serving mostly you'll have zero Pods except when GitHub webhooks are happening.)

akashrv referenced this issue in akashrv/eventing Mar 8, 2019
@evankanderson
Copy link
Member

We have a GitHub event source which can be wired directly or indirectly to anything which matches the Addressable duck type.

Since an HTTP POST of a CloudEvent is unlikely to directly create any Kubernetes resources, Build probably needs to figure out how to use a CloudEvent to create a Kubernetes object. Moving to Build.

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

Successfully merging a pull request may close this issue.

4 participants