Skip to content

Fix temp directory leak in Azure fork deploy #97

@ewega

Description

@ewega

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:

  1. Return a cleanup function alongside the path: func findRepoRoot() (string, func(), error)
  2. Or have runDeployAzure defer cleanup after calling findRepoRoot

Acceptance Criteria

  • Temp directory is removed after Azure fork deploy completes (success or failure)
  • Existing local fork deploy still works (deploy_local.go already handles this correctly)
  • go build ./... and go test ./... pass

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions