Skip to content
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

Ignore input changes to username and password #498

Merged
merged 7 commits into from
Feb 15, 2023
25 changes: 23 additions & 2 deletions provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,29 @@ func (p *dockerNativeProvider) Diff(ctx context.Context, req *rpc.DiffRequest) (
for key := range d.Deletes {
diff[string(key)] = &rpc.PropertyDiff{Kind: rpc.PropertyDiff_DELETE}
}
for key := range d.Updates {
diff[string(key)] = &rpc.PropertyDiff{Kind: rpc.PropertyDiff_UPDATE}

for key, valueDiff := range d.Updates {
if string(key) != "registry" {
diff[string(key)] = &rpc.PropertyDiff{
Kind: rpc.PropertyDiff_UPDATE,
}
} else {
// only register a diff on "server" field, but not on "username" or "password",
// as they can change frequently and should not trigger a rebuild.
serverDiff := valueDiff.Object.Updates["server"]
// if serverDiff is not empty, we register a property diff update
if serverDiff != (resource.ValueDiff{}) {
diff[string(key)] = &rpc.PropertyDiff{
Kind: rpc.PropertyDiff_UPDATE,
}
}
}
}
// if diff is empty, it means we skipped any changes to username and password
if len(diff) == 0 {
return &rpc.DiffResponse{
Changes: rpc.DiffResponse_DIFF_NONE,
}, nil
}
return &rpc.DiffResponse{
Changes: rpc.DiffResponse_DIFF_SOME,
Expand Down