Skip to content
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

Merged
merged 17 commits into from
Apr 17, 2020
Merged

Conversation

bryanmacfarlane
Copy link
Member

@bryanmacfarlane bryanmacfarlane commented Apr 15, 2020

👉 overview here 👈

docs/automate.md Outdated

### Step 1: export PAT

Create a GitHub PAT and export it before running the script
Copy link
Member

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".

Suggested change
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.

Copy link
Member Author

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.

@bryanmacfarlane bryanmacfarlane changed the title WIP: scripts to automate scaleable runners outside in Scripts to automate scaleable runners outside in Apr 16, 2020
@bryanmacfarlane
Copy link
Member Author

@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.

@bryanmacfarlane
Copy link
Member Author

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')
Copy link
Member

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?

Copy link
Member Author

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}"
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

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.

@bryanmacfarlane
Copy link
Member Author

@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).

@bryanmacfarlane bryanmacfarlane changed the title Scripts to automate scaleable runners outside in Sample scripts to automate scaleable runners Apr 16, 2020
@bryanmacfarlane bryanmacfarlane merged commit b2dcdc2 into master Apr 17, 2020
AdamOlech pushed a commit to antmicro/runner that referenced this pull request Jan 28, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants