Git Product home page Git Product logo

self_hosted_runner's Introduction

Self-hosted Runner

GitHub Actions Self-hosted Runner running on AWS CodeBuild

System Configuration

インストール済

  • awscli
  • docker
  • github-cli

動作確認済み

  • actions/checkout@v2
  • actions/github-script@v2
  • aws-actions/configure-aws-credentials@v1
  • ruby/setup-ruby@v1

GitHub Actions

Inputs

  1. personal-access-token (required) : GitHub Personal access token
  2. project-name (optional) : AWS CodeBuild Project Name, Defaults to SelfHostedRunner
  3. compute-type-override (optional) : AWS CodeBuild Compute Type, Defaults to BUILD_GENERAL1_SMALL
  4. additional-label (optional) : Self-hosted Runner additional label, Defaults to runner

Outputs

  1. aws-build-id : AWS CodeBuild Build ID

Example

steps:
  - uses: aws-actions/configure-aws-credentials@v1
    with:
      aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
      aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      aws-region: ap-northeast-1
  - uses: rvillage/self_hosted_runner@v1-beta
    id: setup
    with:
      personal-access-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
  - run: echo ${{ steps.setup.outputs.aws-build-id }}

Setup

AWS

  1. .deploy/cloud_formation/codebuild.ymlでCloudFormationスタックの作成
  2. docker imageのビルドしてECRにプッシュ
DOCKER_BUILDKIT=1 docker build -t xxx.dkr.ecr.ap-northeast-1.amazonaws.com/self_hosted_runner:latest -f Dockerfile .
docker push xxx.dkr.ecr.ap-northeast-1.amazonaws.com/self_hosted_runner:latest
  1. IAMユーザgithub-actions-userのアクセスキーをGitHubリポジトリに設定
  2. RunnerToken発行用のPersonal access tokenをGitHubリポジトリに設定
  3. .github/workflows/test.ymlの作成
jobs:
  setup:
    runs-on: ubuntu-20.04
    steps:
      - uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ap-northeast-1
      - uses: rvillage/self_hosted_runner@v1-beta
        with:
          personal-access-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

  first_job:
    needs: setup
    runs-on: [self-hosted, runner, "${{ github.run_id }}"]
    steps:
      - run: echo "Hello SelfHostedRunner!"

Local

  1. (初回のみ) docker imageのビルド
DOCKER_BUILDKIT=1 docker build -t local/runner -f Dockerfile .
docker-compose up --no-start
  1. (初回のみ) docker-compose.yml.sampleからdocker-compose.ymlにコピーしてenvを設定
  2. 起動
docker-compose start runner && docker-compose logs -f runner
  1. 停止
docker-compose stop runner
  1. クリーンアップ
docker-compose down --volumes

self_hosted_runner's People

Contributors

rvillage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.