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

go-github update #475

Closed
wants to merge 12 commits into from
Closed

go-github update #475

wants to merge 12 commits into from

Conversation

andrew-waters
Copy link

https://github.com/google/go-github/releases/tag/v32.0.0 has been released and included breaking changes to a few functions in this provider. This PR aims to maintain parity with existing functionality but will unblock work on organisation secrets (https://github.com/terraform-providers/terraform-provider-github/issues/468)

@ghost ghost added the size/M label May 28, 2020
@andrew-waters andrew-waters marked this pull request as draft May 28, 2020 14:44
@andrew-waters andrew-waters marked this pull request as ready for review May 28, 2020 14:48
go mod vendor
@ghost ghost added size/XXL and removed size/M labels May 28, 2020
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

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

hi @andrew-waters thank you for this PR!
One thing I did notice which I believe is a result of these upstream changes here google/go-github@f093974 is that the BranchProtection restriction-related tests are failing:

   TestAccGithubBranchProtection_teams: testing.go:654: Step 0 error: errors during apply:

        Error: PUT https://api.github.com/repos/github-test-org/tf-acc-test-branch-prot-v6opn/branches/master/protection: 422 Invalid request.

        No subschema in "anyOf" matched.
        "teams", "users" weren't supplied.
        Not all subschemas of "allOf" matched.
        For 'anyOf/1', {} is not a null. []

          on /var/folders/0l/3rqflfpd06z9qmklfcvqy1yh0000gn/T/tf-test942841618/main.tf line 28:
          (source code not available)
  TestAccGithubBranchProtection_basic: testing.go:654: Step 0 error: errors during apply:

        Error: PUT https://api.github.com/repos/github-test-org/tf-acc-test-branch-prot-q10kx/branches/master/protection: 422 Invalid request.

        No subschema in "anyOf" matched.
        "teams" wasn't supplied.
        Not all subschemas of "allOf" matched.
        For 'anyOf/1', {"users"=>["anGie44"]} is not a null. []

          on /var/folders/0l/3rqflfpd06z9qmklfcvqy1yh0000gn/T/tf-test210218632/main.tf line 8:
          (source code not available)
 TestAccGithubBranchProtection_users: testing.go:647: Step 0, expected error:

        errors during apply: PUT https://api.github.com/repos/github-test-org/tf-acc-test-branch-prot-or9u7/branches/master/protection: 422 Invalid request.

        No subschema in "anyOf" matched.
        "teams" wasn't supplied.
        Not all subschemas of "allOf" matched.
        For 'anyOf/1', {"users"=>["user_with_underscore"]} is not a null. []

        To match:

        unable to add users in restrictions: user_with_underscore
    TestAccGithubBranchProtection_emptyItems: testing.go:654: Step 0 error: errors during apply:

        Error: PUT https://api.github.com/repos/github-test-org-ap/tf-acc-test-branch-prot-49dp8/branches/master/protection: 422 Invalid request.

        No subschema in "anyOf" matched.
        "teams", "users" weren't supplied.
        Not all subschemas of "allOf" matched.
        For 'anyOf/1', {} is not a null. []

          on /var/folders/0l/3rqflfpd06z9qmklfcvqy1yh0000gn/T/tf-test270873605/main.tf line 8:
          (source code not available)

We may need to adjust the implementation in the expansion of restrictions such that the empty fields (users, teams, and/or apps) are not necessarily passed as empty GoLang slices as they are right now with ([]string{}) as seen in this method https://github.com/terraform-providers/terraform-provider-github/blob/feda68b147d322ed95474811568292dad4273dd8/github/resource_github_branch_protection.go#L567 OR an upstream change might be upcoming if this is a regression in the library (I submitted an issue google/go-github#1546 to track this new behavior)

