-
Notifications
You must be signed in to change notification settings - Fork 324
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
Add most Premium features for gitlab_branch_protection #556
Conversation
@armsnyder This is probably not yet fully working, but I hit a snag on the acceptance tests in gitlab/resource_gitlab_branch_protection_test.go where e.g. |
This turned out to be that I'm not allowed to set the |
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
Signed-off-by: Sune Keller <absukl@almbrand.dk>
…nt of implementation functions Signed-off-by: Sune Keller <absukl@almbrand.dk>
@armsnyder I've resolved all acceptance test issues now. Please note that while the response structure contains lists of access levels, allowed users and groups in one long list per action (push, merge), the create options are not made this way, and one has to filter through the lists to find what one is looking for. Hence the proposed argument structure, including the use of |
Any plans on merging this? This would be great to allow a bot to push code while restricting everyone else. |
@sirlatrom this looks great! thank you for implementing this! Apologies for it taking so long to get reviewed 🙇 Your code and tests look great to me, and I agree with you about using I've been able to build and run your branch locally, and test it against a Premium licensed GitLab instance, but I am seeing this when running acceptance tests against that Premium instance, so I was wondering if you had any thoughts related to the
|
Ah, looks like I'm getting that on |
This file was part of #556 but did not include a test, docs, or an entry in gitlab/provider.go, so we are removing it until it can be completed.
This file was part of #556 but did not include a test, docs, or an entry in gitlab/provider.go, so we are removing it until it can be completed.
This file was part of #556 but did not include a test, docs, or an entry in gitlab/provider.go, so we are removing it until it can be completed.
* Fix documentation to show up on terraform registry * update reference to `master` branch to `main` Tested to confirm that it does create a `main` branch by default * Add support for importing Pipeline Schedules and Triggers * Also wait for import_status when a project template is configured Signed-off-by: Sune Keller <absukl@almbrand.dk> * Update dependencies Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu> * Add most Premium features for gitlab_branch_protection (gitlabhq#556) * Rebase and update go.mod Signed-off-by: Sune Keller <absukl@almbrand.dk> * Add most Premium features for gitlab_branch_protection Signed-off-by: Sune Keller <absukl@almbrand.dk> * Re-work modified schema for gitlab_branch_protection, and update docs Signed-off-by: Sune Keller <absukl@almbrand.dk> * Accommodate to name changes from library maintainer Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove invalid check for CE Signed-off-by: Sune Keller <absukl@almbrand.dk> * Revert back how merge_access_level and push_access_level are created Signed-off-by: Sune Keller <absukl@almbrand.dk> * Simplify expansion of arguments Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove several obsolete functions and make acceptance tests independent of implementation functions Signed-off-by: Sune Keller <absukl@almbrand.dk> * fix: update default_branch to "main" for gitlab_project tests * chore: add error handling to resourceGitlabProjectSetToState * Documentation improvements (gitlabhq#642) * Documentation improvements * More Markdown lint fixes * Add golangci-lint to the pipeline Fixes #361 * Add protected_branch_ids to gitlab_project_approval_rule (gitlabhq#542) Signed-off-by: Sune Keller <absukl@almbrand.dk> * chore: remove incomplete gitlab_project_repository_file resource (gitlabhq#650) This file was part of gitlabhq#556 but did not include a test, docs, or an entry in gitlab/provider.go, so we are removing it until it can be completed. * golangci-lint: exclude ResourceData.Set (gitlabhq#652) The common case when using this method is to ignore the error return. This is because the Terraform test framework checks these errors for primitive types for us. * CI: Add tfproviderlint workflow * Ignore preexisting tfproviderlint issues * chore: run golangci-lint for pull requests and annotate failing checks so we can fix them individually (gitlabhq#658) * chore: fix markdown linter errors in branch_protection.md (gitlabhq#656) * modify Co-authored-by: Denis Doria <denisdoria@gmail.com> Co-authored-by: Daniel Hill <dan@mamu.co> Co-authored-by: Patrick Decat <pdecat@gmail.com> Co-authored-by: Sune Keller <absukl@almbrand.dk> Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu> Co-authored-by: Matt Kasa <mkasa@gitlab.com> Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Willian Paixao <willian@ufpa.br> Co-authored-by: Matt Kasa <mattkasa@users.noreply.github.com> Co-authored-by: Adam Snyder <armsnyder@gmail.com> Co-authored-by: Adam Snyder <asnyder@ea.com>
* add build coverage regex * fmt * modify data source and tests * modify doc * fmt * Feature (#1) * Fix documentation to show up on terraform registry * update reference to `master` branch to `main` Tested to confirm that it does create a `main` branch by default * Add support for importing Pipeline Schedules and Triggers * Also wait for import_status when a project template is configured Signed-off-by: Sune Keller <absukl@almbrand.dk> * Update dependencies Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu> * Add most Premium features for gitlab_branch_protection (#556) * Rebase and update go.mod Signed-off-by: Sune Keller <absukl@almbrand.dk> * Add most Premium features for gitlab_branch_protection Signed-off-by: Sune Keller <absukl@almbrand.dk> * Re-work modified schema for gitlab_branch_protection, and update docs Signed-off-by: Sune Keller <absukl@almbrand.dk> * Accommodate to name changes from library maintainer Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove invalid check for CE Signed-off-by: Sune Keller <absukl@almbrand.dk> * Revert back how merge_access_level and push_access_level are created Signed-off-by: Sune Keller <absukl@almbrand.dk> * Simplify expansion of arguments Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove several obsolete functions and make acceptance tests independent of implementation functions Signed-off-by: Sune Keller <absukl@almbrand.dk> * fix: update default_branch to "main" for gitlab_project tests * chore: add error handling to resourceGitlabProjectSetToState * Documentation improvements (#642) * Documentation improvements * More Markdown lint fixes * Add golangci-lint to the pipeline Fixes #361 * Add protected_branch_ids to gitlab_project_approval_rule (#542) Signed-off-by: Sune Keller <absukl@almbrand.dk> * chore: remove incomplete gitlab_project_repository_file resource (#650) This file was part of #556 but did not include a test, docs, or an entry in gitlab/provider.go, so we are removing it until it can be completed. * golangci-lint: exclude ResourceData.Set (#652) The common case when using this method is to ignore the error return. This is because the Terraform test framework checks these errors for primitive types for us. * CI: Add tfproviderlint workflow * Ignore preexisting tfproviderlint issues * chore: run golangci-lint for pull requests and annotate failing checks so we can fix them individually (#658) * chore: fix markdown linter errors in branch_protection.md (#656) * modify Co-authored-by: Denis Doria <denisdoria@gmail.com> Co-authored-by: Daniel Hill <dan@mamu.co> Co-authored-by: Patrick Decat <pdecat@gmail.com> Co-authored-by: Sune Keller <absukl@almbrand.dk> Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu> Co-authored-by: Matt Kasa <mkasa@gitlab.com> Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Willian Paixao <willian@ufpa.br> Co-authored-by: Matt Kasa <mattkasa@users.noreply.github.com> Co-authored-by: Adam Snyder <armsnyder@gmail.com> Co-authored-by: Adam Snyder <asnyder@ea.com> Co-authored-by: Denis Doria <denisdoria@gmail.com> Co-authored-by: Daniel Hill <dan@mamu.co> Co-authored-by: Patrick Decat <pdecat@gmail.com> Co-authored-by: Sune Keller <absukl@almbrand.dk> Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu> Co-authored-by: Matt Kasa <mkasa@gitlab.com> Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Willian Paixao <willian@ufpa.br> Co-authored-by: Matt Kasa <mattkasa@users.noreply.github.com> Co-authored-by: Adam Snyder <armsnyder@gmail.com> Co-authored-by: Adam Snyder <asnyder@ea.com>
* add build coverage regex * fmt * modify data source and tests * modify doc * fmt * Feature (#1) * Fix documentation to show up on terraform registry * update reference to `master` branch to `main` Tested to confirm that it does create a `main` branch by default * Add support for importing Pipeline Schedules and Triggers * Also wait for import_status when a project template is configured Signed-off-by: Sune Keller <absukl@almbrand.dk> * Update dependencies Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu> * Add most Premium features for gitlab_branch_protection (gitlabhq#556) * Rebase and update go.mod Signed-off-by: Sune Keller <absukl@almbrand.dk> * Add most Premium features for gitlab_branch_protection Signed-off-by: Sune Keller <absukl@almbrand.dk> * Re-work modified schema for gitlab_branch_protection, and update docs Signed-off-by: Sune Keller <absukl@almbrand.dk> * Accommodate to name changes from library maintainer Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove invalid check for CE Signed-off-by: Sune Keller <absukl@almbrand.dk> * Revert back how merge_access_level and push_access_level are created Signed-off-by: Sune Keller <absukl@almbrand.dk> * Simplify expansion of arguments Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove several obsolete functions and make acceptance tests independent of implementation functions Signed-off-by: Sune Keller <absukl@almbrand.dk> * fix: update default_branch to "main" for gitlab_project tests * chore: add error handling to resourceGitlabProjectSetToState * Documentation improvements (gitlabhq#642) * Documentation improvements * More Markdown lint fixes * Add golangci-lint to the pipeline Fixes #361 * Add protected_branch_ids to gitlab_project_approval_rule (gitlabhq#542) Signed-off-by: Sune Keller <absukl@almbrand.dk> * chore: remove incomplete gitlab_project_repository_file resource (gitlabhq#650) This file was part of gitlabhq#556 but did not include a test, docs, or an entry in gitlab/provider.go, so we are removing it until it can be completed. * golangci-lint: exclude ResourceData.Set (gitlabhq#652) The common case when using this method is to ignore the error return. This is because the Terraform test framework checks these errors for primitive types for us. * CI: Add tfproviderlint workflow * Ignore preexisting tfproviderlint issues * chore: run golangci-lint for pull requests and annotate failing checks so we can fix them individually (gitlabhq#658) * chore: fix markdown linter errors in branch_protection.md (gitlabhq#656) * modify Co-authored-by: Denis Doria <denisdoria@gmail.com> Co-authored-by: Daniel Hill <dan@mamu.co> Co-authored-by: Patrick Decat <pdecat@gmail.com> Co-authored-by: Sune Keller <absukl@almbrand.dk> Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu> Co-authored-by: Matt Kasa <mkasa@gitlab.com> Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Willian Paixao <willian@ufpa.br> Co-authored-by: Matt Kasa <mattkasa@users.noreply.github.com> Co-authored-by: Adam Snyder <armsnyder@gmail.com> Co-authored-by: Adam Snyder <asnyder@ea.com> Co-authored-by: Denis Doria <denisdoria@gmail.com> Co-authored-by: Daniel Hill <dan@mamu.co> Co-authored-by: Patrick Decat <pdecat@gmail.com> Co-authored-by: Sune Keller <absukl@almbrand.dk> Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu> Co-authored-by: Matt Kasa <mkasa@gitlab.com> Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Willian Paixao <willian@ufpa.br> Co-authored-by: Matt Kasa <mattkasa@users.noreply.github.com> Co-authored-by: Adam Snyder <armsnyder@gmail.com> Co-authored-by: Adam Snyder <asnyder@ea.com>
* Add most Premium features for gitlab_branch_protection (gitlabhq#556) * Rebase and update go.mod Signed-off-by: Sune Keller <absukl@almbrand.dk> * Add most Premium features for gitlab_branch_protection Signed-off-by: Sune Keller <absukl@almbrand.dk> * Re-work modified schema for gitlab_branch_protection, and update docs Signed-off-by: Sune Keller <absukl@almbrand.dk> * Accommodate to name changes from library maintainer Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove invalid check for CE Signed-off-by: Sune Keller <absukl@almbrand.dk> * Revert back how merge_access_level and push_access_level are created Signed-off-by: Sune Keller <absukl@almbrand.dk> * Simplify expansion of arguments Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove several obsolete functions and make acceptance tests independent of implementation functions Signed-off-by: Sune Keller <absukl@almbrand.dk> * fix: update default_branch to "main" for gitlab_project tests * chore: add error handling to resourceGitlabProjectSetToState * Documentation improvements (gitlabhq#642) * Documentation improvements * More Markdown lint fixes * Add golangci-lint to the pipeline Fixes #361 * Add protected_branch_ids to gitlab_project_approval_rule (gitlabhq#542) Signed-off-by: Sune Keller <absukl@almbrand.dk> * chore: remove incomplete gitlab_project_repository_file resource (gitlabhq#650) This file was part of gitlabhq#556 but did not include a test, docs, or an entry in gitlab/provider.go, so we are removing it until it can be completed. * golangci-lint: exclude ResourceData.Set (gitlabhq#652) The common case when using this method is to ignore the error return. This is because the Terraform test framework checks these errors for primitive types for us. * CI: Add tfproviderlint workflow * Ignore preexisting tfproviderlint issues * chore: run golangci-lint for pull requests and annotate failing checks so we can fix them individually (gitlabhq#658) * chore: fix markdown linter errors in branch_protection.md (gitlabhq#656) * add build coverage regex (gitlabhq#627) * add build coverage regex * fmt * modify data source and tests * modify doc * fmt * Feature (#1) * Fix documentation to show up on terraform registry * update reference to `master` branch to `main` Tested to confirm that it does create a `main` branch by default * Add support for importing Pipeline Schedules and Triggers * Also wait for import_status when a project template is configured Signed-off-by: Sune Keller <absukl@almbrand.dk> * Update dependencies Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu> * Add most Premium features for gitlab_branch_protection (gitlabhq#556) * Rebase and update go.mod Signed-off-by: Sune Keller <absukl@almbrand.dk> * Add most Premium features for gitlab_branch_protection Signed-off-by: Sune Keller <absukl@almbrand.dk> * Re-work modified schema for gitlab_branch_protection, and update docs Signed-off-by: Sune Keller <absukl@almbrand.dk> * Accommodate to name changes from library maintainer Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove invalid check for CE Signed-off-by: Sune Keller <absukl@almbrand.dk> * Revert back how merge_access_level and push_access_level are created Signed-off-by: Sune Keller <absukl@almbrand.dk> * Simplify expansion of arguments Signed-off-by: Sune Keller <absukl@almbrand.dk> * Remove several obsolete functions and make acceptance tests independent of implementation functions Signed-off-by: Sune Keller <absukl@almbrand.dk> * fix: update default_branch to "main" for gitlab_project tests * chore: add error handling to resourceGitlabProjectSetToState * Documentation improvements (gitlabhq#642) * Documentation improvements * More Markdown lint fixes * Add golangci-lint to the pipeline Fixes #361 * Add protected_branch_ids to gitlab_project_approval_rule (gitlabhq#542) Signed-off-by: Sune Keller <absukl@almbrand.dk> * chore: remove incomplete gitlab_project_repository_file resource (gitlabhq#650) This file was part of gitlabhq#556 but did not include a test, docs, or an entry in gitlab/provider.go, so we are removing it until it can be completed. * golangci-lint: exclude ResourceData.Set (gitlabhq#652) The common case when using this method is to ignore the error return. This is because the Terraform test framework checks these errors for primitive types for us. * CI: Add tfproviderlint workflow * Ignore preexisting tfproviderlint issues * chore: run golangci-lint for pull requests and annotate failing checks so we can fix them individually (gitlabhq#658) * chore: fix markdown linter errors in branch_protection.md (gitlabhq#656) * modify Co-authored-by: Denis Doria <denisdoria@gmail.com> Co-authored-by: Daniel Hill <dan@mamu.co> Co-authored-by: Patrick Decat <pdecat@gmail.com> Co-authored-by: Sune Keller <absukl@almbrand.dk> Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu> Co-authored-by: Matt Kasa <mkasa@gitlab.com> Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Willian Paixao <willian@ufpa.br> Co-authored-by: Matt Kasa <mattkasa@users.noreply.github.com> Co-authored-by: Adam Snyder <armsnyder@gmail.com> Co-authored-by: Adam Snyder <asnyder@ea.com> Co-authored-by: Denis Doria <denisdoria@gmail.com> Co-authored-by: Daniel Hill <dan@mamu.co> Co-authored-by: Patrick Decat <pdecat@gmail.com> Co-authored-by: Sune Keller <absukl@almbrand.dk> Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu> Co-authored-by: Matt Kasa <mkasa@gitlab.com> Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Willian Paixao <willian@ufpa.br> Co-authored-by: Matt Kasa <mattkasa@users.noreply.github.com> Co-authored-by: Adam Snyder <armsnyder@gmail.com> Co-authored-by: Adam Snyder <asnyder@ea.com> * CI: Use golangci-lint to run gofmt; remove redundant errcheck script * gitlab_project resource: make default_branch attribute configurable on creation - Made default_branch a computed attribute - Removed the DiffSuppressFunc from default_branch so that we can use it during creation - Implemented logic to set the default branch in cases where a repository exists (if the project was created with a readme, as a mirror, or from a template) - Refactored the mirror code to be more explicit, instead of calling the update function from inside the create function. There was an error being returned here, which was being ignored. * Add common test helpers for setting up test data * Fix failing test TestAccGitLabProjectApprovalRule_basic * CI: Increase golangci-lint timeout to 3m * Adds support for gitlab project badges (gitlabhq#648) * add project badge support * fix tests and gitlab sdk references * change id to projectid:badgeid and add importer * add gitlab_project_badge documentation * unify basic test and imporState test for project_badge * Change project_badge test order Co-authored-by: Adam Snyder <armsnyder@gmail.com> * remove unnecessary newlines * add project_badge import documentation Co-authored-by: Adam Snyder <armsnyder@gmail.com> * Add CustomCIPath to resource `gitlab_project` (gitlabhq#662) * Add CustomCIPath to resource `gitlab_project` * Delete acc test for simple GitLabProject attribute. - Amend existing Acceptance test to reflect this change in the default project * New branch_protection_id attribute for gitlab_branch_protection * CI: Run markdown linter on pull requests ...so that main branch builds to not fail unexpectedly after merging a PR from a fork. * resource/gitlab_project_cluster: Suppress whitespace diffs for kubernetes_ca_cert attribute * Clarify supported Terraform versions (gitlabhq#677) * Update EE license * Update CHANGELOG for 3.7.0 * Fix GitLab project membership example * Authenticate using a Bearer token to support OAuth tokens * Change acceptance test token value The personal access token must be a certain length in order to use it as a Bearer token * update to two part id * use two part id for resource * fmt * remove unused * update resource commit * update flatten commit method * remove max items * updated logic for handling 404 * remove required * added importer * update refs * updated so markdown lint would pass * removed fmt * md lint suggestions * switch to set type * update * update tests * Update docs/resources/branch.md Co-authored-by: Corey Hemminger <hemminger@hotmail.com> * update docs * changed map type schema for commit * syntax' * fmt * added check for empty commit * force error * force error * update provider * updated error check * update provider lint * lint suggestions * fmt * remove duplication of ci config path Co-authored-by: Sune Keller <absukl@almbrand.dk> Co-authored-by: Matt Kasa <mkasa@gitlab.com> Co-authored-by: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Co-authored-by: Willian Paixao <willian@ufpa.br> Co-authored-by: Matt Kasa <mattkasa@users.noreply.github.com> Co-authored-by: Adam Snyder <armsnyder@gmail.com> Co-authored-by: Adam Snyder <asnyder@ea.com> Co-authored-by: zawazawa0316 <37421794+zawazawa0316@users.noreply.github.com> Co-authored-by: Denis Doria <denisdoria@gmail.com> Co-authored-by: Daniel Hill <dan@mamu.co> Co-authored-by: Patrick Decat <pdecat@gmail.com> Co-authored-by: Julien Pivotto <roidelapluie@inuits.eu> Co-authored-by: Filipe Andujar <filipeandujar@gmail.com> Co-authored-by: Marcos Soutullo Rodriguez <marcos.soutullo91@gmail.com> Co-authored-by: nicholasklick <nicholas.klick@gmail.com> Co-authored-by: Nicholas Klick <nklick@gitlab.com> Co-authored-by: Andrea Scarpino <andrea@scarpino.dev> Co-authored-by: Ed B <edward.butler.external@atosbpstestworkplace.onmicrosoft.com> Co-authored-by: Corey Hemminger <hemminger@hotmail.com>
Fixes #165.
TO DO: