-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix: Add glob_pattern validation when cd/PrPlan enabled #190
Conversation
…into fix-glob-pattern-validation � Conflicts: � env0/resource_environment.go � env0/resource_environment_test.go
…use 'true' is needed for the API to enable 'custom glob'
…into fix-glob-pattern-validation
env0/resource_environment.go
Outdated
Type: schema.TypeString, | ||
Description: "redeploy on file filter pattern", | ||
Optional: true, | ||
Default: "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be redundant (I think* that d.get always returns the false value of that type)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func assertDeploymentTriggers(autoDeployByCustomGlob string, continuousDeployment bool, pullRequestPlanDeployments bool, autoDeployOnPathChangesOnly bool) diag.Diagnostics { | ||
if autoDeployByCustomGlob != "" { | ||
if (continuousDeployment == false) && | ||
(pullRequestPlanDeployments == false) { | ||
return diag.Errorf("run_plan_on_pull_requests or deploy_on_push must be enabled for auto_deploy_by_custom_glob") | ||
} | ||
if autoDeployOnPathChangesOnly == false { | ||
return diag.Errorf("cannot set auto_deploy_by_custom_glob when auto_deploy_on_path_changes_only is disabled") | ||
} | ||
} | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
Issue & Steps to Reproduce / Feature Request
Currently we don't validate that CD/PrPlan are enabled if the user set a custom_glob_pattern. By default, the
runOnAnyChange
is enabled, so that should be true unless the user configured a glob pattern.Solution
true
for the glob to take effect.