-
Notifications
You must be signed in to change notification settings - Fork 110
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
Automatically delete old pr and tr on dogfooding #442
Conversation
This PR cannot be merged: expecting exactly one kind/ label Available
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/meow
In response to this:
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. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
5330f35
to
4057535
Compare
Add a new trigger to the tekoncd event listener, for cleanup. The triggers runs tkn pr|tr delete --all with a --keep param, to keep the latest N runs. Add a cluster role and a service account bound to it in the default and tektonci namespaces. The cluster role gives permission to list and delete prs and trs. Add a cluster resource that uses the new service account. This is used by the cleanup task to direct tkn to the dogfooding cluster. Add a new cronjob base for cleanup jobs, and a two jobs based out of it, to cleanup in the default and tektonci namespaces on the dogfooding cluster, Once this is in place, it will be easy to add more cronjobs to cleanup other namespaces / clusters if needed. It will also be possiblo iterate on the cleanup task adding more features and nobs to it. The secret used by the pipeline resources must be created manually once this is provisioned for it to work. Fixes tektoncd#439
4057535
to
f5afe27
Compare
tkn pr delete -n $(params.namespace) --all --keep $(params.keep) | ||
# Keep double the amount of tr, for standalone trs | ||
tkn tr delete -n $(params.namespace) --all --keep $(( $(params.keep) * 2 )) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Depending on the version of tkn
, you should be able to use --keep
without --all
:
tkn pr delete -n $(params.namespace) --keep $(params.keep)
tkn tr delete -n $(params.namespace) --keep $(params.keep)
Was introduced in v0.9.0
and should provide same behavior: tektoncd/cli#921
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm |
Hi, |
@vmendis-stash this PR is related to Tekton's own CI/CD infrastructure. We are "dogfooding" this approach to try it out. For ongoing work around a user-facing solution to this problem please follow tektoncd/experimental#479 |
Changes
Add a new trigger to the tekoncd event listener, for cleanup.
The triggers runs tkn pr|tr delete --all with a --keep param,
to keep the latest N runs.
Add a cluster role and a service account bound to it in the
default and tektonci namespaces. The cluster role gives
permission to list and delete prs and trs.
Add a cluster resource that uses the new service account.
This is used by the cleanup task to direct tkn to the
dogfooding cluster.
Add a new cronjob base for cleanup jobs, and a two jobs
based out of it, to cleanup in the default and tektonci
namespaces on the dogfooding cluster,
Once this is in place, it will be easy to add more cronjobs
to cleanup other namespaces / clusters if needed.
It will also be possiblo iterate on the cleanup task adding
more features and nobs to it.
The secret used by the pipeline resources must be created
manually once this is provisioned for it to work.
Fixes #439
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide
for more details.
/kind feature