Skip to content

Commit

Permalink
buildcontrol: remove liveupdate v1 (#5629)
Browse files Browse the repository at this point in the history
* feature: mark the live_update_v2 flag as obsolete

* buildcontrol: remove liveupdate v1
  • Loading branch information
nicks authored Mar 25, 2022
1 parent 6beda50 commit 2aa60e6
Show file tree
Hide file tree
Showing 19 changed files with 87 additions and 3,211 deletions.
146 changes: 72 additions & 74 deletions internal/cli/wire_gen.go

Large diffs are not rendered by default.

20 changes: 4 additions & 16 deletions internal/engine/build_and_deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/trace"

"github.com/tilt-dev/clusterid"
"github.com/tilt-dev/tilt/internal/container"
"github.com/tilt-dev/tilt/internal/engine/buildcontrol"
"github.com/tilt-dev/tilt/internal/store"
"github.com/tilt-dev/tilt/internal/store/liveupdates"
Expand Down Expand Up @@ -79,24 +77,14 @@ func (composite *CompositeBuildAndDeployer) BuildAndDeploy(ctx context.Context,
return br, err
}

_, isLiveUpdate := builder.(*buildcontrol.LiveUpdateBuildAndDeployer)
l := logger.Get(ctx).WithFields(logger.Fields{logger.FieldNameBuildEvent: "fallback"})

if redirectErr, ok := err.(buildcontrol.RedirectToNextBuilder); ok {
s := fmt.Sprintf("Falling back to next update method…\nREASON: %v\n", err)
if isLiveUpdate && redirectErr.UserFacing() {
s = fmt.Sprintf("Will not perform Live Update because:\n\t%v\n"+
"Falling back to a full image build + deploy\n", err)
}
l.Write(redirectErr.Level, []byte(s))
} else {
lastUnexpectedErr = err
if isLiveUpdate {
// Indent the error message.
errMsg := strings.ReplaceAll(strings.TrimSpace(fmt.Sprintf("%v", err)), "\n", "\n\t")
l.Warnf("Live Update failed with unexpected error:\n\t%s\n"+
"Falling back to a full image build + deploy", errMsg)
} else if i+1 < len(composite.builders) {
if i+1 < len(composite.builders) {
logger.Get(ctx).Infof("got unexpected error during build/deploy: %v", err)
}
}
Expand All @@ -110,11 +98,11 @@ func (composite *CompositeBuildAndDeployer) BuildAndDeploy(ctx context.Context,
return store.BuildResultSet{}, lastErr
}

func DefaultBuildOrder(lubad *buildcontrol.LiveUpdateBuildAndDeployer, ibad *buildcontrol.ImageBuildAndDeployer, dcbad *buildcontrol.DockerComposeBuildAndDeployer,
ltbad *buildcontrol.LocalTargetBuildAndDeployer, updMode liveupdates.UpdateMode, env clusterid.Product, runtime container.Runtime) BuildOrder {
func DefaultBuildOrder(ibad *buildcontrol.ImageBuildAndDeployer, dcbad *buildcontrol.DockerComposeBuildAndDeployer,
ltbad *buildcontrol.LocalTargetBuildAndDeployer, updMode liveupdates.UpdateMode) BuildOrder {
if updMode == liveupdates.UpdateModeImage {
return BuildOrder{dcbad, ibad, ltbad}
}

return BuildOrder{lubad, dcbad, ibad, ltbad}
return BuildOrder{dcbad, ibad, ltbad}
}
Loading

0 comments on commit 2aa60e6

Please sign in to comment.