Skip to content

Commit

Permalink
fix: 'exec: werf-in-a-user-namespace: executable file not found in $P…
Browse files Browse the repository at this point in the history
…ATH' when using buildah

Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Mar 28, 2023
1 parent 836fe04 commit 6323d8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/host_cleaning/host_cleanup.go
Expand Up @@ -86,7 +86,12 @@ func RunAutoHostCleanup(ctx context.Context, options AutoHostCleanupOptions) err
args = append(args, "--docker-server-storage-path", *options.DockerServerStoragePath)
}

cmd := exec.Command(os.Args[0], args...)
executableName := os.Getenv("WERF_ORIGINAL_EXECUTABLE")
if executableName == "" {
executableName = os.Args[0]
}

cmd := exec.Command(executableName, args...)

var env []string
for _, spec := range os.Environ() {
Expand Down
6 changes: 6 additions & 0 deletions pkg/werf/main.go
Expand Up @@ -164,5 +164,11 @@ func Init(tmpDirOption, homeDirOption string) error {
return fmt.Errorf("error setting werf last run at timestamp: %w", err)
}

if os.Getenv("WERF_ORIGINAL_EXECUTABLE") == "" {
if err := os.Setenv("WERF_ORIGINAL_EXECUTABLE", os.Args[0]); err != nil {
return fmt.Errorf("error setting werf original args env var: %w", err)
}
}

return nil
}

0 comments on commit 6323d8e

Please sign in to comment.