Skip to content

Commit 99037c2

Browse files
committed
added check to validate field for update
1 parent 9eca23c commit 99037c2

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ack_generate_info:
2-
build_date: "2024-03-05T06:14:37Z"
2+
build_date: "2024-03-06T08:51:16Z"
33
build_hash: c2165b65565ab3a094cfb474c4396f4d14c7ef1e
44
go_version: go1.21.6
55
version: v0.31.0

pkg/resource/model/sdk.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/model/sdk_update_pre_build_request.go.tpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
// checking if any delta is found other than tags
2+
if len(delta.Differences) > 0 {
3+
if delta.DifferentExcept("Spec.Tags") {
4+
for _, parts := range delta.Differences {
5+
if !parts.Path.Contains("Tags") {
6+
return nil, fmt.Errorf("cannot update the following fields: %s , Allowed field to change: Spec.Tags", parts.Path)
7+
}
8+
}
9+
}
10+
}
111
// this to handle delete/remove tags
212
_ , err = rm.deleteTags(ctx,desired,latest)
313
if err != nil {

0 commit comments

Comments
 (0)