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 <ykuoka@gmail.com>
This commit is contained in:
		
							parent
							
								
									fc027d1538
								
							
						
					
					
						commit
						8c130a4fa7
					
				|  | @ -3,6 +3,8 @@ package policy | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"errors" | 	"errors" | ||||||
|  | 
 | ||||||
|  | 	"github.com/helmfile/helmfile/pkg/runtime" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| var ( | var ( | ||||||
|  | @ -17,7 +19,7 @@ func forbidEnvironmentsWithReleases(releaseState map[string]interface{}) (bool, | ||||||
| 	_, hasEnvironments := releaseState["environments"] | 	_, hasEnvironments := releaseState["environments"] | ||||||
| 	_, hasReleases := releaseState["releases"] | 	_, hasReleases := releaseState["releases"] | ||||||
| 	if hasEnvironments && hasReleases { | 	if hasEnvironments && hasReleases { | ||||||
| 		return false, EnvironmentsAndReleasesWithinSameYamlPartErr | 		return runtime.V1Mode, EnvironmentsAndReleasesWithinSameYamlPartErr | ||||||
| 	} | 	} | ||||||
| 	return false, nil | 	return false, nil | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue