From 4ece7431afb5c9a7060c4185600f7e742007bdd3 Mon Sep 17 00:00:00 2001 From: sneak Date: Tue, 30 Dec 2025 11:57:02 +0700 Subject: [PATCH] Use app name and deployment ID in build directory structure Change build directory from builds/- to builds//- for better organization and easier debugging. --- internal/service/deploy/deploy.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/service/deploy/deploy.go b/internal/service/deploy/deploy.go index e72aad9..6065eb0 100644 --- a/internal/service/deploy/deploy.go +++ b/internal/service/deploy/deploy.go @@ -205,17 +205,18 @@ func (svc *Service) cloneRepository( deployment *models.Deployment, ) (string, func(), error) { // Use a subdirectory of DataDir for builds since it's mounted from the host - // and accessible to Docker for bind mounts (unlike /tmp inside the container) - buildsDir := filepath.Join(svc.config.DataDir, "builds") + // and accessible to Docker for bind mounts (unlike /tmp inside the container). + // Structure: builds//- + appBuildsDir := filepath.Join(svc.config.DataDir, "builds", app.Name) - err := os.MkdirAll(buildsDir, buildsDirPermissions) + err := os.MkdirAll(appBuildsDir, buildsDirPermissions) if err != nil { svc.failDeployment(ctx, app, deployment, fmt.Errorf("failed to create builds dir: %w", err)) return "", nil, fmt.Errorf("failed to create builds dir: %w", err) } - tempDir, err := os.MkdirTemp(buildsDir, app.ID+"-*") + tempDir, err := os.MkdirTemp(appBuildsDir, fmt.Sprintf("%d-*", deployment.ID)) if err != nil { svc.failDeployment(ctx, app, deployment, fmt.Errorf("failed to create temp dir: %w", err))