Triggering from GitHub Pull Requests
We would like to be able to trigger pipelines based on GitHub pull requests and be able to bind artefacts from that pull request branch.
Our use case is that we have many pipelines in other tools currently that run when pull requests are opened/updated. For example we:
- Deploy PR changes to kubernetes
- Plan terraform changes (in some cases apply as well)
Currently it is possible to trigger a pipeline when the pull request webhook is received, but it is somewhat limited in its functionality (I've pasted some notes I found while investigating this below). It would be great if this support was expanded.
- PRs from forks are no-go (the code for PR events returns the destination repos fullname, not the one the PR came from, but even then you'd need to add a trigger for every single user for it to work)
- You can't trigger from PRs specifically. The PR event from GH only includes the source branch name and that's what Spinnaker consumes. You could enforce that all branches are named a certain way to match a regex, but then you'd still hit the issue below.
- You can either trigger from PRs or branches. Because the GH webhook settings don't allow you to limit which branches events are sent for, if you configure the hook to send push and pull_request events, then your trigger will fire on every push to your branch anyway (because of the push event). You could only configure the hook for pull_request events, but then you can't trigger from pushes to master anymore.
- Artifacts can't be matched from a pullrequest event, so it's impossible to bind a manifest or dockerfile to an expected artifact. The code for matching git events to artifacts scans through the commits of the push event (which doesn't exist on the PR event).