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

RepositoryEnvironment for private repositories gives invalid error: 422 Fail to create protected rule #251

Closed
gsuess opened this issue Oct 7, 2022 · 1 comment
Labels
awaiting-upstream Awaiting upstream dependency kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@gsuess
Copy link

gsuess commented Oct 7, 2022

What happened?

When creating a RepositoryEnvironment for a private repository, a misleading error occurs:

422 Fail to create protected rule, please ensure billing plan include protected branch gate. []

While it is possible to create RepositoryEnvironment with GitHub REST API and via the web-interface.

Steps to reproduce

This will require a GitHub Teams account for your organisation.

With this:

const repo = new github.Repository("test-repo", {
    description: "Delete me",
    visibility: "private", // this part is important to reproduce this error.
});

const env = new github.RepositoryEnvironment("test-environment", {
    repository: repo.name,
    environment: "testing",
});

run pulumi up

Expected Behavior

Creates a private repository with with environment named "testing".

Actual Behavior

Creates a private repository, but fails to create the environment:

Previewing update (dev)

View Live: https://app.pulumi.com/gsuess/pulumi-playground/dev/previews/3b1002b7-21fc-41b8-99aa-b4e7784132b4

     Type                                   Name                   Plan       
 +   pulumi:pulumi:Stack                    pulumi-playground-dev  create     
 +   ├─ github:index:Repository             test-repo              create     
 +   └─ github:index:RepositoryEnvironment  test-environment       create     
 
Resources:
    + 3 to create

Do you want to perform this update? yes
Updating (dev)

View Live: https://app.pulumi.com/gsuess/pulumi-playground/dev/updates/75

     Type                                   Name                   Status                  Info
 +   pulumi:pulumi:Stack                    pulumi-playground-dev  **creating failed**     1 error
 +   ├─ github:index:Repository             test-repo              created                 
 +   └─ github:index:RepositoryEnvironment  test-environment       **creating failed**     1 error
 
Diagnostics:
  github:index:RepositoryEnvironment (test-environment):
    error: PUT https://api.github.com/repos/Qualifyze/test-repo-6cab25b/environments/testing: 422 Fail to create protected rule, please ensure billing plan include protected branch gate. []
 
  pulumi:pulumi:Stack (pulumi-playground-dev):
    error: update failed
 
Resources:
    + 2 created

Duration: 11s

Output of pulumi about

CLI          
Version      3.39.2
Go Version   go1.19
Go Compiler  gc

Plugins
NAME    VERSION
github  5.0.0
nodejs  unknown

Host     
OS       darwin
Version  12.6
Arch     arm64

This project is written in nodejs: executable='/Users/gsuess/.volta/bin/node' version='v18.7.0'

Current Stack: dev

TYPE                                URN
pulumi:pulumi:Stack                 urn:pulumi:dev::pulumi-playground::pulumi:pulumi:Stack::pulumi-playground-dev
pulumi:providers:github             urn:pulumi:dev::pulumi-playground::pulumi:providers:github::default_5_0_0
github:index/repository:Repository  urn:pulumi:dev::pulumi-playground::github:index/repository:Repository::test-repo


Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/gsuess
User           gsuess
Organizations  gsuess, Qualifyze

Dependencies:
NAME            VERSION
@pulumi/pulumi  3.40.3
@types/node     14.18.31
@octokit/rest   19.0.4
@pulumi/github  5.0.0

Pulumi locates its logs in /var/folders/_j/n3zrsq6n373c_18tsgvfs2yc0000gn/T/ by default

Additional context

This is most likely an upstream bug with the terraform provider. But reporting it here anyway for reference.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@gsuess gsuess added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 7, 2022
@lblackstone lblackstone added awaiting-upstream Awaiting upstream dependency and removed needs-triage Needs attention from the triage team labels Oct 7, 2022
@bigluck
Copy link

bigluck commented Jan 17, 2023

Ciao, looks like the bug has been fixed on the go-github repo google/go-github#2611 and on the terraform-provider-github repo integrations/terraform-provider-github#1262 (comment)
I've just upgraded my python dep (pulumi-github) to the latest version (5.2.0), but this bug is still blocking my deployment.

Thanks

@AaronFriel AaronFriel added the resolution/fixed This issue was fixed label Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-upstream Awaiting upstream dependency kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

4 participants