Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Support default base repositories - #7

Merged
hiimbex merged 1 commit into
probot:masterfrom
cco3:dotgithub-default
Jun 22, 2018
Merged

hiimbex merged 1 commit into
probot:masterfrom
cco3:dotgithub-default

Conversation

@cco3

@cco3 cco3 commented May 17, 2018

Copy link
Copy Markdown
Contributor

This change considers .github within the same org to be a default
base repository if none is specified. This works even when no config
file is specificed in the inheriting repository.

Issue: #1
Dependency: #6

Comment thread README.md Outdated
```

Additionally, if there is a repository in the org named `.github`, it will be
used as a base repository if none is specified.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you think you could add a config example for how this works? Would it just be files without the _extends?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The config example below is does that...is there something more you would like to see in it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yea ignore my comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would this work for personal accounts, too? Say I’d create gr2m/.github to see defaults for apps that I install, would that work?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@gr2m, yes, that would be the intention.

@hiimbex

hiimbex commented May 18, 2018

Copy link
Copy Markdown
Contributor

And I reviewed without updating my much longer comment facepalm after I realized my first comment was irrelevant.

Any ways, I realized that you implemented version 2 of #1 (comment) which has some risks, such as the danger of certain bots and their destructive power, like stale, see: atom/atom#15494. There are definitely use cases where orgs might want 1 or a few repos excluded from the universal configs, but maybe that could be added to the specific repos through a dontExtend: true field or something similar.

I think if we do go this route, we need to make it more explicit in the readme the universal power over repos that the .github repo configuration adds

@cco3

cco3 commented May 18, 2018

Copy link
Copy Markdown
Contributor Author

maybe that could be added to the specific repos through a dontExtend: true field or something similar.

Would it be sufficient for such repos to just specify all the settings they want to have control over? It's not perfect, but it does keep things simple.

@bkeepers

Copy link
Copy Markdown
Contributor

From the best practices docs

Never take bulk actions without explicit permission

Being installed on an account is sufficient permission for actions in response to a user action, like replying on a single issue. But a app must have explicit permission before performing bulk actions, like labeling all open issues.

For example, the stale app will only scan a target repository for stale issues and pull requests if .github/stale.yml exists in that target repository.

☝️is one thing we need to consider with adding this functionality. I don't think having a file in the .github should count as explicit permission.

A few ideas:

  1. Make this an option each app can opt-in to. I don't know exactly what the syntax would look like, but the function to fetch the config would have an option to always look to the .github repository
  2. Add a list of enabled repositories in .github repository config.

@cco3

cco3 commented May 21, 2018

Copy link
Copy Markdown
Contributor Author

What is the bulk action in this instance?

Make this an option each app can opt-in to.

If this is something that requires a config in the individual repository, it works against one of the purposes of this feature (to have configurations for some repos without adding any files).

Add a list of enabled repositories in .github repository config

I think this would work.

@hiimbex

hiimbex commented May 21, 2018

Copy link
Copy Markdown
Contributor

Add a list of enabled repositories in .github repository config.

Might be more efficient/practical for large orgs to have a list of disabled repositories.

Also thanks @bkeepers for better explaining the destructive power of "bulk actions"! ☺️

@cco3

cco3 commented May 21, 2018

Copy link
Copy Markdown
Contributor Author

I agree with the convenience of listing disabled repos, but a couple thoughts thoughts:

  • As far as permission concerns go, I'm not sure opt-out is sufficient to address the points raised.
  • Unless the maintainer proactively updates the global config, this would create a race condition for new repos that do want to opt-out.

Maybe we could have some config that says whether the list is an opt-out list or an opt-in list?

@hiimbex

hiimbex commented May 21, 2018

Copy link
Copy Markdown
Contributor

Hmm, that's a good point, I was thinking more about convenience.

Maybe we could have some config that says whether the list is an opt-out list or an opt-in list?

That could be doable, but is a bit more painful implementation wise.

@cco3

cco3 commented May 21, 2018

Copy link
Copy Markdown
Contributor Author

Yes, it would be =\

Maybe something else we could do is rather than an opt-in list of repos, we have an opt-in list of repo patterns/regexes...if someone wants all, they can just use * to mark all of them.

Another issue is that once the .github/ repo itself needs a configuration, we have to come up with somewhere to put it that doesn't conflict with other things. Maybe if we opt to only store inherited configs at the root of the repo, we can store its own config inside a .github/ directory.

@willnorris

Copy link
Copy Markdown

When you install the GitHub app, you select whether you want it installed for the org or select repositories. Is that itself not sufficient control for which repositories the application is applied to? What does an additional list of either included or excluded repos in the probot config add that isn't accomplished by simply choosing which repos to install the app on? (I feel like I'm most certainly overlooking something, so am genuinely curious)

@hiimbex

hiimbex commented May 24, 2018

Copy link
Copy Markdown
Contributor

@willnorris the main reason for an include exclude list is that some apps (like stale) have power to take bulk action that may not be wanted on every single repo which is the reasoning for the opt out/opt in.

I think in this case however, there's a lot of folks who want only some of their repositories to have the app act on them. Therefore, I think we should move forward with an optOut list that includes only repositories you don't want the app to act on.

Unless the maintainer proactively updates the global config, this would create a race condition for new repos that do want to opt-out.

New repos are usually empty and without issues/PRs, which are usually things the apps need to act on, so I'm not super worried about this use case. I think the solution is being extremely explicit in our docs about the power of the .github repo.

Maybe something else we could do is rather than an opt-in list of repos, we have an opt-in list of repo patterns/regexes...if someone wants all, they can just use * to mark all of them.

I'm not opposed to this for the future, but I think v1.0 of org wide config should just be an opt out list.

@cco3
cco3 force-pushed the dotgithub-default branch from 5d48c70 to 6593b74 Compare May 24, 2018 18:48
@willnorris

willnorris commented May 24, 2018 •

Copy link
Copy Markdown

I was imagining that the org-wide config would be treated as a default, but not an automatically extended base config.

So if there is a repo config, then only that file applies. That file can choose to extend another config, but that doesn't happen automatically. If there is no repo config, then the org config applies if present.

You can achieve both opt-out and opt-in flows depending on how you name the config file in your org config.

Opt-out

# octocat/.github:stale.yml
daysUntilStale: 60
daysUntilClose: 7

# octocat/repo1
# no explicit .github/stale.yml file, so org config applies

# octocat/repo2:.github/stale.yml
# empty file.  opted out of org config

# octocat/repo3:.github/stale.yml
# explicitly extends base config, and overrides some values
_extends: octocat/.github/stale.yml
daysUntilStale: 30

Opt-in

To achieve opt-in, you simply rename the org-wide file, for example by prepending an underscore. This means that there technically isn't a default org-wide config that gets automatically applied, but there is a base file that can be extended on an opt-in basis.

# octocat/.github:_stale.yml
daysUntilStale: 60
daysUntilClose: 7

# octocat/repo1
# no explicit .github/stale.yml file, so the stale app never does anything

# octocat/repo2:.github/stale.yml
# explicitly extends base config, thereby opting in to the org-wide config.  
# Can optionally override values if desired
_extends: octocat/.github/_stale.yml

@cco3 reminded me that some apps might choke on the empty files, since they may be assuming that certain values are present. We'd need to double check that.

Would this cover the use cases people have in mind? (We walked through all of Google's use cases, and are pretty sure this covers ours)

@hiimbex

hiimbex commented May 24, 2018

Copy link
Copy Markdown
Contributor

The idea of renaming the org wide file and prepending it with a special character like an underscore had not occurred to me, and I really like it! 👍

But I'd like to hear some more feedbacks from other folks in @probot/maintainers about this topic, since there are so many different use cases for this.

@tcbyrd

tcbyrd commented May 28, 2018

Copy link
Copy Markdown

But I'd like to hear some more feedbacks from other folks in @probot/maintainers about this topic, since there are so many different use cases for this.

I feel like what's outlined in #7 (comment) is a pretty solid solution, given that it allows for an Org to explicitly opt-in or opt-out all its repositories to the config.

What worries me is we don't have any way to ensure the downstream repositories have access to view the default config. It's possible for an admin to configure permissions on the .github repository in a way that it's not even readable by others in the Org, which would mean a config can be applied to their repositories that they can't see (and therefore wouldn't know how to extend).

I'm not sure if there's a scalable way to enforce this at the moment, and I think it's an edge case, but we should at least write documentation to state that an admin should ensure that everyone in the Org has at least Read permission to the .github repository.

@willnorris

Copy link
Copy Markdown

I'm not sure if there's a scalable way to enforce this at the moment, and I think it's an edge case, but we should at least write documentation to state that an admin should ensure that everyone in the Org has at least Read permission to the .github repository.

Agreed. This sounds like an organizational problem that is outside the scope of probot (an org owner can do a LOT of things that individual repo admins can't control, far beyond just probot). But adding clear documentation of best practices sounds like a clear win.

@willnorris

Copy link
Copy Markdown

Someone else commented and then deleted their comment, but it raises a good point:

would this work for personal accounts, too? Say I’d create octocat/.github to see defaults for apps that I install, would that work?

Yes, I would certainly think that it should. I'm pretty sure the current implementation in the PR is agnostic to whether it's an org or user repo, but we should definitely verify that. I can't think of a good reason why this shouldn't also work for personal accounts.

@gr2m

gr2m commented May 29, 2018 •

Copy link
Copy Markdown
Contributor

It was me who commented 👋 I also think it’ll work :) I still see my comment here: https://github.com/probot/probot-config/pull/7/files#r191297970 But odd that the comment is not appearing in the PR timeline

GitHub
This change considers .github within the same org to be a default base repository if none is specified. This works even when no config file is specificed in the inheriting repository. Issue: #1 De...

@willnorris

Copy link
Copy Markdown

But odd that the comment is not appearing in the PR timeline

aha, found it. It's in the thread above 😄

@cco3

cco3 commented May 29, 2018

Copy link
Copy Markdown
Contributor Author

OK, I'll rework this change to conform to @willnorris's suggestion.

@cco3
cco3 force-pushed the dotgithub-default branch from 6593b74 to 9aede81 Compare May 29, 2018 19:23
@cco3

cco3 commented May 29, 2018

Copy link
Copy Markdown
Contributor Author

Change updated

@cco3

cco3 commented Jun 12, 2018

Copy link
Copy Markdown
Contributor Author

Friendly ping. Does this change look alright? Anything I should change?

@hiimbex

hiimbex commented Jun 12, 2018

Copy link
Copy Markdown
Contributor

Sorry for the delay! I'd love to see a more extensive documentation update according to what we've discussed here and would be happy to help with that if necessary. I think the examples outlined in #7 (comment) are a great starting point for this.

@cco3

cco3 commented Jun 12, 2018 •

Copy link
Copy Markdown
Contributor Author

OK, I'll add something. All the functionality has been described in the README, so at this point we are talking about offering recipes for common problems. I'm not sure whether or not this should go in its own section. I'll write something up, but feel free to chime in if you have opinions.

@hiimbex

hiimbex commented Jun 12, 2018

Copy link
Copy Markdown
Contributor

I agree since this is pretty major, it might warrant it's only section, to be as clear as possible.

@cco3

cco3 commented Jun 13, 2018 •

Copy link
Copy Markdown
Contributor Author

OK, well this is a good exercise, because as I write it, I realize that specifying the path of an inherited file wasn't already part of the functionality. How would we prefer to do this?

Like @willnorris said: _extends: octocat/.github/_stale.yml

Or we could standardize on the _ prefix and say that an explicit _extends declaration to a .github project will look for the file with a prepended _. I.e.,

_extends: .github

We'd be introducing something mildly backwards incompatible given that the previous change would use this and grab a file without an underscore, but I'm not sure if that's a major concern since that was never in a versioned release.

@cco3

cco3 commented Jun 14, 2018

Copy link
Copy Markdown
Contributor Author

OK, I think using syntax similar to what @willnorris suggested would be best, given that one may want to have several alternative configurations at different paths in a .github project.

Anyway, I've put up another change at #8 for this.

@bkeepers bkeepers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I really like this approach, and agree we can solve the bulk actions issue with documentation.

Thanks @cco3 and @willnorris for pushing us toward this solution.

@cco3

cco3 commented Jun 14, 2018

Copy link
Copy Markdown
Contributor Author

Thanks!

This isn't ready to merge just yet:

  1. I was going to add a recipes section as @hiimbex requested.
  2. It turns out opt-in doesn't work yet (I didn't realize custom paths weren't supported). I've added a change for this (Allow specifying custom file paths #8)

@cco3
cco3 force-pushed the dotgithub-default branch from 9aede81 to 388a0af Compare June 14, 2018 23:34
@hiimbex

hiimbex commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

I was going to add a recipes section

That can maybe wait for a followup PR? It would be nice to get this merged so folks can start testing it out and reporting back any issues. :)

@cco3

cco3 commented Jun 22, 2018

Copy link
Copy Markdown
Contributor Author

Out of date comment, sorry. It's already written at this point.

@hiimbex

hiimbex commented Jun 22, 2018 •

Copy link
Copy Markdown
Contributor

So is this ready to 🚢 from your perspective @cco3 ?

This change considers `.github` within the same org to be a default
base repository if none is specified.  This works even when no config
file is specificed in the inheriting repository.
@cco3
cco3 force-pushed the dotgithub-default branch from 388a0af to 8caa44b Compare June 22, 2018 18:57
@cco3

cco3 commented Jun 22, 2018

Copy link
Copy Markdown
Contributor Author

Yes, just rebased it on the other change...good to go.

@hiimbex
hiimbex merged commit def82e6 into probot:master Jun 22, 2018
@hiimbex

hiimbex commented Jun 22, 2018

Copy link
Copy Markdown
Contributor

Thanks so much for your work on this @cco3! I'm excited to see organizational level config become easier through probot 🎉

@cco3

cco3 commented Jun 22, 2018

Copy link
Copy Markdown
Contributor Author

No problem! Happy to help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants