Disabling a repo doesn't remove CRON builds
Opened this issue · 0 comments
pat-s commented
Component
server
Describe the bug
When disabling a repo, the id
in the repos table is set to 0
. However, existing CRON tasks defined in the repo are not altered in the crons
table.
The server is trying to execute them normally and fails in the logs with
Whether or not the CRONs should be deleted is debatable (likely not so they continue to work in case the repo gets enabled again). Yet then they should gain a new column which indicates whether they are active or not.
The following DB query can temporarily clean up (= delete) CRON jobs of deactivated repos:
DELETE FROM crons
WHERE repo_id IN (
SELECT id
FROM repos
WHERE user_id = '0'
);
This could also be part of a daily "garbage collection" job.
Steps to reproduce
- Define CRON
- Disable a repo
- Inspect server logs during execution
Expected behavior
CRONs are disabled/not run when a repo is disabled.
System Info
2.7.3
Additional context
No response
Validations
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Checked that the bug isn't fixed in the
next
version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]