Skip to content
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

Merged
merged 11 commits into from
Dec 21, 2021

Conversation

liranfarage89
Copy link
Contributor

@liranfarage89 liranfarage89 commented Dec 19, 2021

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

  1. Add validation in both create & update cases.
  2. auth_deploy_on_path_changes_only must be true for the glob to take effect.

@liranfarage89 liranfarage89 self-assigned this Dec 20, 2021
@liranfarage89
Copy link
Contributor Author

…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'
Type: schema.TypeString,
Description: "redeploy on file filter pattern",
Optional: true,
Default: "",
Copy link
Contributor

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +402 to +413
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
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

@liranfarage89 liranfarage89 merged commit 5515923 into main Dec 21, 2021
@liranfarage89 liranfarage89 deleted the fix-glob-pattern-validation branch December 21, 2021 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants