Skip to content

Commit

Permalink
fix: werf-in-a-user-namespace not found, cannot start auto host clean…
Browse files Browse the repository at this point in the history
…up procedure

Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Apr 5, 2023
1 parent 94f2b42 commit f7ecd7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 8 additions & 0 deletions cmd/werf/common/container_backend.go
Expand Up @@ -16,6 +16,14 @@ import (
)

func ContainerBackendProcessStartupHook() (bool, error) {
switch {
case strings.HasPrefix(os.Args[0], "buildah-") || strings.HasPrefix(os.Args[0], "chrootuser-") || strings.HasPrefix(os.Args[0], "storage-"):
case os.Getenv("WERF_ORIGINAL_EXECUTABLE") == "":
if err := os.Setenv("WERF_ORIGINAL_EXECUTABLE", os.Args[0]); err != nil {
return false, fmt.Errorf("error setting werf original args env var: %w", err)
}
}

buildahMode, _, err := GetBuildahMode()
if err != nil {
return false, fmt.Errorf("unable to determine buildah mode: %w", err)
Expand Down
6 changes: 0 additions & 6 deletions pkg/werf/main.go
Expand Up @@ -165,11 +165,5 @@ 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 f7ecd7d

Please sign in to comment.