Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/related-sciences/gce-github-runner
Ephemeral GCE/GCP GitHub self-hosted runner
https://github.com/related-sciences/gce-github-runner
actions gcp github-actions google-cloud-platform self-hosted-runner
Last synced: about 2 months ago
JSON representation
Ephemeral GCE/GCP GitHub self-hosted runner
- Host: GitHub
- URL: https://github.com/related-sciences/gce-github-runner
- Owner: related-sciences
- License: apache-2.0
- Created: 2021-06-28T14:25:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-13T13:58:29.000Z (about 1 year ago)
- Last Synced: 2024-04-14T04:05:20.008Z (9 months ago)
- Topics: actions, gcp, github-actions, google-cloud-platform, self-hosted-runner
- Language: Shell
- Homepage:
- Size: 35.2 KB
- Stars: 35
- Watchers: 5
- Forks: 33
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-runners - related-sciences/gce-github-runner - sciences/gce-github-runner.svg)](https://github.com/related-sciences/gce-github-runner/blob/main/LICENSE) [![GitHub contributors](https://img.shields.io/github/contributors/related-sciences/gce-github-runner.svg)](https://github.com/related-sciences/gce-github-runner/graphs/contributors/) [![GitHub Stars](https://img.shields.io/github/stars/related-sciences/gce-github-runner.svg)](https://github.com/related-sciences/gce-github-runner/stargazers/) [![GitHub issues](https://img.shields.io/github/issues/related-sciences/gce-github-runner.svg)](https://GitHub.com/related-sciences/gce-github-runner/issues/) [![GitHub issues-closed](https://img.shields.io/github/issues-closed/related-sciences/gce-github-runner.svg)](https://GitHub.com/related-sciences/gce-github-runner/issues?q=is%3Aissue+is%3Aclosed) | GCP GCE | ❌ | Repo | GitHub Actions workflow params | ✅ (1 runner per workflow run that requests it) | x86 | part of Actions workflow | no | yes (ephemeral) | no | embedded in GitHub Action workflow | possible | yes (Actions Workflow) | no | (The matrix (might be better readable on [GitHub pages](https://jonico.github.io/awesome-runners/)) / A word about self-hosted action runner images / virtual environments and how to test locally)
README
# gce-github-runner
[![awesome-runners](https://img.shields.io/badge/listed%20on-awesome--runners-blue.svg)](https://github.com/jonico/awesome-runners)
[![Pre-commit](https://github.com/related-sciences/gce-github-runner/actions/workflows/pre_commit.yml/badge.svg?branch=main)](https://github.com/related-sciences/gce-github-runner/actions/workflows/pre_commit.yml)
[![Test](https://github.com/related-sciences/gce-github-runner/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/related-sciences/gce-github-runner/actions/workflows/test.yml)Ephemeral GCE GitHub self-hosted runner.
## Usage
```yaml
jobs:
create-runner:
runs-on: ubuntu-latest
outputs:
label: ${{ steps.create-runner.outputs.label }}
steps:
- id: create-runner
uses: related-sciences/[email protected]
with:
token: ${{ secrets.GH_SA_TOKEN }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
image_project: ubuntu-os-cloud
image_family: ubuntu-2004-ltstest:
needs: create-runner
runs-on: ${{ needs.create-runner.outputs.label }}
steps:
- run: echo "This runs on the GCE VM"
```* `create-runner` creates the GCE VM and registers the runner with unique label
* `test` uses the runner
* the runner VM will be automatically shut down after the workflow via [self-hosted runner hook](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/running-scripts-before-or-after-a-job)## Inputs
See inputs and descriptions [here](./action.yml).
The GCE runner image should have at least:
* `gcloud`
* `git`
* (optionally) GitHub Actions Runner (see `actions_preinstalled` parameter)## Example Workflows
* [Test Workflow](./.github/workflows/test.yml): Test workflow.
## Self-hosted runner security with public repositories
From [GitHub's documentation](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners#self-hosted-runner-security-with-public-repositories):
> We recommend that you only use self-hosted runners with private repositories. This is because forks of your
> repository can potentially run dangerous code on your self-hosted runner machine by creating a pull request that
> executes the code in a workflow.## EC2/AWS action
If you need EC2/AWS self-hosted runner, check out [machulav/ec2-github-runner](https://github.com/machulav/ec2-github-runner).