-
Notifications
You must be signed in to change notification settings - Fork 4
Fix temp directory leak in Azure fork deploy #97
Copy link
Copy link
Closed
Description
Problem
findRepoRoot() in cmd/deploy_azure.go:377 creates a temporary directory with os.MkdirTemp, clones a DevLake repo into it, and returns the path. However, the caller (runDeployAzure) never removes the temporary directory after use.
go func findRepoRoot() (string, error) { if azureRepoURL != "" { tmpDir, err := os.MkdirTemp("", "devlake-clone-*") // ... return tmpDir, nil // caller never cleans up tmpDir } }
By contrast, deployLocalFork_clone in deploy_local.go:304-309 correctly uses defer os.RemoveAll(tmpDir).
Each Azure fork deploy leaks ~100MB+ of cloned source code in the system temp directory.
Fix
Either:
- Return a cleanup function alongside the path:
func findRepoRoot() (string, func(), error) - Or have
runDeployAzuredefer cleanup after callingfindRepoRoot
Acceptance Criteria
- Temp directory is removed after Azure fork deploy completes (success or failure)
- Existing local fork deploy still works (
deploy_local.goalready handles this correctly) -
go build ./...andgo test ./...pass
Reactions are currently unavailable
Metadata
Metadata
Labels
bugSomething isn't workingSomething isn't working