-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Manage GitHub teams permissions as code #3998
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial feedback, what testing has been done on this?
...a/io/jenkins/infra/repository_permissions_updater/github_team_sync/GithubTeamDefinition.java
Outdated
Show resolved
Hide resolved
...a/io/jenkins/infra/repository_permissions_updater/github_team_sync/GithubTeamDefinition.java
Outdated
Show resolved
Hide resolved
...a/io/jenkins/infra/repository_permissions_updater/github_team_sync/GithubTeamDefinition.java
Outdated
Show resolved
Hide resolved
...a/io/jenkins/infra/repository_permissions_updater/github_team_sync/GithubTeamDefinition.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/infra/repository_permissions_updater/github_team_sync/TeamUpdater.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/infra/repository_permissions_updater/github_team_sync/TeamUpdater.java
Outdated
Show resolved
Hide resolved
src/main/java/io/jenkins/infra/repository_permissions_updater/github_team_sync/TeamUpdater.java
Outdated
Show resolved
Hide resolved
...ain/java/io/jenkins/infra/repository_permissions_updater/github_team_sync/YmlTeamLoader.java
Outdated
Show resolved
Hide resolved
repoPath = (String) data.get("github"); | ||
} | ||
|
||
if (data.containsKey("github_team")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we think we need to add this / need it as the only way?
teams are currently done by the repository name and should be easily determinable, (there may be some outliers though and where it might be good to be able to override this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, if a YAML file doesn't include github_team, I don't take any action.
If it does include github_team, I assume there's a unique team name like github_team: abc_team, and update the developers on that team.
However, based on your description, it seems uncommon to have a unique team name specified. Is it more common for github_team to be included without a specific name, meaning the team name would default to the repository name?
Also, if I have misunderstood anything in the first part, please correct me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will currently never include a GitHub team you will need to backfill those across the repository with this approach.
(not necessarily a bad thing)
Teams will almost always be unique per repository, occasionally there will be additional teams with access.
e.g. design-library-plugin has the sig-ux team with access.
and there will be other similar examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. design-library-plugin has the sig-ux team with access.
In particular, while most teams are ${repo}-developers
, there are some "special" teams spanning multiple repositories.
Also, I don't see where team repos are being managed, only team members. Would those special teams be excluded from management as code?
Similarly, this also hardcodes push
permission, when there are cases where the permissions should be different. Are those also excluded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest for non-schema based groups that in the future it is moved to an extra section called: custom-groups
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be done before go-live of the new solution, ideally as close to when the other solution is ready to merge in case changes occur again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've set up a new repository for the one-off backfill and updated the README with the current backfill logic and a few questions. When you have a moment, I'd appreciate it if you could take a look: https://github.com/Alaurant/OneOffSyncTool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extended Permissions
- You should be able to see all GitHub permissions with this report which might help with your permissions request: https://reports.jenkins.io/github-jenkinsci-permissions-report.json
Format
- I wouldn't use the empty string if you can't match a person:
github: ""
, just omit the key.
Clarification of Special Teams:
- I'm not sure what you mean by clarification of special teams, yes its name is
SIG: UX
Challenges with Multiple YAML Files for a Single Repository
- I think only one file should be managing the GitHub permissions ideally good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your patience in reading and responding. The permissions report will be helpful.
Format
Following your advice to omit the key, would the entries look like this?
- ldap: Alice
- github: Bob
- ldap: Chalie
github: Chalie
Clarification of Special Teams:
I appreciate your help on the "SIG: UX" clarification. Could you confirm if the following matches are correct?
- cloudbees-developers:
company-cloudbees-developers
- core:
Core
orCore PR Reviewers
? - security:
core-security-review
- openshift-developers: Which team corresponds to this in the provided image?
Thank you again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Yes entries would look like that
- yes cloudbees is company-cloudbees...
- core is Core
- I don't think security is core-security-review, they are separate
- there's no openshift-developers team in GitHub but I'm sure it would be a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unclear to me what this is trying to accomplish and why it is added to this repository.
- name: Build project | ||
run: mvn clean install | ||
|
||
- name: Update all yml files in permissions directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message appears to be misleading, as it claims to modify yml files, rather than use them as a reference (which seems to be what YmlTeamLoader#loadTeam
does).
id: files | ||
run: | | ||
echo "Checking for changes in permissions/*.yml files..." | ||
FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- 'permissions/*.yml') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This relies on every single execution being successful (assuming no infra trouble ever), which seems unsafe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a sweeper that runs once per week, I umm'ed and erred on this. Only operating on changes files will certainly be quicker, but why re-invent the wheel instead of using something like terraform which can maintain the state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't terraform be a bit over the top for this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its a standard infra as code tool, rather than re-implementing the wheel, it allows more people to collaborate especially from e.g. the infra team.
Co-authored-by: Tim Jacomb <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
Co-authored-by: Tim Jacomb <[email protected]>
This Pull Request enhances the process for managing team permissions. It automates the synchronization of team data, ensuring our GitHub records are always up-to-date.
Key Features
Repository Permission Updates: Once the PR is merged, it updates the team and sends an invitation if needed.
Automatic Sync: it runs every week to ensure the files’ data is in sync with the live data on GitHub.