diff --git a/pkg/app/app_sync_test.go b/pkg/app/app_sync_test.go index 9c12f50e..da3d33dd 100644 --- a/pkg/app/app_sync_test.go +++ b/pkg/app/app_sync_test.go @@ -262,9 +262,170 @@ processing releases in group 1/2: default/default/external-secrets processing releases in group 2/2: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s + +changing working directory back to "/path/to" +`, + }) + }) + + t.Run("check-duration", func(t *testing.T) { + check(t, testcase{ + fields: fields{ + skipNeeds: true, + }, + files: map[string]string{ + "/path/to/helmfile.yaml": ` +{{ $mark := "a" }} + +releases: +- name: kubernetes-external-secrets + chart: incubator/raw + namespace: kube-system + +- name: external-secrets + chart: incubator/raw + namespace: default + labels: + app: test + needs: + - kube-system/kubernetes-external-secrets + +- name: my-release + chart: incubator/raw + namespace: default + labels: + app: test + needs: + - default/external-secrets + hooks: + - name: my-release + events: + - postsync + showlogs: true + command: sleep + args: [5s] +`, + }, + selectors: []string{"app=test"}, + upgraded: []exectest.Release{ + {Name: "external-secrets", Flags: []string{"--kube-context", "default", "--namespace", "default"}}, + {Name: "my-release", Flags: []string{"--kube-context", "default", "--namespace", "default"}}, + }, + lists: map[exectest.ListKey]string{ + {Filter: "^external-secrets$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE +external-secrets 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default + `, + {Filter: "^my-release$", Flags: listFlags("default", "default")}: `NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE +my-release 4 Fri Nov 1 08:40:07 2019 DEPLOYED raw-3.1.0 3.1.0 default + `, + }, + // as we check for log output, set concurrency to 1 to avoid non-deterministic test result + concurrency: 1, + log: `processing file "helmfile.yaml" in directory "." +changing working directory to "/path/to" +first-pass rendering starting for "helmfile.yaml.part.0": inherited=&{default map[] map[]}, overrode= +first-pass uses: &{default map[] map[]} +first-pass rendering output of "helmfile.yaml.part.0": + 0: + 1: + 2: + 3: releases: + 4: - name: kubernetes-external-secrets + 5: chart: incubator/raw + 6: namespace: kube-system + 7: + 8: - name: external-secrets + 9: chart: incubator/raw +10: namespace: default +11: labels: +12: app: test +13: needs: +14: - kube-system/kubernetes-external-secrets +15: +16: - name: my-release +17: chart: incubator/raw +18: namespace: default +19: labels: +20: app: test +21: needs: +22: - default/external-secrets +23: hooks: +24: - name: my-release +25: events: +26: - postsync +27: showlogs: true +28: command: sleep +29: args: [5s] +30: + +first-pass produced: &{default map[] map[]} +first-pass rendering result of "helmfile.yaml.part.0": {default map[] map[]} +vals: +map[] +defaultVals:[] +second-pass rendering result of "helmfile.yaml.part.0": + 0: + 1: + 2: + 3: releases: + 4: - name: kubernetes-external-secrets + 5: chart: incubator/raw + 6: namespace: kube-system + 7: + 8: - name: external-secrets + 9: chart: incubator/raw +10: namespace: default +11: labels: +12: app: test +13: needs: +14: - kube-system/kubernetes-external-secrets +15: +16: - name: my-release +17: chart: incubator/raw +18: namespace: default +19: labels: +20: app: test +21: needs: +22: - default/external-secrets +23: hooks: +24: - name: my-release +25: events: +26: - postsync +27: showlogs: true +28: command: sleep +29: args: [5s] +30: + +merged environment: &{default map[] map[]} +2 release(s) matching app=test found in helmfile.yaml + +Affected releases are: + external-secrets (incubator/raw) UPDATED + my-release (incubator/raw) UPDATED + +processing 2 groups of releases in this order: +GROUP RELEASES +1 default/default/external-secrets +2 default/default/my-release + +processing releases in group 1/2: default/default/external-secrets +processing releases in group 2/2: default/default/my-release +hook[my-release]: stateFilePath=helmfile.yaml, basePath=. + +hook[my-release]: triggered by event "postsync" + +hook[my-release]: + + +hook[postsync] logs | + +UPDATED RELEASES: +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 5s changing working directory back to "/path/to" `, @@ -399,10 +560,10 @@ processing releases in group 2/3: default/default/external-secrets processing releases in group 3/3: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -kubernetes-external-secrets incubator/raw 3.1.0 -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +kubernetes-external-secrets incubator/raw 3.1.0 0s +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" `, @@ -525,10 +686,10 @@ processing releases in group 2/3: default//serviceB processing releases in group 3/3: default//serviceA UPDATED RELEASES: -NAME CHART VERSION -serviceC my/chart 3.1.0 -serviceB my/chart 3.1.0 -serviceA my/chart 3.1.0 +NAME CHART VERSION DURATION +serviceC my/chart 3.1.0 0s +serviceB my/chart 3.1.0 0s +serviceA my/chart 3.1.0 0s changing working directory back to "/path/to" `, @@ -670,14 +831,15 @@ processing releases in group 1/2: default/default/external-secrets processing releases in group 2/2: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s DELETED RELEASES: -NAME -kubernetes-external-secrets +NAME DURATION +kubernetes-external-secrets 0s + changing working directory back to "/path/to" `, }) @@ -811,9 +973,9 @@ processing releases in group 1/2: default/default/external-secrets processing releases in group 2/2: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" `, diff --git a/pkg/app/destroy_nokubectx_test.go b/pkg/app/destroy_nokubectx_test.go index f70e9aee..dcc0f3a4 100644 --- a/pkg/app/destroy_nokubectx_test.go +++ b/pkg/app/destroy_nokubectx_test.go @@ -403,17 +403,18 @@ release "front-proxy" processed release "logging" processed DELETED RELEASES: -NAME -frontend-v3 -frontend-v2 -frontend-v1 -backend-v2 -backend-v1 -anotherbackend -servicemesh -database -front-proxy -logging +NAME DURATION +frontend-v3 0s +frontend-v2 0s +frontend-v1 0s +backend-v2 0s +backend-v1 0s +anotherbackend 0s +servicemesh 0s +database 0s +front-proxy 0s +logging 0s + changing working directory back to "/path/to" `, }) @@ -594,8 +595,9 @@ processing releases in group 1/1: logging release "logging" processed DELETED RELEASES: -NAME -logging +NAME DURATION +logging 0s + changing working directory back to "/path/to" `, }) @@ -664,9 +666,10 @@ processing releases in group 2/2: backend-v1 release "backend-v1" processed DELETED RELEASES: -NAME -frontend-v1 -backend-v1 +NAME DURATION +frontend-v1 0s +backend-v1 0s + changing working directory back to "/path/to" `, }) @@ -735,9 +738,10 @@ processing releases in group 2/2: backend-v1 release "backend-v1" processed DELETED RELEASES: -NAME -frontend-v1 -backend-v1 +NAME DURATION +frontend-v1 0s +backend-v1 0s + changing working directory back to "/path/to" `, }) diff --git a/pkg/app/destroy_test.go b/pkg/app/destroy_test.go index 44876578..8852ea09 100644 --- a/pkg/app/destroy_test.go +++ b/pkg/app/destroy_test.go @@ -459,17 +459,18 @@ release "front-proxy" processed release "logging" processed DELETED RELEASES: -NAME -frontend-v3 -frontend-v2 -frontend-v1 -backend-v2 -backend-v1 -anotherbackend -servicemesh -database -front-proxy -logging +NAME DURATION +frontend-v3 0s +frontend-v2 0s +frontend-v1 0s +backend-v2 0s +backend-v1 0s +anotherbackend 0s +servicemesh 0s +database 0s +front-proxy 0s +logging 0s + changing working directory back to "/path/to" `, }) @@ -650,8 +651,9 @@ processing releases in group 1/1: default//logging release "logging" processed DELETED RELEASES: -NAME -logging +NAME DURATION +logging 0s + changing working directory back to "/path/to" `, }) @@ -720,9 +722,10 @@ processing releases in group 2/2: default//backend-v1 release "backend-v1" processed DELETED RELEASES: -NAME -frontend-v1 -backend-v1 +NAME DURATION +frontend-v1 0s +backend-v1 0s + changing working directory back to "/path/to" `, }) @@ -791,9 +794,10 @@ processing releases in group 2/2: default//backend-v1 release "backend-v1" processed DELETED RELEASES: -NAME -frontend-v1 -backend-v1 +NAME DURATION +frontend-v1 0s +backend-v1 0s + changing working directory back to "/path/to" `, }) diff --git a/pkg/app/testdata/testapply/delete_bar_when_bar_needs_foo/log b/pkg/app/testdata/testapply/delete_bar_when_bar_needs_foo/log index b5920210..340b0ede 100644 --- a/pkg/app/testdata/testapply/delete_bar_when_bar_needs_foo/log +++ b/pkg/app/testdata/testapply/delete_bar_when_bar_needs_foo/log @@ -57,11 +57,12 @@ GROUP RELEASES processing releases in group 1/1: default//foo UPDATED RELEASES: -NAME CHART VERSION -foo stable/mychart1 3.1.0 +NAME CHART VERSION DURATION +foo stable/mychart1 3.1.0 0s DELETED RELEASES: -NAME -bar +NAME DURATION +bar 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/delete_bar_when_foo_needs_bar/log b/pkg/app/testdata/testapply/delete_bar_when_foo_needs_bar/log index 58646152..51d029f0 100644 --- a/pkg/app/testdata/testapply/delete_bar_when_foo_needs_bar/log +++ b/pkg/app/testdata/testapply/delete_bar_when_foo_needs_bar/log @@ -57,11 +57,12 @@ GROUP RELEASES processing releases in group 1/1: default//foo UPDATED RELEASES: -NAME CHART VERSION -foo stable/mychart1 3.1.0 +NAME CHART VERSION DURATION +foo stable/mychart1 3.1.0 0s DELETED RELEASES: -NAME -bar +NAME DURATION +bar 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/delete_foo_and_bar_when_bar_needs_foo/log b/pkg/app/testdata/testapply/delete_foo_and_bar_when_bar_needs_foo/log index a5c9aefc..c0766def 100644 --- a/pkg/app/testdata/testapply/delete_foo_and_bar_when_bar_needs_foo/log +++ b/pkg/app/testdata/testapply/delete_foo_and_bar_when_bar_needs_foo/log @@ -56,7 +56,8 @@ processing releases in group 1/2: default//bar processing releases in group 2/2: default//foo DELETED RELEASES: -NAME -bar -foo +NAME DURATION +bar 0s +foo 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/delete_foo_and_bar_when_foo_needs_bar/log b/pkg/app/testdata/testapply/delete_foo_and_bar_when_foo_needs_bar/log index 79fd557b..ab780484 100644 --- a/pkg/app/testdata/testapply/delete_foo_and_bar_when_foo_needs_bar/log +++ b/pkg/app/testdata/testapply/delete_foo_and_bar_when_foo_needs_bar/log @@ -56,7 +56,8 @@ processing releases in group 1/2: default//foo processing releases in group 2/2: default//bar DELETED RELEASES: -NAME -foo -bar +NAME DURATION +foo 0s +bar 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/delete_foo_when_bar_needs_foo/log b/pkg/app/testdata/testapply/delete_foo_when_bar_needs_foo/log index 44cf1b57..8e11a14b 100644 --- a/pkg/app/testdata/testapply/delete_foo_when_bar_needs_foo/log +++ b/pkg/app/testdata/testapply/delete_foo_when_bar_needs_foo/log @@ -57,11 +57,12 @@ GROUP RELEASES processing releases in group 1/1: default//bar UPDATED RELEASES: -NAME CHART VERSION -bar stable/mychart2 3.1.0 +NAME CHART VERSION DURATION +bar stable/mychart2 3.1.0 0s DELETED RELEASES: -NAME -foo +NAME DURATION +foo 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/delete_foo_when_foo_needs_bar/log b/pkg/app/testdata/testapply/delete_foo_when_foo_needs_bar/log index a03c04c3..45ed231a 100644 --- a/pkg/app/testdata/testapply/delete_foo_when_foo_needs_bar/log +++ b/pkg/app/testdata/testapply/delete_foo_when_foo_needs_bar/log @@ -57,11 +57,12 @@ GROUP RELEASES processing releases in group 1/1: default//bar UPDATED RELEASES: -NAME CHART VERSION -bar stable/mychart2 3.1.0 +NAME CHART VERSION DURATION +bar stable/mychart2 3.1.0 0s DELETED RELEASES: -NAME -foo +NAME DURATION +foo 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/install-with-upgrade-with-skip-diff-on-install/log b/pkg/app/testdata/testapply/install-with-upgrade-with-skip-diff-on-install/log index 63c2b747..91a0af71 100644 --- a/pkg/app/testdata/testapply/install-with-upgrade-with-skip-diff-on-install/log +++ b/pkg/app/testdata/testapply/install-with-upgrade-with-skip-diff-on-install/log @@ -64,9 +64,9 @@ processing releases in group 2/2: default//foo getting deployed release version failed: Failed to get the version for: mychart1 UPDATED RELEASES: -NAME CHART VERSION -baz stable/mychart3 3.1.0 -bar stable/mychart2 3.1.0 -foo stable/mychart1 +NAME CHART VERSION DURATION +baz stable/mychart3 3.1.0 0s +bar stable/mychart2 3.1.0 0s +foo stable/mychart1 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/install-with-upgrade-with-validation-control/log b/pkg/app/testdata/testapply/install-with-upgrade-with-validation-control/log index 63c2b747..91a0af71 100644 --- a/pkg/app/testdata/testapply/install-with-upgrade-with-validation-control/log +++ b/pkg/app/testdata/testapply/install-with-upgrade-with-validation-control/log @@ -64,9 +64,9 @@ processing releases in group 2/2: default//foo getting deployed release version failed: Failed to get the version for: mychart1 UPDATED RELEASES: -NAME CHART VERSION -baz stable/mychart3 3.1.0 -bar stable/mychart2 3.1.0 -foo stable/mychart1 +NAME CHART VERSION DURATION +baz stable/mychart3 3.1.0 0s +bar stable/mychart2 3.1.0 0s +foo stable/mychart1 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/install/log b/pkg/app/testdata/testapply/install/log index 19086fc2..a36fac40 100644 --- a/pkg/app/testdata/testapply/install/log +++ b/pkg/app/testdata/testapply/install/log @@ -60,9 +60,9 @@ processing releases in group 2/2: default//foo getting deployed release version failed: unexpected list key: listkey(filter=^foo$,flags=--kube-contextdefault--uninstalling--deployed--failed--pending) not found in UPDATED RELEASES: -NAME CHART VERSION -baz stable/mychart3 -bar stable/mychart2 -foo stable/mychart1 +NAME CHART VERSION DURATION +baz stable/mychart3 0s +bar stable/mychart2 0s +foo stable/mychart1 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/smoke/log b/pkg/app/testdata/testapply/smoke/log index 4f491886..0d45f6f8 100644 --- a/pkg/app/testdata/testapply/smoke/log +++ b/pkg/app/testdata/testapply/smoke/log @@ -170,18 +170,19 @@ processing releases in group 4/5: default//backend-v2 processing releases in group 5/5: default//frontend-v3 UPDATED RELEASES: -NAME CHART VERSION -logging charts/fluent-bit 3.1.0 -front-proxy stable/envoy 3.1.0 -database charts/mysql 3.1.0 -servicemesh charts/istio 3.1.0 -anotherbackend charts/anotherbackend 3.1.0 -backend-v2 charts/backend 3.1.0 -frontend-v3 charts/frontend 3.1.0 +NAME CHART VERSION DURATION +logging charts/fluent-bit 3.1.0 0s +front-proxy stable/envoy 3.1.0 0s +database charts/mysql 3.1.0 0s +servicemesh charts/istio 3.1.0 0s +anotherbackend charts/anotherbackend 3.1.0 0s +backend-v2 charts/backend 3.1.0 0s +frontend-v3 charts/frontend 3.1.0 0s DELETED RELEASES: -NAME -frontend-v1 -backend-v1 +NAME DURATION +frontend-v1 0s +backend-v1 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/upgrade_when_bar_needs_foo,_with_ns_override/log b/pkg/app/testdata/testapply/upgrade_when_bar_needs_foo,_with_ns_override/log index 4c800ebf..fb67758f 100644 --- a/pkg/app/testdata/testapply/upgrade_when_bar_needs_foo,_with_ns_override/log +++ b/pkg/app/testdata/testapply/upgrade_when_bar_needs_foo,_with_ns_override/log @@ -54,8 +54,8 @@ processing releases in group 2/2: default/testNamespace/bar getting deployed release version failed: Failed to get the version for: mychart2 UPDATED RELEASES: -NAME CHART VERSION -foo stable/mychart1 -bar stable/mychart2 +NAME CHART VERSION DURATION +foo stable/mychart1 0s +bar stable/mychart2 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/upgrade_when_bar_needs_foo/log b/pkg/app/testdata/testapply/upgrade_when_bar_needs_foo/log index b3a32c95..29d0d32a 100644 --- a/pkg/app/testdata/testapply/upgrade_when_bar_needs_foo/log +++ b/pkg/app/testdata/testapply/upgrade_when_bar_needs_foo/log @@ -54,8 +54,8 @@ processing releases in group 2/2: default//bar getting deployed release version failed: Failed to get the version for: mychart2 UPDATED RELEASES: -NAME CHART VERSION -foo stable/mychart1 -bar stable/mychart2 +NAME CHART VERSION DURATION +foo stable/mychart1 0s +bar stable/mychart2 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/upgrade_when_foo_needs_bar,_with_ns_override/log b/pkg/app/testdata/testapply/upgrade_when_foo_needs_bar,_with_ns_override/log index ef4a3f62..e1568ee8 100644 --- a/pkg/app/testdata/testapply/upgrade_when_foo_needs_bar,_with_ns_override/log +++ b/pkg/app/testdata/testapply/upgrade_when_foo_needs_bar,_with_ns_override/log @@ -54,8 +54,8 @@ processing releases in group 2/2: default/testNamespace/foo getting deployed release version failed: Failed to get the version for: mychart1 UPDATED RELEASES: -NAME CHART VERSION -bar stable/mychart2 -foo stable/mychart1 +NAME CHART VERSION DURATION +bar stable/mychart2 0s +foo stable/mychart1 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/upgrade_when_foo_needs_bar/log b/pkg/app/testdata/testapply/upgrade_when_foo_needs_bar/log index a8a99ba8..6b968968 100644 --- a/pkg/app/testdata/testapply/upgrade_when_foo_needs_bar/log +++ b/pkg/app/testdata/testapply/upgrade_when_foo_needs_bar/log @@ -54,8 +54,8 @@ processing releases in group 2/2: default//foo getting deployed release version failed: Failed to get the version for: mychart1 UPDATED RELEASES: -NAME CHART VERSION -bar stable/mychart2 -foo stable/mychart1 +NAME CHART VERSION DURATION +bar stable/mychart2 0s +foo stable/mychart1 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/upgrade_when_ns1/foo_needs_ns2/bar/log b/pkg/app/testdata/testapply/upgrade_when_ns1/foo_needs_ns2/bar/log index 7e99abab..151f968d 100644 --- a/pkg/app/testdata/testapply/upgrade_when_ns1/foo_needs_ns2/bar/log +++ b/pkg/app/testdata/testapply/upgrade_when_ns1/foo_needs_ns2/bar/log @@ -58,8 +58,8 @@ processing releases in group 2/2: default/ns1/foo getting deployed release version failed: Failed to get the version for: mychart1 UPDATED RELEASES: -NAME CHART VERSION -bar stable/mychart2 -foo stable/mychart1 +NAME CHART VERSION DURATION +bar stable/mychart2 0s +foo stable/mychart1 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/upgrade_when_ns2/bar_needs_ns1/foo/log b/pkg/app/testdata/testapply/upgrade_when_ns2/bar_needs_ns1/foo/log index 059c3d06..a9703746 100644 --- a/pkg/app/testdata/testapply/upgrade_when_ns2/bar_needs_ns1/foo/log +++ b/pkg/app/testdata/testapply/upgrade_when_ns2/bar_needs_ns1/foo/log @@ -58,8 +58,8 @@ processing releases in group 2/2: default/ns2/bar getting deployed release version failed: Failed to get the version for: mychart2 UPDATED RELEASES: -NAME CHART VERSION -foo stable/mychart1 -bar stable/mychart2 +NAME CHART VERSION DURATION +foo stable/mychart1 0s +bar stable/mychart2 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply/upgrades_with_good_selector_with_--skip-needs=true/log b/pkg/app/testdata/testapply/upgrades_with_good_selector_with_--skip-needs=true/log index 3ca93c80..f5900fe6 100644 --- a/pkg/app/testdata/testapply/upgrades_with_good_selector_with_--skip-needs=true/log +++ b/pkg/app/testdata/testapply/upgrades_with_good_selector_with_--skip-needs=true/log @@ -82,8 +82,8 @@ processing releases in group 1/2: default/default/external-secrets processing releases in group 2/2: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/apply_release_with_preapply_hook/log b/pkg/app/testdata/testapply_2/apply_release_with_preapply_hook/log index ed00fa43..2c01e082 100644 --- a/pkg/app/testdata/testapply_2/apply_release_with_preapply_hook/log +++ b/pkg/app/testdata/testapply_2/apply_release_with_preapply_hook/log @@ -63,6 +63,6 @@ processing releases in group 1/1: default/default/foo getting deployed release version failed: unexpected list key: {^foo$ --kube-contextdefault--deleting--deployed--failed--pending} UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw +NAME CHART VERSION DURATION +foo incubator/raw 0s diff --git a/pkg/app/testdata/testapply_2/deduplicate_by_--selector/log b/pkg/app/testdata/testapply_2/deduplicate_by_--selector/log index 1caa2793..589e29c8 100644 --- a/pkg/app/testdata/testapply_2/deduplicate_by_--selector/log +++ b/pkg/app/testdata/testapply_2/deduplicate_by_--selector/log @@ -65,7 +65,7 @@ GROUP RELEASES processing releases in group 1/1: default/default/foo UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw 3.1.0 +NAME CHART VERSION DURATION +foo incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/include-transitive-needs=true/log b/pkg/app/testdata/testapply_2/include-transitive-needs=true/log index 7e7bb8c2..8f98ae77 100644 --- a/pkg/app/testdata/testapply_2/include-transitive-needs=true/log +++ b/pkg/app/testdata/testapply_2/include-transitive-needs=true/log @@ -79,9 +79,9 @@ processing releases in group 2/3: default//serviceB processing releases in group 3/3: default//serviceA UPDATED RELEASES: -NAME CHART VERSION -serviceC my/chart 3.1.0 -serviceB my/chart 3.1.0 -serviceA my/chart 3.1.0 +NAME CHART VERSION DURATION +serviceC my/chart 3.1.0 0s +serviceB my/chart 3.1.0 0s +serviceA my/chart 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/select_single_release_from_helmfile_with_two_duplicates/log b/pkg/app/testdata/testapply_2/select_single_release_from_helmfile_with_two_duplicates/log index 31ee4bbc..72ff1e88 100644 --- a/pkg/app/testdata/testapply_2/select_single_release_from_helmfile_with_two_duplicates/log +++ b/pkg/app/testdata/testapply_2/select_single_release_from_helmfile_with_two_duplicates/log @@ -69,7 +69,7 @@ GROUP RELEASES processing releases in group 1/1: default/default/foo UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw 3.1.0 +NAME CHART VERSION DURATION +foo incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true/log b/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true/log index acb843a9..cfb24348 100644 --- a/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true/log +++ b/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true/log @@ -87,9 +87,9 @@ processing releases in group 2/3: default/default/external-secrets processing releases in group 3/3: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -kubernetes-external-secrets incubator/raw 3.1.0 -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +kubernetes-external-secrets incubator/raw 3.1.0 0s +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_but_no_diff_on_needed_release/log b/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_but_no_diff_on_needed_release/log index 9944d926..1bdbee74 100644 --- a/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_but_no_diff_on_needed_release/log +++ b/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_but_no_diff_on_needed_release/log @@ -84,8 +84,8 @@ processing releases in group 1/2: default/default/external-secrets processing releases in group 2/2: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_with_installed_but_disabled_release/log b/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_with_installed_but_disabled_release/log index 4a940be8..d7ff1aad 100644 --- a/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_with_installed_but_disabled_release/log +++ b/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_with_installed_but_disabled_release/log @@ -92,12 +92,13 @@ processing releases in group 1/2: default/default/external-secrets processing releases in group 2/2: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s DELETED RELEASES: -NAME -kubernetes-external-secrets +NAME DURATION +kubernetes-external-secrets 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_with_not_installed_and_disabled_release/log b/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_with_not_installed_and_disabled_release/log index 809c27b7..3ebb95ed 100644 --- a/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_with_not_installed_and_disabled_release/log +++ b/pkg/app/testdata/testapply_2/skip-needs=false_include-needs=true_with_not_installed_and_disabled_release/log @@ -86,8 +86,8 @@ processing releases in group 1/2: default/default/external-secrets processing releases in group 2/2: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/skip-needs=true/log b/pkg/app/testdata/testapply_2/skip-needs=true/log index 3ca93c80..f5900fe6 100644 --- a/pkg/app/testdata/testapply_2/skip-needs=true/log +++ b/pkg/app/testdata/testapply_2/skip-needs=true/log @@ -82,8 +82,8 @@ processing releases in group 1/2: default/default/external-secrets processing releases in group 2/2: default/default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_2/skip-needs=true_with_no_diff_on_a_release/log b/pkg/app/testdata/testapply_2/skip-needs=true_with_no_diff_on_a_release/log index 5aef569a..68164cd1 100644 --- a/pkg/app/testdata/testapply_2/skip-needs=true_with_no_diff_on_a_release/log +++ b/pkg/app/testdata/testapply_2/skip-needs=true_with_no_diff_on_a_release/log @@ -79,7 +79,7 @@ GROUP RELEASES processing releases in group 1/1: default/default/external-secrets UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true/log b/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true/log index 2c4ec014..68bf7a67 100644 --- a/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true/log +++ b/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true/log @@ -87,9 +87,9 @@ processing releases in group 2/3: default/external-secrets processing releases in group 3/3: default/my-release UPDATED RELEASES: -NAME CHART VERSION -kubernetes-external-secrets incubator/raw 3.1.0 -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +kubernetes-external-secrets incubator/raw 3.1.0 0s +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_but_no_diff_on_needed_release/log b/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_but_no_diff_on_needed_release/log index 12f96fcf..d5b42715 100644 --- a/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_but_no_diff_on_needed_release/log +++ b/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_but_no_diff_on_needed_release/log @@ -84,8 +84,8 @@ processing releases in group 1/2: default/external-secrets processing releases in group 2/2: default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_with_installed_but_disabled_release/log b/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_with_installed_but_disabled_release/log index 98cfd27e..44e575cc 100644 --- a/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_with_installed_but_disabled_release/log +++ b/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_with_installed_but_disabled_release/log @@ -92,12 +92,13 @@ processing releases in group 1/2: default/external-secrets processing releases in group 2/2: default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s DELETED RELEASES: -NAME -kubernetes-external-secrets +NAME DURATION +kubernetes-external-secrets 0s + changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_with_not_installed_and_disabled_release/log b/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_with_not_installed_and_disabled_release/log index 8c7a0433..2d018e7d 100644 --- a/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_with_not_installed_and_disabled_release/log +++ b/pkg/app/testdata/testapply_3/skip-needs=false_include-needs=true_with_not_installed_and_disabled_release/log @@ -86,8 +86,8 @@ processing releases in group 1/2: default/external-secrets processing releases in group 2/2: default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_3/skip-needs=true/log b/pkg/app/testdata/testapply_3/skip-needs=true/log index b1bb1187..e41893c3 100644 --- a/pkg/app/testdata/testapply_3/skip-needs=true/log +++ b/pkg/app/testdata/testapply_3/skip-needs=true/log @@ -82,8 +82,8 @@ processing releases in group 1/2: default/external-secrets processing releases in group 2/2: default/my-release UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 -my-release incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s +my-release incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_3/skip-needs=true_with_no_diff_on_a_release/log b/pkg/app/testdata/testapply_3/skip-needs=true_with_no_diff_on_a_release/log index 97dc3aff..331c8728 100644 --- a/pkg/app/testdata/testapply_3/skip-needs=true_with_no_diff_on_a_release/log +++ b/pkg/app/testdata/testapply_3/skip-needs=true_with_no_diff_on_a_release/log @@ -79,7 +79,7 @@ GROUP RELEASES processing releases in group 1/1: default/external-secrets UPDATED RELEASES: -NAME CHART VERSION -external-secrets incubator/raw 3.1.0 +NAME CHART VERSION DURATION +external-secrets incubator/raw 3.1.0 0s changing working directory back to "/path/to" diff --git a/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook#01/log b/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook#01/log index 0c6b5308..fcb78684 100644 --- a/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook#01/log +++ b/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook#01/log @@ -9,6 +9,6 @@ hook[presync] logs | foo hook[presync] logs | UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw +NAME CHART VERSION DURATION +foo incubator/raw 0s diff --git a/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook#02/log b/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook#02/log index 8f9089e2..0910c2c2 100644 --- a/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook#02/log +++ b/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook#02/log @@ -3,6 +3,6 @@ hook[presync] logs | foo hook[presync] logs | UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw +NAME CHART VERSION DURATION +foo incubator/raw 0s diff --git a/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook/log b/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook/log index e6233234..63f9f602 100644 --- a/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook/log +++ b/pkg/app/testdata/testapply_hooks/apply_release_with_preapply_hook/log @@ -3,6 +3,6 @@ hook[preapply] logs | foo hook[preapply] logs | UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw +NAME CHART VERSION DURATION +foo incubator/raw 0s diff --git a/pkg/app/testdata/testapply_hooks/hooks_are_not_run_on_alreadyd_uninstalled_release/log b/pkg/app/testdata/testapply_hooks/hooks_are_not_run_on_alreadyd_uninstalled_release/log index 75c88b6b..0a8b01ae 100644 --- a/pkg/app/testdata/testapply_hooks/hooks_are_not_run_on_alreadyd_uninstalled_release/log +++ b/pkg/app/testdata/testapply_hooks/hooks_are_not_run_on_alreadyd_uninstalled_release/log @@ -12,6 +12,6 @@ hook[presync] logs | foo hook[presync] logs | UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw 3.1.0 +NAME CHART VERSION DURATION +foo incubator/raw 3.1.0 0s diff --git a/pkg/app/testdata/testapply_hooks/hooks_are_not_run_on_disabled_release/log b/pkg/app/testdata/testapply_hooks/hooks_are_not_run_on_disabled_release/log index 0c6b5308..fcb78684 100644 --- a/pkg/app/testdata/testapply_hooks/hooks_are_not_run_on_disabled_release/log +++ b/pkg/app/testdata/testapply_hooks/hooks_are_not_run_on_disabled_release/log @@ -9,6 +9,6 @@ hook[presync] logs | foo hook[presync] logs | UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw +NAME CHART VERSION DURATION +foo incubator/raw 0s diff --git a/pkg/app/testdata/testapply_hooks/hooks_are_run_on_enabled_release/log b/pkg/app/testdata/testapply_hooks/hooks_are_run_on_enabled_release/log index 6da2c966..06f6a1da 100644 --- a/pkg/app/testdata/testapply_hooks/hooks_are_run_on_enabled_release/log +++ b/pkg/app/testdata/testapply_hooks/hooks_are_run_on_enabled_release/log @@ -18,7 +18,7 @@ hook[presync] logs | bar hook[presync] logs | UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw -bar incubator/raw +NAME CHART VERSION DURATION +foo incubator/raw 0s +bar incubator/raw 0s diff --git a/pkg/app/testdata/testapply_hooks/hooks_are_run_on_to-be-uninstalled_release/log b/pkg/app/testdata/testapply_hooks/hooks_are_run_on_to-be-uninstalled_release/log index 0f285254..be54e3f5 100644 --- a/pkg/app/testdata/testapply_hooks/hooks_are_run_on_to-be-uninstalled_release/log +++ b/pkg/app/testdata/testapply_hooks/hooks_are_run_on_to-be-uninstalled_release/log @@ -15,10 +15,11 @@ hook[presync] logs | foo hook[presync] logs | UPDATED RELEASES: -NAME CHART VERSION -foo incubator/raw 3.1.0 +NAME CHART VERSION DURATION +foo incubator/raw 3.1.0 0s DELETED RELEASES: -NAME -bar +NAME DURATION +bar 0s + diff --git a/pkg/state/state.go b/pkg/state/state.go index 19d4d650..20d37f99 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -16,6 +16,7 @@ import ( "strings" "sync" "text/template" + "time" "github.com/helmfile/chartify" "github.com/helmfile/vals" @@ -289,6 +290,7 @@ type ReleaseSpec struct { Values []interface{} `yaml:"values,omitempty"` Secrets []interface{} `yaml:"secrets,omitempty"` SetValues []SetValue `yaml:"set,omitempty"` + duration time.Duration ValuesTemplate []interface{} `yaml:"valuesTemplate,omitempty"` SetValuesTemplate []SetValue `yaml:"setTemplate,omitempty"` @@ -797,6 +799,7 @@ func (st *HelmState) DeleteReleasesForSync(affectedReleases *AffectedReleases, h } deletionFlags := st.appendConnectionFlags(args, release) m.Lock() + start := time.Now() if _, err := st.triggerReleaseEvent("preuninstall", nil, release, "sync"); err != nil { affectedReleases.Failed = append(affectedReleases.Failed, release) relErr = newReleaseFailedError(release, err) @@ -809,6 +812,7 @@ func (st *HelmState) DeleteReleasesForSync(affectedReleases *AffectedReleases, h } else { affectedReleases.Deleted = append(affectedReleases.Deleted, release) } + release.duration = time.Since(start) m.Unlock() } @@ -892,6 +896,7 @@ func (st *HelmState) SyncReleases(affectedReleases *AffectedReleases, helm helme var relErr *ReleaseError context := st.createHelmContext(release, workerIndex) + start := time.Now() if _, err := st.triggerPresyncEvent(release, "sync"); err != nil { relErr = newReleaseFailedError(release, err) } else if !release.Desired() { @@ -948,6 +953,7 @@ func (st *HelmState) SyncReleases(affectedReleases *AffectedReleases, helm helme st.logger.Warnf("warn: %v\n", err) } } + release.duration = time.Since(start) if relErr == nil { results <- syncResult{} @@ -2026,6 +2032,7 @@ func (st *HelmState) DeleteReleases(affectedReleases *AffectedReleases, helm hel } context := st.createHelmContext(&release, workerIndex) + start := time.Now() if _, err := st.triggerReleaseEvent("preuninstall", nil, &release, "delete"); err != nil { affectedReleases.Failed = append(affectedReleases.Failed, &release) @@ -2041,6 +2048,7 @@ func (st *HelmState) DeleteReleases(affectedReleases *AffectedReleases, helm hel affectedReleases.Failed = append(affectedReleases.Failed, &release) return err } + release.duration = time.Since(start) affectedReleases.Deleted = append(affectedReleases.Deleted, &release) return nil @@ -3066,11 +3074,12 @@ func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) { logger.Info("\nUPDATED RELEASES:") tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"}, prettytable.Column{Header: "CHART", MinWidth: 6}, - prettytable.Column{Header: "VERSION", AlignRight: true}, + prettytable.Column{Header: "VERSION", MinWidth: 6}, + prettytable.Column{Header: "DURATION", AlignRight: true}, ) tbl.Separator = " " for _, release := range ar.Upgraded { - err := tbl.AddRow(release.Name, release.Chart, release.installedVersion) + err := tbl.AddRow(release.Name, release.Chart, release.installedVersion, release.duration.Round(time.Second)) if err != nil { logger.Warn("Could not add row, %v", err) } @@ -3079,17 +3088,32 @@ func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger) { } if ar.Deleted != nil && len(ar.Deleted) > 0 { logger.Info("\nDELETED RELEASES:") - logger.Info("NAME") + tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"}, + prettytable.Column{Header: "DURATION", AlignRight: true}, + ) + tbl.Separator = " " for _, release := range ar.Deleted { - logger.Info(release.Name) + err := tbl.AddRow(release.Name, release.duration.Round(time.Second)) + if err != nil { + logger.Warn("Could not add row, %v", err) + } } + logger.Info(tbl.String()) } if ar.Failed != nil && len(ar.Failed) > 0 { logger.Info("\nFAILED RELEASES:") - logger.Info("NAME") + tbl, _ := prettytable.NewTable(prettytable.Column{Header: "NAME"}, + prettytable.Column{Header: "CHART", MinWidth: 6}, + prettytable.Column{Header: "VERSION", AlignRight: true}, + ) + tbl.Separator = " " for _, release := range ar.Failed { - logger.Info(release.Name) + err := tbl.AddRow(release.Name, release.Chart, release.installedVersion) + if err != nil { + logger.Warn("Could not add row, %v", err) + } } + logger.Info(tbl.String()) } } diff --git a/pkg/state/temp_test.go b/pkg/state/temp_test.go index 9637f8f5..1ed95691 100644 --- a/pkg/state/temp_test.go +++ b/pkg/state/temp_test.go @@ -38,39 +38,39 @@ func TestGenerateID(t *testing.T) { run(testcase{ subject: "baseline", release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, - want: "foo-values-7cd4757dfd", + want: "foo-values-77cb4d7f9b", }) run(testcase{ subject: "different bytes content", release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, data: []byte(`{"k":"v"}`), - want: "foo-values-7bb85f848f", + want: "foo-values-6f6bc74b55", }) run(testcase{ subject: "different map content", release: ReleaseSpec{Name: "foo", Chart: "incubator/raw"}, data: map[string]interface{}{"k": "v"}, - want: "foo-values-c57649655", + want: "foo-values-57dfc6cb8f", }) run(testcase{ subject: "different chart", release: ReleaseSpec{Name: "foo", Chart: "stable/envoy"}, - want: "foo-values-bf798c8f", + want: "foo-values-74594bb67", }) run(testcase{ subject: "different name", release: ReleaseSpec{Name: "bar", Chart: "incubator/raw"}, - want: "bar-values-5465f47b4f", + want: "bar-values-bdbb54d7", }) run(testcase{ subject: "specific ns", release: ReleaseSpec{Name: "foo", Chart: "incubator/raw", Namespace: "myns"}, - want: "myns-foo-values-55f77767f5", + want: "myns-foo-values-677dcd477", }) for id, n := range ids {