Skip to content

Commit 617d68f

Browse files
committed
docs: focus on kubernetes documentation
1 parent 3dbd5c8 commit 617d68f

2 files changed

Lines changed: 6 additions & 23 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ on:
1111
pull_request:
1212

1313
env:
14+
GITHUB_REPO: ${{ secrets.REPO }} # Should be a private repository, see https://help.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners
15+
TOKEN: ${{ secrets.TOKEN }} # Personal Access Token used to register and deregister runners. GITHUB_TOKEN isn't good for most use cases because it is only valid for one hour.
1416
GCP_PROJECT: ${{ secrets.GCP_PROJECT }}
1517
GKE_CLUSTER: self-hosted-runner-test-cluster
1618
GKE_SECRETS: self-hosted-runner-creds
1719
GCP_REGION: us-west1
1820
IMAGE: self-hosted-runner
19-
GITHUB_REPO: ${{ secrets.REPO }} # should be a private repository, see https://help.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners
20-
TOKEN: ${{ secrets.TOKEN }} # Personal Access Token used to register and deregister runners. GITHUB_TOKEN isn't good for most use cases because it is only valid for one hour.
2121

2222
jobs:
2323
# Test and build

README.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
# GitHub Actions Self Hosted Runners on Anthos
22

3-
This project shows an _example_ configuration and usage of GitHub Actions self hosted runners on Anthos, using the [self hosted runners API](https://developer.github.com/v3/actions/self_hosted_runners/). Under active development 🧪.
3+
> An _example configuration and usage_ of GitHub Actions [self hosted runners](https://help.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) on [Anthos GKE](https://cloud.google.com/anthos/gke). Under active development 🧪.
44
55
A Continuous Integration [job](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobs) builds the image and publishes it to Google Container Registry, and a Continuous Deployment job deploys it to Google Kubernetes Engine (GKE). The self hosted runners in this cluster are made available to the GitHub repository configured via the `GITHUB_REPO` environment variable below.
66

7-
## Usage
7+
## Setup
88

9-
### Local
10-
11-
#### Setup
12-
13-
Set these in an `.env` file at the top level. Inject these into the Docker container at runtime; do _not_ check them in to Git in plaintext.
14-
* `GITHUB_REPO` - repository to allow to use the self hosted runner (eg. `octocat/spoon-knife`)
15-
* `TOKEN`: [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) or [OAuth app token](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/) with `administration` permission, which is necessary for interacting with the [Self Hosted Runner API](https://developer.github.com/v3/actions/self_hosted_runners/). [`GITHUB_TOKEN`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) does not have `administration` permission.
16-
17-
#### Run Docker container
18-
* `docker build -t self-hosted-runner .`
19-
* `docker run --env-file=.env -v /var/run/docker.sock:/var/run/docker.sock self-hosted-runner` (Docker-in-Docker not recommended for production)
20-
21-
### Google Kubernetes Engine
22-
23-
#### Setup
249
* Create a new Google Cloud Platform project ([docs](https://cloud.google.com/sdk/gcloud/reference/projects/create))
2510

2611
```
@@ -71,12 +56,12 @@ gcloud container hub memberships register self-hosted-anthos-membership \
7156
gcloud container clusters get-credentials self-hosted-runner-test-cluster --region us-west1
7257
```
7358

74-
* Which repository or organization will your self hosted runners be available to? Use [Kubernetes secrets](https://kubernetes.io/docs/concepts/configuration/secret/) to make these environment variables available to your pods.
59+
* Use [Kubernetes secrets](https://kubernetes.io/docs/concepts/configuration/secret/) to provide a Personal Access Token (`TOKEN`) and repository/organization (`GITHUB_REPO`) as environment variables available to your pods.
7560

7661
```
7762
kubectl create secret generic self-hosted-runner-creds \
7863
--from-literal=GITHUB_REPO='https://github.com/<owner>/<repo>' \
79-
--from-literal=GITHUB_TOKEN='token'
64+
--from-literal=TOKEN='token'
8065
```
8166

8267
* Set these as secrets in your GitHub repository:
@@ -92,8 +77,6 @@ kubectl create secret generic self-hosted-runner-creds \
9277
* `IMAGE`: Name of your image used in [`ci.yml`](.github/workflows/ci.yml) and [`deployment.yml`](.github/workflows/deployment.yml)
9378
* `GITHUB_REPO`: `owner/repo` of the repository that will use the self hosted runner, eg. `octocat/sandbox`
9479

95-
* Update values in `deployment.yml` to reflect your image name and desired configuration
96-
9780
#### Automation
9881
* Upon push of any image-related code to any branch, [`ci.yml`](.github/workflows/ci.yml) will kick off to build and push the Docker image.
9982
* Upon push of any code to master branch, [`cd.yml`](.github/workflows/cd.yml) will kick off to deploy to Google Cloud.

0 commit comments

Comments
 (0)