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

Add owner attribute for repository resource #1832

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tdabasinskas
Copy link

@tdabasinskas tdabasinskas commented Aug 8, 2023

An attempt to fix #1702.

The lack of ability to specify owner for an individual repository resource makes this provider pretty much unusable in a GHES environment containing over 300 organizations – having a separate provider for every single organization is probably not a great idea.

I'm not sure my solution is ideal – the current code is quite biased on the owner being resolved automatically, so it's a bit challenging to add support for an explicit owner without introducing a breaking change.

I've tested this quite extensively manually – seems to be working as expected. If someone could help with adding some tests to confirm this, I would appreciate. Also, these changes should be applied to all repository_ resources, but prior to doing that, I wanted to get some feedback.


Before the change?

  • repository resource uses owner specified at the provider level.

After the change?

  • repository resource supports an optional owner argument.
  • If the argument is provided, the resource is managed under that specific owner.
  • If the argument is not provided, the owner defined at the provider level is used.

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

Signed-off-by: Tomas Dabasinskas <tomas@dabasinskas.net>

Took 3 hours 5 minutes
Signed-off-by: Tomas Dabasinskas <tomas@dabasinskas.net>

Took 13 minutes
@kfcampbell
Copy link
Member

This seems like a good approach to the change to me, though I also feel somewhat uncomfortable without integration tests.

@nickfloyd nickfloyd added Type: Feature New feature or request Awaiting response labels Aug 25, 2023
@nickfloyd
Copy link
Contributor

Hey @tdabasinskas, just a quick follow up. Is this something that you are interested in wrapping up?
I think the remaining items are:

  • @kfcampbell left a quick suggestion on the docs
  • Some integration tests if you get the chance

Thanks again for making things better for the community here! ❤️

@tdabasinskas
Copy link
Author

Hi @nickfloyd,

Sorry for dropping a ball on this.

I've updated the docs as per @kfcampbell proposal. However, I'm not sure when I could do the integration tests, and, more importantly, add this to all the rest of repository-related resources. Being able to set owner only for repository resource but still requiring dedicated providers for all other resources, is not ideal 😕

@kfcampbell
Copy link
Member

Being able to set owner only for repository resource but still requiring dedicated providers for all other resources, is not ideal 😕

I definitely agree with this take, and this is something the provider can stand to do a lot better on. We'd definitely be receptive to anybody wanting to continue this work.

@avidspartan1
Copy link

Hey every, just a heads up - I merged this branch into my own and am continuing this work there. Feedback welcome!

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.

[FEAT]: github_repository select organization to use in Enterprise
4 participants