-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Sample scripts to automate scaleable runners #427
Conversation
docs/automate.md
Outdated
|
||
### Step 1: export PAT | ||
|
||
Create a GitHub PAT and export it before running the script |
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.
We might want to clarify the scopes required for the PAT so that users don't have to look at the API docs to know. I also don't think we need to specify a "GitHub PAT".
Create a GitHub PAT and export it before running the script | |
Create a PAT with `repo` scopes for repo runners and `admin:org` scopes for org runners. Export this PAT as an environment variable before running the script. |
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.
Cool. Is there somewhere in docs that clarifies the minimum scopes? Ideally, I would just link to docs. But agreed, good addition.
@TingluoHuang - Josh looked and approved. Can you have a look? Or suggest someone else? I want to make sure these are ready to go with org level runner release. |
I verified on linux (Debian flavors) and osx with repo and org level ... |
base_api_url="https://api.github.com/repos" | ||
fi | ||
|
||
export RUNNER_TOKEN=$(curl -s -X POST ${base_api_url}/${runner_scope}/actions/runners/registration-token -H "accept: application/vnd.github.everest-preview+json" -H "authorization: token ${RUNNER_CFG_PAT}" | jq -r '.token') |
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.
in the error case, like my PAT doesn't have enough permission, will the customer have enough info to debug?
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 returns what the API returns since it's a simple script. I think it's fine unless you have something more elegant in mind. I don't think we can tell why it's access denied - it just is.
#-------------------------------------- | ||
# Remove the runner | ||
#-------------------------------------- | ||
curl -s -X DELETE ${base_api_url}/${runner_scope}/actions/runners/${runner_id} -H "authorization: token ${RUNNER_CFG_PAT}" |
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 need any preview HTTP header like application/vnd.github.everest-preview+json
?
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 think we're supposed to doing preview periods. https://developer.github.com/changes/2/#--creating-a-repository-dispatch-event-now-official-part-of-github-api
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.
the reason I asked is that you have the preview header in the get runner endpoint and get registration token endpoint call.
@TingluoHuang I addressed most feedback and left some comments and TODO for further work later. I think the scripts as is help get folks going (I know it would have helped with a few customers I interacted with directly this week). |
👉 overview here 👈