You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2021/03/19 15:18:55 UTC

[camel-k] 09/13: fix: Use working directory to executed builder task if not set

This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 7fbcf94bc05b9d62c8dc696a37e2ee999ad1af34
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Thu Mar 18 17:54:00 2021 +0100

    fix: Use working directory to executed builder task if not set
---
 pkg/builder/builder.go | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/pkg/builder/builder.go b/pkg/builder/builder.go
index 54c72d1..4751b23 100644
--- a/pkg/builder/builder.go
+++ b/pkg/builder/builder.go
@@ -19,8 +19,6 @@ package builder
 
 import (
 	"context"
-	"io/ioutil"
-	"os"
 	"path"
 	"sort"
 	"time"
@@ -44,14 +42,11 @@ func (t *builderTask) Do(ctx context.Context) v1.BuildStatus {
 
 	buildDir := t.task.BuildDir
 	if buildDir == "" {
-		tmpDir, err := ioutil.TempDir(os.TempDir(), "builder-")
-		if err != nil {
-			log.Error(err, "Unexpected error while creating a temporary dir")
-			result.Phase = v1.BuildPhaseFailed
-			result.Error = err.Error()
-		}
-		buildDir = tmpDir
-		defer os.RemoveAll(buildDir)
+		// Use the working directory.
+		// This is useful when the task is executed in-container,
+		// so that its WorkingDir can be used to share state and
+		// coordinate with other tasks.
+		buildDir = "."
 	}
 
 	c := builderContext{