recampbell - in regards your pondering of Org Unit vs. Groups - my feeling is that mapping groups from GSuite to Jenkins makes the most sense.
Org Units are much more limiting since a user only exists in a single Org Unit (although OUs are hierarchical).
If you look at how GCP (Google Cloud) works, they let you assign groups directly into the permissions lists - so I can have engineering-team-X@example.com
as a group with permissions on a given project etc.
The Google API for managing / querying users as groups is solid and well-documented - happy to discuss when you're available - you know where I am!
orrc - in regards your question about the API - the API is a bit finicky to setup initially.
You have two options for calling the API
- a service account with appropriate scopes / permissions assigned
- a set of OAuth tokens for the "Jenkins" (or app), those token can then be used to issue an OAuth request (with required scopes) - which is basically a URL that a human will click on to generate a token. That token is then used by the Jenkins / app to issue directory HTTP requests.
The guidance from Google is that you can't use hard-coded tokens in OSS products (so Jenkins can't have a set burned in) - my gut feeling is that the most expedient way for Jenkins to work would be for end-users to create service accounts (this is not a GSuite user, but essentially a set of tokens) with the correct scopes. The service account credentials would then be entered into Jenkins as another pair of credential fields.
This guide is the one I used - https://developers.google.com/admin-sdk/directory/v1/quickstart/go (There are Java versions of the same thing if that's more your style). The example uses the "app" style token setup (rather than service account style setup)
+1
Actually, I might have a worse problem: I installed and used the plugin for the first time today, and cannot find a way to avoid that everyone with a google account has access the jenkins instance. I tried playing with the 'Google Apps Domain' setting, but all I did was random attempts: I can't see on the Google Developers Console any value which has to do with a 'domain', so I have no clue how to use that setting.