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

[JENKINS-34835] Authorities from team slug #124

Merged
merged 3 commits into from Nov 27, 2021

Conversation

MancunianSam
Copy link
Contributor

I've put the commits against JENKINS-34835 as the issue is still open. There was a PR #116 for this which gets the team based on the slug if it's set but the authorities list, which you can see if you go to /whoAmI, is still using the team name so if I set the team using org*slug in global security, I'm no longer allowed access.

PR jenkinsci#116 loads the team based on the slug if it's available but the
authorities list is still using the team name.
This means that you can set the team in the matrix in global security
but you will then be denied access because the authorities list uses the
team name.
You can see this if you go to /whoAmI The team name is shown against the
user.
The GithubAuthenticationToken constructor now uses the github team slug
if it's set. I've updated the tests so the slug is set here as well.

I haven't included a separate test for having a team slug set vs not
having it set but I can add that in if it's needed.
@MancunianSam MancunianSam changed the title Authorities from team slug [JENKINS-34835] Authorities from team slug Jan 19, 2021
@kumadee
Copy link

kumadee commented Jan 20, 2021

It will really great if this PR is merged and released with the new version of the plugin. I was facing this issue yesterday and figured out the root-cause by trial and error.

suzannehamilton added a commit to nationalarchives/tdr-jenkins that referenced this pull request Feb 26, 2021
We are using our own fork of this plugin until the change to allow
teams by slug is merged into the main repo:
jenkinsci/github-oauth-plugin#124

Including this plugin in the list causes the build to fail because
it's been built manually.
@samrocketman
Copy link
Member

@kumadee apologies for the delay. I've been on a bit of a hiatus but I'm going to start ramping up contributions to Jenkins again. I'll start by reviewing pull requests for github-oauth-plugin and try to address them (feedback or merge, etc)

Thanks for contributing; this has been something on my TODO and I know users want this.

@MancunianSam
Copy link
Contributor Author

@samrocketman @basil I've updated this branch with the latest from master and the checks are failing. I've looked at the logs and it looks like SIGTERM is being sent on each build and I can't see why. The Windows build has dependency errors but the dependencies it says are missing but which I can see in the repository.

Do you know if there is a known issue with the builds failing like this or is this something I need to fix?

@basil basil added the bug label Nov 3, 2021
Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

Incremental build 0.35-rc429.8f7e6fa35ad6 is available for testing. The incremental build is available from: https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/github-oauth/0.35-rc429.8f7e6fa35ad6/

@MancunianSam @apemberton @kumadee Can you please test the incremental build and confirm the issue is resolved? For instructions on how to install a custom build, see: https://www.jenkins.io/doc/book/managing/plugins/#advanced-installation

@MancunianSam
Copy link
Contributor Author

@basil I've tested the incremental build and the issue is fixed, thanks.

@basil basil merged commit fcf8b77 into jenkinsci:master Nov 27, 2021
@basil
Copy link
Member

basil commented Nov 27, 2021

Released in 0.35.

@thatsmydoing
Copy link

I know the plugin is still 0.x and I should always read changelogs, but better messaging about this change would have been appreciated (I remember some plugin updates have big warnings on in the update screen). There's a potential to lock yourself out if you already had setup the authorization to work using team names instead of slugs.

@basil
Copy link
Member

basil commented Dec 10, 2021

Hi @thatsmydoing, thanks for the note. I don't actually use this plugin, and really only got involved with maintaining this plugin to deliver a fix required for the core Guava update, so it's possible I didn't fully understand the impact when merging and releasing this PR. Since you use this plugin, would you be willing to write a short blurb about upgrading? I would be happy to update the GitHub releases page with whatever you write.

@thatsmydoing
Copy link

Ah, I see. I was hoping for something like

BREAKING CHANGE group authorization changed from github team names to team slugs

When restricting access via groups (with for example, matrix-based security), and your github team names don't match team slugs (if they contain spaces for example), make sure to add another set of grants using the github team slug prior to upgrading otherwise you could potentially lock yourself out of Jenkins. After upgrading, it should be safe to remove the old github team name grants.

For example, if admin access is granted to the team "Jenkins Admin" with slug jenkins-admin, you might have org*Jenkins Admin as the group name currently. You would need to make sure to also have the same grants for org*jenkins-admin to ensure access after upgrading. After upgrading, it should be safe to remove the org*Jenkins Admin grant.

@basil
Copy link
Member

basil commented Dec 10, 2021

Thank you @thatsmydoing. I updated the release notes with the information you provided.

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