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

Implement admin account syncing #7858

Merged
merged 7 commits into from
Jan 9, 2024
Merged

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Jan 3, 2024

This PR is based on #7852 and adds a background job that automatically syncs the users.is_admin column in the database with the team members of the crates-io-admins team on https://github.com/rust-lang/team/ (via https://team-api.infra.rust-lang.org/v1/teams/crates-io-admins.json).

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works A-backend ⚙️ labels Jan 3, 2024
@Turbo87 Turbo87 requested a review from a team January 3, 2024 13:46
@Turbo87 Turbo87 force-pushed the sync-admins branch 6 times, most recently from 5ea074d to 6e5223d Compare January 4, 2024 10:03
@Turbo87 Turbo87 marked this pull request as ready for review January 4, 2024 10:03
Copy link
Contributor

@LawnGnome LawnGnome left a comment

Choose a reason for hiding this comment

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

👍

I had a pretty good look at the syncing, and it looks good to me.

The one other question I have is: how do we get notified if the sync job fails? I'm conscious of JD's recent issue where it turned out some team sync actions hadn't been happening for a while — how noisy should we make it when the job fails, and similarly, how noisy should the job be when it actually changes something? Team membership changes don't happen very often, so I wonder if we should get notifications every time the job actually updates anything.

Cargo.toml Outdated
@@ -49,6 +49,7 @@ slow-tests = []
[dependencies]
anyhow = "=1.0.79"
async-trait = "=0.1.77"
mockall = "=0.12.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

I know the dependency table isn't completely ordered right now, but this should probably be somewhere with the other ms.

Copy link
Member Author

Choose a reason for hiding this comment

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

I honestly wonder why I put it there now... this was supposed to be sorted 😅

src/team_repo.rs Show resolved Hide resolved
@Turbo87 Turbo87 force-pushed the sync-admins branch 2 times, most recently from 72c189b to 58affde Compare January 8, 2024 12:00
@Turbo87
Copy link
Member Author

Turbo87 commented Jan 8, 2024

As discussed in the team meeting on friday, I've added background job deduplication. If a sync-admin job already exists in the queue then enqueue-job sync_admin will not add another one unless --force is used.

I've also added notification emails for all of the existing admins when new admins are added or admin access is revoked. Note that admins whose access is revoked will also get these emails, to avoid us unknowingly getting our access revoked by an attacker.

@LawnGnome @walterhpearce could you give this another round of review to see if the concerns are sufficiently addressed? 🙏

@bors
Copy link
Contributor

bors commented Jan 8, 2024

☔ The latest upstream changes (presumably 38d7a17) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@LawnGnome LawnGnome left a comment

Choose a reason for hiding this comment

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

That looks great. Thanks!

Cargo.toml Show resolved Hide resolved
@Turbo87 Turbo87 enabled auto-merge January 9, 2024 08:59
@Turbo87 Turbo87 merged commit d407029 into rust-lang:main Jan 9, 2024
6 checks passed
@Turbo87 Turbo87 deleted the sync-admins branch January 9, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants