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

Housekeeping For Old Action Runs And Related Tables #32809

Open
Drophoff opened this issue Dec 12, 2024 · 4 comments
Open

Housekeeping For Old Action Runs And Related Tables #32809

Drophoff opened this issue Dec 12, 2024 · 4 comments
Labels
topic/gitea-actions related to the actions of Gitea type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@Drophoff
Copy link

Feature Description

Abstract

I would like to put forward an idea for deleting obsolete data records for discussion before starting the implementation.

From my perspective, I would offer the ability to delete obsolete action runs and associated entries from the database, if desired and configured by the administrator.

The idea is related to issue #24256.

Currently, obsolete artefacts (packages) are deleted and obsolete log entries are handled as part of a background process.

In future, the following database tables should also be taken into account:

  • ActionTaskStep
  • ActionTaskOutput
  • ActionRun
  • ActionRunJob
  • ActionTask

Concept/idea

Additional logic is implemented in the existing cleanup background process in the action package (services.actions.cleanup.go). This searches for ActionTasks with outdated logs (LogsExpired=true) and which are older than a configurable period RunTaskRetentationDays. The search logic is almost identical to actions_model.FindOldTasksToExpire. Based on the found ActionTasks, the associated data records are determined (TasksStep, TaskOutput, ActionRun etc.) and physically deleted.

Restrictions

  • The additional cleanup requires that the logs are already expired. This means that there is a time dependency between the existing cleanup and this additional logic.
  • RunTaskRetentionDays is implemented as a new configuration value analogue to LogRetentionDays. Due to the temporal interlocking, RunTaskRetentationDays is added to LogRetentionDays. This means that the log entries are cleared up after ten days, for example (LogRetentionDays=10) and the outdated action runs after fifteen days (RunTaskRetentionDays=5).

Benefits

Even after longer operation and many action runs, the UI with the action tab remains clear, as old actions that are no longer relevant are automatically tidied up and removed by a background process.

Notes

This is my first involvement in this project. If I have misunderstood anything, I apologise. Therefore, I am not sure whether the deletion of action task is desired.

If this idea is in the spirit of the project, I can prepare a corresponding feature branch, but I would need some support with the implementation.

Screenshots

OutdatedActionsRuns

@Drophoff Drophoff added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Dec 12, 2024
@lunny
Copy link
Member

lunny commented Dec 12, 2024

I think we should start from #26219 before this work. Because the purge logic is the same.

@Drophoff
Copy link
Author

That sounds like a good idea. Thank you very much for your feedback.

@kemzeb kemzeb added the topic/gitea-actions related to the actions of Gitea label Dec 13, 2024
@ghnp5
Copy link

ghnp5 commented Jan 10, 2025

Hey!
Just to confirm - this is about automatically purging old Action runs, which logs are already expired with:

Logs have been purged because they were too old.

Is my understanding correct?

I was about to create a feature request for this, and this Issue is the only one I found that seems to mention what I wanted to suggest.

I thought v1.23 was going to actually delete old runs, but seems only the logs are removed, but looks like the runs remain in the history, which isn't ideal (but it's better than nothing!).

Thanks!

@Drophoff
Copy link
Author

Hi @ghnp5,

Yes, your assumption is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gitea-actions related to the actions of Gitea type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

4 participants