githubtraining / training-manual

Home of the words in the GitHub Training Manual and teaching scripts.
https://githubtraining.github.io/training-manual
Creative Commons Attribution 4.0 International
267 stars 266 forks source link

Training scripts on GHEC #406

Open edinc opened 10 months ago

edinc commented 10 months ago

Hello,

Has anyone tried running the scripts to generate the repositories on an GHEC instance? I have an SSO account and a organisation (with Owner privileges), but somehow it still doesn't work. I have created a PAT Token and authorised it for SAML single sign-on. Tried providing both api.github.com and github.com/enterprises/<customer-name> in the .trainingmanualrc file. When running the 'Confirm Setup' step, this is what I get:

Checking if  is accessible via the API...
Can't access the organization via the API.

Is it even possible to run the scripts on GHEC or I need to follow the steps from the README regarding GitHub Enterprise Server?

amyschoen commented 10 months ago

I have a local branch where I've been working on it, but I haven't uploaded any of it here yet. What kind of access are you setting up in your token? I've found that for ours, we need someone who has org admin level access because we need to be able to invite users into our training org in GHEC. I haven't had any difficulties accessing the API for our set up for GHEC.

amyschoen commented 10 months ago

Realized I should look at my .trainingmanualrc. I have this set for URLs:

export INSTANCE_URL='api.github.com'
export ROOT_URL='github.com'

I'd have to look at what changes I made specifically for GHEC since it's been a few months. I haven't contributed back yet because what I have is a bit hacky, and I want to clean things up first. I know when we worked on supporting both GHES and .com, there are conditionals that treat the two differently in some ways. As written, the scripts would treat GHEC as .com based on the base URLs which isn't always what we want. There are some subtleties, and GHEC does behave more like GHES.

edinc commented 10 months ago

Thank you for the input @amyschoen. I found a way with a small workaround.

Maybe this will help someone else who has issues setting up the training on GHEC.

amyschoen commented 10 months ago

What is your repo visibility @edinc? We don't allow public which is what was breaking repo generation via the scripts for me. My fix was to create repos as internal for GHEC.

Editing to add that I also needed to add logic to invite users to the org. Just need to get some time to do clean up before I can contribute my updates back.

edinc commented 10 months ago

The repo visibility was Internal. I reopened the Issue, you can link it together with you contributions when you open a PR 😃

amyschoen commented 10 months ago

I'll try to get my changes pushed here in early December even if it's just a branch so you can test if my changes work for your GHEC instance as well. Taking a lot of year-end PTO, so no promises on timeframe.