1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-30 19:22:09 +00:00

fix: remove LXC working directory when it completes

The working directory was not cleaned up upon completion of a LXC job because
rc.stopJobContainer() -> rc.cleanUpJobContainer() -> rc.JobContainer.Remove()
was never called for LXC containers.

- stopContainer() and closeContainer() must not call
  rc.stopHostEnvironment(ctx) for LXC containers because
  - it will needlessly be called twice
  - it intercepts the call to
    - rc.stopJobContainer()
    - rc.JobContainer.Close()
- rc.stopHostEnvironment(ctx) must be called in rc.cleanUpJobContainer
  which is indirectly called by rc.stopJobContainer()
- since rc.JobContainer.Close() is a noop, not calling it for LXC
  containers had no consequence

Resolves forgejo/runner#442
This commit is contained in:
Earl Warren 2025-09-16 12:27:07 +02:00
parent 8a97e4b5d3
commit 9c24e5bfc3
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 10 additions and 7 deletions

View file

@ -407,6 +407,7 @@ func (e *HostEnvironment) Remove() common.Executor {
if e.CleanUp != nil {
e.CleanUp()
}
common.Logger(ctx).Debugf("HostEnvironment.Remove %s", e.Path)
return os.RemoveAll(e.Path)
}
}