fix(functions): clean up all orphaned local-run directories - #3989
fix(functions): clean up all orphaned local-run directories#3989Elvand-Lie wants to merge 2 commits into
Conversation
Signed-off-by: Elvand-Lie <elvandlie@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Elvand-Lie The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Elvand-Lie. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@Elvand-Lie: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Signed-off-by: Elvand-Lie <elvandlie@gmail.com>
Changes
cleanupJobDirs()now keeps scanning.func/runs/after removing an orphaned run directory, so a new Job cleans up every stale entry instead of only the first one. The regression test covers one active run directory, two stale directories, and the newly created Job.Problem
cleanupJobDirs()returned directly from the directory loop after its first successfulos.RemoveAll(...)call. If more than one stale.func/runs/<port>directory existed, the remaining entries were left behind and could still be reported as local function instances. Local invocation could then select a stale port even when a new function was available on another port.Fix
The cleanup loop now continues after each successful removal and returns only when a removal fails. Active port directories are still preserved, files and non-integer directories are still ignored, and there are no public API or metadata changes.
Testing
The regression test creates one active run directory, two stale run directories, and one new Job. It verifies that both stale directories are removed, the active directory remains, and the new Job directory is created.
The exact submitted commit (
beccbf4e8ba4fad6fc6b83b3d0742774a870e30b) passed the full workflow in the fork: https://github.com/Elvand-Lie/func/actions/runs/30923394939. All 23 applicable unit, integration, template, Podman, and runtime E2E jobs passed; the three release/publish jobs were skipped as expected.Local static checks (
gofmt,git diff --check, andmake check-whitespace check-eof) also passed. Full Go tests could not run locally because the ARM64 environment could not retrieve the Go 1.26 toolchain, so the fork workflow supplied that validation.Release Note
Docs