Skip to content

Commit

Permalink
fix: the --ticktock flag should also be used for bootstrap (#4155)
Browse files Browse the repository at this point in the history
This fixes the issue where the bootstrap command was ignoring the
--ticktock option.

Signed-off-by: Alex Couture-Beil <[email protected]>
  • Loading branch information
alexcb authored May 24, 2024
1 parent 025ab89 commit 107e351
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
11 changes: 11 additions & 0 deletions cmd/earthly/base/init_frontend.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package base

import (
"fmt"
"net/url"
"path/filepath"
"time"
Expand All @@ -17,6 +18,16 @@ func (cli *CLI) InitFrontend(cliCtx *cli.Context) error {
cli.Flags().BuildkitdImage = cli.Cfg().Global.BuildkitImage
}

if cli.Flags().UseTickTockBuildkitImage {
if cliCtx.IsSet("buildkit-image") {
return fmt.Errorf("the --buildkit-image and --ticktock flags are mutually exclusive")
}
if cli.Cfg().Global.BuildkitImage != "" {
return fmt.Errorf("the --ticktock flags can not be used in combination with the buildkit_image config option")
}
cli.Flags().BuildkitdImage += "-ticktock"
}

bkURL, err := url.Parse(cli.Flags().BuildkitHost) // Not validated because we already did that when we calculated it.
if err != nil {
return errors.Wrap(err, "failed to parse generated buildkit URL")
Expand Down
10 changes: 1 addition & 9 deletions cmd/earthly/subcmd/build_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,10 @@ func (a *Build) ActionBuildImp(cliCtx *cli.Context, flagArgs, nonFlagArgs []stri
return errors.New("could not determine buildkit address - is Docker or Podman running?")
}

buildkitdImage := a.cli.Flags().BuildkitdImage
if a.cli.Flags().UseTickTockBuildkitImage {
if cliCtx.IsSet("buildkit-image") {
return fmt.Errorf("the --buildkit-image and --ticktock flags are mutually exclusive")
}
buildkitdImage += "-ticktock"
}

bkClient, err := buildkitd.NewClient(
cliCtx.Context,
a.cli.Console(),
buildkitdImage,
a.cli.Flags().BuildkitdImage,
a.cli.Flags().ContainerName,
a.cli.Flags().InstallationName,
a.cli.Flags().ContainerFrontend,
Expand Down

0 comments on commit 107e351

Please sign in to comment.