$ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.7
go install mvdan.cc/gofumpt@latest
go install github.com/daixiang0/gci@latest
go run github.com/abcxyz/github-token-minter/cmd/minty@main \
private-key import \
-key=${KEY_NAME} \
-key-ring=${KEY_RING_NAME} \
-project-id=${PROJECT_ID} \
-private-key=@${KEY_FILE_NAME}
You need a GitHub App in your GitHub org.
To do this go to your org settings page: https://github.com/organizations/${YOUR_ORG}/settings/profile
- Expand Developer settings (last option on left sidebar) and click GitHub Apps.
- Click "New GitHub App" on top right.
- Give your App a name and Homepage URL (it doesn't matter what you have there).
- Note where "Webhook" is. Uncheck "Active" for now, we will configure later.
- Expand "Repository Permissions". Add following:
- Actions: Read-only
- Administration: Read and Write
- Metadata: Read-Only
- Expand "Organization Permissions". Add following:
- Administration: Read and Write # TODO: is this needed?
- Self-hosted runners: Read and Write
- Click "Create GitHub App" at bottom of screen.
- Find your app listed in Developer Settings in your org settings page.
- Take note of App ID
- Click Edit
- Scroll down to almost the bottom for "Private Keys"
- Click "Generate a private key"
- A .pem file will be downloaded. This is a secret. Keep it safe.
Now that the GitHub App exists, it needs to be added to your org.
- Navigate to Org setting page https://github.com/organizations/${YOUR_ORG}/settings/profile
- Expand Developer settings (last option on left sidebar) and click GitHub Apps.
- Select Your App
- On the left bar, select "Install App"
- Select your org.
Prereqs: Sudoless docker installed. Not currently set up to work with GitHub Enterprise Server.
Now we have an app and a .pem key, we should be able to create JIT configs. These are one-time tokens that allow a runner to register itself with GitHub.
test_local.sh
is set up for this. You just need to change a few values in
the go run
command under # Generate JIT Config
:
- Set app-id to the app id found in Step 8. of GitHub App Creation.
- Set
private-key
to the path of your.pem
file you downloaded. - Set
org
to the name of your GitHub org. - Set
runner-group-id
to the value of your runner group. You can just use1
which is the default runner group added to each org.
Now run the script. You should see it build the image, then see output for runner startup and finally see it waiting for a request.
If this doesn't happen, something went wrong, you should figure it out before continuing.
TODO