From 8c130a4fa7a3561e5f85661c5eea55e3b30f9fe2 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Wed, 8 Feb 2023 10:09:12 +0900 Subject: [PATCH] fix: Make the forbid-env-with-releases policy strict on v1 (#683) Currently, both v0 and v1 warns any usage of environments with releases within the same helmfile part. It should rather be an error for v1, as proposed in https://github.com/helmfile/helmfile/blob/main/docs/proposals/towards-1.0.md#forbid-the-use-of-environments-and-releases-within-a-single-helmfileyaml-part. Follow-up for #592 Signed-off-by: Yusuke Kuoka --- pkg/policy/checker.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/policy/checker.go b/pkg/policy/checker.go index 98475682..81c1ba17 100644 --- a/pkg/policy/checker.go +++ b/pkg/policy/checker.go @@ -3,6 +3,8 @@ package policy import ( "errors" + + "github.com/helmfile/helmfile/pkg/runtime" ) var ( @@ -17,7 +19,7 @@ func forbidEnvironmentsWithReleases(releaseState map[string]interface{}) (bool, _, hasEnvironments := releaseState["environments"] _, hasReleases := releaseState["releases"] if hasEnvironments && hasReleases { - return false, EnvironmentsAndReleasesWithinSameYamlPartErr + return runtime.V1Mode, EnvironmentsAndReleasesWithinSameYamlPartErr } return false, nil }