diff --git a/teps/0083-scheduled-pipelinerun--tekton-polling.md b/teps/0083-scheduled-pipelinerun--tekton-polling.md new file mode 100644 index 000000000..14eae9e7a --- /dev/null +++ b/teps/0083-scheduled-pipelinerun--tekton-polling.md @@ -0,0 +1,363 @@ +--- +status: proposed +title: Scheduled Pipelinerun & Tekton Polling +creation-date: '2021-09-13' +last-updated: '2021-09-13' +authors: +- '@vdemeester' +- '@sm43' +--- + +# TEP-0083: Scheduled Pipelinerun & Tekton Polling + + + + + + + + +- [Summary](#summary) +- [Motivation](#motivation) + - [Goals](#goals) + - [Non-Goals](#non-goals) + - [Use Cases (optional)](#use-cases-optional) +- [Requirements](#requirements) +- [Proposal](#proposal) + - [Notes/Caveats (optional)](#notescaveats-optional) + - [Risks and Mitigations](#risks-and-mitigations) + - [User Experience (optional)](#user-experience-optional) + - [Performance (optional)](#performance-optional) +- [Design Details](#design-details) +- [Test Plan](#test-plan) +- [Design Evaluation](#design-evaluation) +- [Drawbacks](#drawbacks) +- [Alternatives](#alternatives) +- [Infrastructure Needed (optional)](#infrastructure-needed-optional) +- [Upgrade & Migration Strategy (optional)](#upgrade--migration-strategy-optional) +- [Implementation Pull request(s)](#implementation-pull-request-s) +- [References (optional)](#references-optional) + + +## Summary + + + +This TEP introduces an idea for a feature in triggers which allows user to +- Schedule a pipelinerun/taskrun at a certain time +- Setup a poll which looks for changes on a repository and triggers pipelinerun/taskrun. + +## Motivation + + + +- To allow users to schedule a pipelinrun at a certain time or at certain interval + + Ex. I want to run a pipeline every day at 8 am. Currently, I can do this by setting up a cronjob, but having as a part of Trigger could be a good idea. So, Triggers can start a pipelinerun at the time mentioned by me. + +- To allow users to use triggers without need to setup a webhook. Triggers could have a feature which allow user to setup a polling feature for a repository which would look for changes in repository and trigger a pipelinerun or taskrun. + + This was briefly discussed on Issue [#1168](https://github.com/tektoncd/triggers/issues/1168) and [#480](https://github.com/tektoncd/triggers/issues/480). + + This can be solved currently by a setting up a cronjob to check for changes but having as a part of triggers could enhance triggers. + +### Goals + + + +### Non-Goals + + + +### Use Cases (optional) + +(Scheduled Run) +- As a user, I want to run a pipeline everyday at a certain time. Currently, I can setup using a cronjob which would trigger the run but having this integrated with triggers would be nice. + + +(Polling) +- As a user, I don't have permission to setup a webhook on a repository having a polling feature could be helpful to solve this issue. I can configure the polling feature to look for changes and trigger a pipeline. + +- Due to restriction of company, users might not be able to expose eventlistener publicly so this could be an option which would look for changes at certain duration and trigger a Pipelinerun. [Reference.](https://github.com/tektoncd/triggers/issues/480#issuecomment-620605920) + +- As a developer, I want to be able to setup an automated release process that would look at a given branch (release-vX…) and automatically schedule a build and tag a release in case there was new changes (on a weekly cadence for example). *Note: it can be achieved using a `CronJob` but would be nicer to be integrated in triggers*. + + + + + +## Requirements + + + +## Proposal + + + +We have a POC done around this part of this idea described in [#1168](https://github.com/tektoncd/triggers/issues/1168) which defines a new CRD as below. + +POC tries to implement the polling feature which would look for changes and trigger a piplinerun. This integrates the Trigger template and trigger binding to use data from the response of GitHub APIs used to look for changes. + +``` +apiVersion: triggers.tekton.dev/v1alpha1 +kind: SyncRepo +metadata: + name: test +spec: + repo: https://github.com/tektoncd/hub + branch: main + frequency: 3m + binding: pipeline-binding + template: pipeline-template +``` + +- This takes GitHub Repo URL and then check for changes at frequeny defined by user. +- It saves the latest commit id to status to check in further reconcilations. + + +## Questions + + +- Should we have them together? + - Trigger a pipelinerun at a certain time (cronjob/scheduling) + - Trigger a pipelinerun if something changed in repository (polling) + + +- Would it make sense to + - integrated polling feature with Trigger Binding and Trigger Template? or + - keep it independent which would take pipeline as input and create a pipelinerun on a change? + - or provide both of them together? + + + +### Notes/Caveats (optional) + + + +### Risks and Mitigations + + + +### User Experience (optional) + + + +### Performance (optional) + + + +## Design Details + + + +## Test Plan + + + +## Design Evaluation + + +## Drawbacks + + + +## Alternatives + +- There is an existing implementation independent of Triggers doing similar. + https://github.com/bigkevmcd/tekton-polling-operator + This has an CRD which takes input and the controller check for changes and trigger a run object. + + + +## Infrastructure Needed (optional) + + + +## Upgrade & Migration Strategy (optional) + + + +## Implementation Pull request(s) + + + +## References (optional) + +- Polling a repository to detect changes and trigger a pipeline [#1168](https://github.com/tektoncd/triggers/issues/1168) +- Poll based change detection? [#480](https://github.com/tektoncd/triggers/issues/480) + + + diff --git a/teps/README.md b/teps/README.md index 440e4effb..aa57a7693 100644 --- a/teps/README.md +++ b/teps/README.md @@ -222,3 +222,4 @@ This is the complete list of Tekton teps: |[TEP-0072](0072-results-json-serialized-records.md) | Results: JSON Serialized Records | implementable | 2021-07-26 | |[TEP-0073](0073-simplify-metrics.md) | Simplify metrics | proposed | 2021-06-23 | |[TEP-0080](0080-support-domainscoped-parameterresult-names.md) | Support domain-scoped parameter/result names | proposed | 2021-08-19 | +|[TEP-0083](0083-scheduled-pipelinerun--tekton-polling.md) | Scheduled Pipelinerun & Tekton Polling | proposed | 2021-09-13 |