go.mod Outdated
@@ -6,6 +6,7 @@ require (
github.com/client9/misspell v0.3.4
github.com/golangci/golangci-lint v1.25.1
github.com/google/go-github/v31 v31.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

we'll want to remove the previous go-github version

Copy link
Author

Choose a reason for hiding this comment

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

@anGie44 apologies for the delay getting back to you here - I've just committed 79d396e to get rid of v31 completely.

The underlying changes you've created an issue for I'm also subscribed to so let's see what comes of that conversation - it doesn't appear to have been resolved.

Copy link
Contributor

Choose a reason for hiding this comment

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

no worries @andrew-waters, thanks for having a look! reminds me I should check-in on that issue

@jcudit jcudit modified the milestones: v2.9.0, v2.10.0 Jun 3, 2020
@ejhayes
Copy link

ejhayes commented Jul 8, 2020

It looks like the tests are currently passing with these changes. Is this something that can be merged in or are you still waiting on google/go-github#1546?

@ghost ghost removed the Awaiting response label Jul 8, 2020
@jcudit jcudit modified the milestones: v2.10.0, v3.1.0 Jul 10, 2020
@hitmands
Copy link

Is there any update on this regards?

@andrew-waters
Copy link
Author

I'd refer to @anGie44 - as she ran the tests that picked up the issue, it would be good to see if they now pass as is suggested

@anGie44
Copy link
Contributor

anGie44 commented Jul 14, 2020

hi @hitmands, @andrew-waters! Unfortunately without upstream changes in the go-github library, the acceptance tests discussed above are still failing (perhaps you were referring to the Travis CI checks @ejhayes?) good news is the PR to revert that breakage is in review google/go-github#1571 and once that's in we can pick this one back up 👍

@andrew-waters
Copy link
Author

@anGie44 as you're already aware google/go-github#1571 has now been merged. Let me know if this PR needs any further work

@andrew-waters
Copy link
Author

I've upgraded the lib to the newly released v32.1.0.

I'd be very grateful if someone can run the acceptance tests to ensure that the release has fixed the issue we faced.

Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

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

LGTM @andrew-waters 👍

With the exception of TestAccGithubRepositoryFile tests failing unrelated to these changes (pending PR #491), all tests are passing for the provider authenticated with organization-level owners. For individual account owners, all tests pass/skip as expected with the exception of TestAccGithubActionsSecret_disappears which is failing but is unrelated to the changes here as well .

@ejhayes
Copy link

ejhayes commented Jul 24, 2020

@andrew-waters looks like this can be merged in any time.

@andrew-waters
Copy link
Author

Can I self merge @ejhayes ? First contribution :)

@ejhayes
Copy link

ejhayes commented Jul 24, 2020

Good point @andrew-waters. @anGie44 are you able to merge this change in?

@ejhayes
Copy link

ejhayes commented Aug 10, 2020

@hitmands are you able to merge this PR?

@nikolay
Copy link
Contributor

nikolay commented Aug 13, 2020

@hitmands Any chance to merge this?

@ejhayes
Copy link

ejhayes commented Aug 20, 2020

@jcudit are you able to merge this PR?

@jcudit
Copy link
Contributor

jcudit commented Aug 21, 2020

@ejhayes yes, but in time. This change and the feature it unblocks is tracked to be released at the end of September. Focus is currently on cleaning up testing and releasing v3.0.0. Once that blocker is cleared, we can get back to shipping changes like this at a more frequent pace. 🙇 for the patience on this one.

@jcudit
Copy link
Contributor

jcudit commented Oct 4, 2020

Resolving conflicts seems to have broken the tests in some way 🙃 . I've merged b587cb0 to accomplish the upgrade instead.

@jcudit jcudit closed this Oct 4, 2020
@andrew-waters
Copy link
Author

Thanks for adding this feature @jcudit. I'm glad that the proposed functionality can be achieved now as it is functionality I can leverage.

I'm somewhat disappointed that this PR had to be dropped - It seems that a lack of urgency (the PR was first cut on May 28th) turned into an abundance of urgency (the merge took less than 24 hours with a fresh cut) and I didn't get the opportunity to resolve them myself.

@andrew-waters andrew-waters deleted the github-go-update branch October 5, 2020 08:42
@jcudit
Copy link
Contributor

jcudit commented Oct 5, 2020

Apologies @andrew-waters, fair concern.

I have been working through a transition with primary responsibilities. Time has been sparse for this project and I've been more aggressive with changes to compensate.

I expect us to get a few more maintainers and return to a more predictable pace in the coming months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants