Skip to content

Commit

Permalink
fix(buildah): broken build on mac/win
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 Nov 2, 2022
1 parent c0de754 commit 1118613
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/buildah/common.go
Expand Up @@ -101,7 +101,7 @@ type ConfigOpts struct {
EntrypointPrependShell bool
User string
Workdir string
Healthcheck *thirdparty.HealthConfig
Healthcheck *thirdparty.BuildahHealthConfig
OnBuild string
StopSignal string
Shell []string
Expand Down
2 changes: 1 addition & 1 deletion pkg/buildah/thirdparty/healthcheck_linux.go
Expand Up @@ -5,4 +5,4 @@ package thirdparty

import "github.com/containers/buildah/docker"

type HealthConfig docker.HealthConfig
type BuildahHealthConfig docker.HealthConfig
2 changes: 1 addition & 1 deletion pkg/buildah/thirdparty/healthcheck_others.go
Expand Up @@ -6,7 +6,7 @@ package thirdparty
import "time"

// Copied from github.com/containers/buildah@v1.26.1/docker/types.go:52
type HealthConfig struct {
type BuildahHealthConfig struct {
Test []string `json:",omitempty"`
Interval time.Duration `json:",omitempty"`
Timeout time.Duration `json:",omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions pkg/container_backend/buildah_backend.go
Expand Up @@ -905,8 +905,8 @@ func getGIDFromGroupName(group, etcGroupPath string) (uint32, error) {
return 0, fmt.Errorf("could not find GID for group %q in passwd file %q", group, etcGroupPath)
}

// Can return nil pointer to HealthConfig
func newHealthConfigFromString(healthcheck string) (*thirdparty.HealthConfig, error) {
// Can return nil pointer to BuildahHealthConfig
func newHealthConfigFromString(healthcheck string) (*thirdparty.BuildahHealthConfig, error) {
if healthcheck == "" {
return nil, nil
}
Expand All @@ -932,7 +932,7 @@ func newHealthConfigFromString(healthcheck string) (*thirdparty.HealthConfig, er
}

healthcheckcmd := cmd.(*instructions.HealthCheckCommand)
healthconfig := (*thirdparty.HealthConfig)(healthcheckcmd.Health)
healthconfig := (*thirdparty.BuildahHealthConfig)(healthcheckcmd.Health)

return healthconfig, nil
}
2 changes: 1 addition & 1 deletion pkg/container_backend/instruction/healthcheck.go
Expand Up @@ -26,7 +26,7 @@ func (i *Healthcheck) UsesBuildContext() bool {
func (i *Healthcheck) Apply(ctx context.Context, containerName string, drv buildah.Buildah, drvOpts buildah.CommonOpts, buildContextArchive container_backend.BuildContextArchiver) error {
if err := drv.Config(ctx, containerName, buildah.ConfigOpts{
CommonOpts: drvOpts,
Healthcheck: (*thirdparty.HealthConfig)(i.Health),
Healthcheck: (*thirdparty.BuildahHealthConfig)(i.Health),
}); err != nil {
return fmt.Errorf("error setting healthcheck for container %s: %w", containerName, err)
}
Expand Down

0 comments on commit 1118613

Please sign in to comment.