Skip to content

Commit

Permalink
fix(buildah): unable to find "pasta" binary
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed Mar 29, 2024
1 parent a21b3e9 commit 858933f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/buildah/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import (
)

const (
DefaultShmSize = "65536k"
DefaultShmSize = "65536k"
DefaultContainersConfig = `
[network]
default_rootless_network_cmd="slirp4netns"
`
DefaultSignaturePolicy = `{"default": [{"type": "insecureAcceptAnything"}], "transports": {"docker-daemon": {"": [{"type": "insecureAcceptAnything"}]}}}`
DefaultRegistriesConfig = `unqualified-search-registries = ["docker.io"]`
BuildahImage = "registry.werf.io/werf/buildah:v1.22.3-1"
Expand Down
10 changes: 10 additions & 0 deletions pkg/buildah/native_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type NativeBuildah struct {
InstanceTmpDir string
ConfigTmpDir string
SignaturePolicyPath string
ContainersConfigPath string
RegistriesConfigPath string
RegistriesConfigDirPath string
Insecure bool
Expand Down Expand Up @@ -111,6 +112,15 @@ func NewNativeBuildah(commonOpts CommonBuildahOpts, opts NativeModeOpts) (*Nativ
return nil, fmt.Errorf("unable to write file %q: %w", b.SignaturePolicyPath, err)
}

b.ContainersConfigPath = filepath.Join(b.ConfigTmpDir, "containers.conf")
if err := ioutil.WriteFile(b.ContainersConfigPath, []byte(DefaultContainersConfig), os.ModePerm); err != nil {
return nil, fmt.Errorf("unable to write file %q: %w", b.ContainersConfigPath, err)
}

if err := os.Setenv("CONTAINERS_CONF", b.ContainersConfigPath); err != nil {
return nil, fmt.Errorf("unable to set env var CONTAINERS_CONF: %w", err)
}

b.RegistriesConfigPath = filepath.Join(b.ConfigTmpDir, "registries.conf")
if err := ioutil.WriteFile(b.RegistriesConfigPath, []byte(DefaultRegistriesConfig), os.ModePerm); err != nil {
return nil, fmt.Errorf("unable to write file %q: %w", b.RegistriesConfigPath, err)
Expand Down

0 comments on commit 858933f

Please sign in to comment.