Branch protection with deploy key

  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you can request access to GitLab Duo.

Summary

Add support for field deploy_key_id in branch_protection.

Related Issues

Closes #693 (closed)

I'm not really familiar with Go, and even less with all the terraform sdk/framework, but I tried to tackle this like I would for other languages.
At first I tried just adding the new field to the existing structure, which got the tests passing except the TestAccGitlabBranchProtection_FailIfEnterpriseFeaturesUsedForCommunityLicense.
I took that as a sign of a lack of compatibility, so I then figured it needed a schema migration, but that didn't change the tests results.
The test failed when trying to convert the state field allowed_to_merge into the struct, stating that the new field was missing from the state, so I ended up duplicating the common struc, and only using the new one for the field allowed_to_push, and now the tests pass.

When I drop the 2nd commit (schema update), the tests are still ok. So I don't really know if that's required.
I'm not really proud of the duplication, and wonder if there is another mechanism that I can use for that ?

Edited by Nicolas Boussuge

Merge request reports

Loading