Skip to content
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

Disabling a repo doesn't remove CRON builds #4361

Open
3 tasks done
pat-s opened this issue Nov 11, 2024 · 0 comments
Open
3 tasks done

Disabling a repo doesn't remove CRON builds #4361

pat-s opened this issue Nov 11, 2024 · 0 comments
Labels
bug Something isn't working server

Comments

@pat-s
Copy link
Contributor

pat-s commented Nov 11, 2024

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

image

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

  1. Define CRON
  2. Disable a repo
  3. 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]
@pat-s pat-s added bug Something isn't working server labels Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working server
Projects
None yet
Development

No branches or pull requests

1 participant