gitforge/services/actions/TestDeleteTask/action_task.yml
Andreas Ahlenstorf 7bd33f32e2 fix: do not try to remove task logs that don't exist (#13040)
The routines for the removal of `ActionTask` expect that each `ActionTask` has logs attached and that `LogFilename` isn't empty. However, that is not always the case. For example, Forgejo can resolve jobs without dispatching them to a runner. In that case, a placeholder task is created without logs and `LogFilename`. The log removal routines simply concatenate the path of the log storage directory and `LogFilename` and try to delete that without verifying that `LogFilename` is present. Consequently, they try to remove the log storage directory. In most cases, that causes an error because the directory contains some files. To prevent that from happening, the log removal routines no longer allow empty filenames. And it is checked whether a task has logs before invoking them.

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [ ] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13040
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-11 02:03:05 +02:00

23 lines
507 B
YAML

- id: 87601
log_filename: somebody/somerepo/15631/87601.log.zst
log_in_storage: false
status: 1 # StatusSuccess
runner_id: 41601
- id: 87602
log_filename: somebody/somerepo/15632/87602.log.zst
log_in_storage: false
status: 6 # StatusRunning
- id: 87603
log_filename: somebody/somerepo/15631/87603.log.zst
log_in_storage: false
status: 2 # StatusFailure
runner_id: 41602
- id: 87604
log_filename: ""
log_in_storage: true
log_length: 0
log_size: 0
status: 4 # StatusSkipped