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

Empty ruleset required_deployment_environments is now valid #1942

Merged
merged 4 commits into from
Oct 25, 2023

Conversation

o-sama
Copy link
Contributor

@o-sama o-sama commented Oct 6, 2023

Resolves #1915


Before the change?

  • Adding DefaultFunc fixed the issue for existing rulesets but not new ones.

After the change?

  • Removed DefaultFunc from this field so that you can't define an empty block for required_deployments rule. If required_deployment_environments is empty then we know we'll have a nil interface, and we manually set the value to an empty slice of interfaces, otherwise we just cast the value to a slice of interfaces as usual.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No, existing rulesets with a non-empty list aren't affected since we do the same thing now as done previously, and setting an empty list in the state for new rulesets doesn't conflict with non-empty slices that are created when environments are defined.

Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

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

Thanks!

@kfcampbell kfcampbell merged commit b86c22c into integrations:main Oct 25, 2023
3 checks passed
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this pull request Feb 5, 2024
…ions#1942)

* Empty ruleset required_deployment_environments is now valid

* Update github/respository_rules_utils.go

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: repository_ruleset crash on empty required_deployment_environments
2 participants