-
Notifications
You must be signed in to change notification settings - Fork 290
/
live_update_state_tree.go
37 lines (31 loc) · 1.08 KB
/
live_update_state_tree.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package engine
import (
"github.com/windmilleng/tilt/internal/model"
"github.com/windmilleng/tilt/internal/store"
)
// A helper data structure that represents a live-update image and
// the files changed in all of its dependencies.
type liveUpdateStateTree struct {
iTarget model.ImageTarget
filesChanged []string
iTargetState store.BuildState
hasFileChangesIDs []model.TargetID
}
// Create a successful build result if the live update deploys successfully.
func (t liveUpdateStateTree) createResultSet() store.BuildResultSet {
iTargetID := t.iTarget.ID()
state := t.iTargetState
res := state.LastResult.ShallowCloneForContainerUpdate(state.FilesChangedSet)
res.ContainerID = state.DeployInfo.ContainerID
resultSet := store.BuildResultSet{}
resultSet[iTargetID] = res
// Invalidate all the image builds for images we depend on.
// Otherwise, the image builder will think the existing image ID
// is valid and won't try to rebuild it.
for _, id := range t.hasFileChangesIDs {
if id != iTargetID {
resultSet[id] = store.BuildResult{}
}
}
return resultSet
}