New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
engine: roll forward of https://github.com/tilt-dev/tilt/pull/3362, re-using image builds from other resources #3553
Conversation
Does this want REVIEW or is it a revert-revert? |
review!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
internal/engine/upper.go
Outdated
// | ||
// 2) If the current manifest build was kicked off by a trigger, we don't | ||
// want to queue manifests with the same image. | ||
if currentMT.NextBuildReason() == model.BuildReasonNone { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nbd, but this might be more readable as a helper function a la if !currentMT.IsQueued()
or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
understand the instinct here, but this particular check on has that particular meaning in this particular context -- it would not be correct if called from anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair nough!
internal/engine/upper.go
Outdated
|
||
// Update build statuses for duplicated image targets in other manifests. | ||
// This ensures that those images targets aren't redundantly rebuilt. | ||
for _, currentMT := range engineState.Targets() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nbd but consider a helper function here for readability: for... := range engineState.TargetsBesides(mn)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// builds. | ||
// | ||
// 2) If the current manifest build was kicked off by a trigger, we don't | ||
// want to queue manifests with the same image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oooh good catch!
// We need to mark imageB as dirty, because it was not built in the manifestA | ||
// build but its dependency was built. | ||
// | ||
// Note that this logic also applies to deploy targets depending on image |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌 this is super helpful!
// targets. If we built manifestA, which contains imageX and deploy target | ||
// k8sA, and manifestB contains imageX and deploy target k8sB, we need to mark | ||
// target k8sB as dirty so that Tilt actually deploys the changes to imageX. | ||
rDepsMap := currentMT.Manifest.ReverseDependencyIDs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is convoluted enough that i might comment every line:
// target k8sB as dirty so that Tilt actually deploys the changes to imageX. | ||
rDepsMap := currentMT.Manifest.ReverseDependencyIDs() | ||
for updatedID := range updatedIDSet { | ||
for _, rDepID := range rDepsMap[updatedID] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// for each target depending on each target we just updated...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
rDepsMap := currentMT.Manifest.ReverseDependencyIDs() | ||
for updatedID := range updatedIDSet { | ||
for _, rDepID := range rDepsMap[updatedID] { | ||
if updatedIDSet[rDepID] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// if that target itself was just updated, nothing to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
continue | ||
} | ||
|
||
currentMS.MutableBuildStatus(rDepID).PendingDependencyChanges[updatedID] = br.StartTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// otherwise, mark that target as dirty so it gets rebuilt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
internal/engine/upper_test.go
Outdated
state := call.state[m1.ImageTargets[0].ID()] | ||
assert.Equal(t, map[string]bool{aPath: true}, state.FilesChangedSet) | ||
|
||
// Make sure that when the second build is triggeredd, we did the bookkeeping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Make sure that when the second build is triggeredd, we did the bookkeeping | |
// Make sure that when the second build is triggered, we did the bookkeeping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
state := call.state[m1.ImageTargets[0].ID()] | ||
assert.Equal(t, map[string]bool{aPath: true}, state.FilesChangedSet) | ||
|
||
// Make sure that when the second build is trigged, we did the bookkeeping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Make sure that when the second build is trigged, we did the bookkeeping | |
// Make sure that when the second build is triggered, we did the bookkeeping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Hello @maiamcc, @landism,
Please review the following commits I made in branch nicks/ch6738:
24351f9 (2020-07-06 11:43:41 -0400)
engine: roll forward of #3362, re-using image builds from other resources
Code review reminders, by giving a LGTM you attest that: