Skip to content

Commit

Permalink
fix: "docker-compose": executable file not found error
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 Jun 17, 2024
1 parent 111bbd6 commit 835290a
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions cmd/werf/compose/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,6 @@ func newCmd(ctx context.Context, composeCmdName string, options *newCmdOptions)
cmdData.ComposeCommandOptions = strings.Fields(cmdData.RawComposeCommandOptions)
}

if err := checkComposeBin(cmdData); err != nil {
return err
}

return runMain(ctx, composeCmdName, cmdData, commonCmdData, options.FollowSupport)
},
})
Expand Down Expand Up @@ -228,23 +224,12 @@ func newCmd(ctx context.Context, composeCmdName string, options *newCmdOptions)

cmd.Flags().StringVarP(&cmdData.RawComposeOptions, "docker-compose-options", "", os.Getenv("WERF_DOCKER_COMPOSE_OPTIONS"), "Define docker-compose options (default $WERF_DOCKER_COMPOSE_OPTIONS)")
cmd.Flags().StringVarP(&cmdData.RawComposeCommandOptions, "docker-compose-command-options", "", os.Getenv("WERF_DOCKER_COMPOSE_COMMAND_OPTIONS"), "Define docker-compose command options (default $WERF_DOCKER_COMPOSE_COMMAND_OPTIONS)")
cmd.Flags().StringVarP(&cmdData.ComposeBinPath, "docker-compose-bin-path", "", os.Getenv("WERF_DOCKER_COMPOSE_BIN_PATH"), "Define docker-compose bin path (default $WERF_DOCKER_COMPOSE_BIN_PATH)")
// TODO(3.0): delete this flag
cmd.Flags().StringVarP(&cmdData.ComposeBinPath, "docker-compose-bin-path", "", os.Getenv("WERF_DOCKER_COMPOSE_BIN_PATH"), "DEPRECATED: \"docker compose\" command always used now, this option is ignored. Define docker-compose bin path (default $WERF_DOCKER_COMPOSE_BIN_PATH)")

return cmd
}

func checkComposeBin(cmdData composeCmdData) error {
dockerComposeBinPath := "docker-compose"
if cmdData.ComposeBinPath != "" {
dockerComposeBinPath = cmdData.ComposeBinPath
}

if _, err := exec.LookPath(dockerComposeBinPath); err != nil {
return fmt.Errorf("%s: %w", dockerComposeBinPath, err)
}
return nil
}

func processArgs(cmdData *composeCmdData, cmd *cobra.Command, args []string) {
doubleDashInd := cmd.ArgsLenAtDash()
doubleDashExist := cmd.ArgsLenAtDash() != -1
Expand Down

0 comments on commit 835290a

Please sign in to comment.