Giter Site home page Giter Site logo

action-runner-userdata's Introduction

GitHub License GitHub Actions Workflow Status Static Badge

Self-hosted Runner Cloud-init User Data

Generates base64 encoded cloud-config user data for deploying a self-hosted GitHub Actions runner.


Usage

Minimal example using defaults with the required conditional inputs (repo and owner).

- name: Cloud-init user data for self-hosted runner
  id: cloud-config
  uses: rylabs-billy/action-runner-userdata@v1
  with:
    repo: postgres-cluster
    owner: rylabs-billy
  env:
    GH_TOKEN: ${{ secrets.GH_TOKEN }}

Minimal example with an organization scope.

- name: Cloud-init user data for self-hosted runner
  id: cloud-config
  uses: rylabs-billy/action-runner-userdata@v1
  with:
    scope: organization
    org: akamai-marketplace
  env:
    GH_TOKEN: ${{ secrets.GH_TOKEN }}

Advanced example using all inputs to customize the runner ./config.sh options, and passing the base64 encoded output to the next step.

on:
  push:
    branches:
      - main

jobs:
  self-hosted-runner:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 1

      - name: Generate cloud-init user data
        id: cloud-config
        uses: rylabs-billy/action-runner-userdata@v1
        with:
          scope: repository
          repo: postgres-cluster
          owner: rylabs-billy
          name: my_runner
          runnergroup: my_group
          labels: linode,cluster,dev,prod
          work: _work
          ephemeral: true
        env:
          GH_TOKEN: ${{ secrets.GH_TOKEN }}

     - name: Provision runner instance on Linode
       uses: linode/action-linode-cli@v1
       with:
        token: ${{ secrets.LINODE_TOKEN }}
       run: |
         linode-cli linodes create \
           --label linoderunner \
           --root_pass aComplex@Password \
           --region us-east \
           --type g6-standard-2 \
           --metadata.user_data "$USER_DATA"
       env:
         USER_DATA: ${{ toJson(steps.cloud-init.outputs.user-data) }}

Inputs

This GitHub Action takes the following inputs:

scope (required)

The scope of the runner. Can be for a single repository or for an organization. A repository scope (default) requires inputs for owner and repo.

Example: https://github.com/{owner}/{repo}

scope: repository
owner: {owner}
repo: {repo}

An organization scope requires the org input.

Example: https://github.com/{org}

scope: organization
org: {org}

name

Name of the runner. If provided then --replace option is added to replace any existing runner with the same name in order to avoid naming conflicts. Otherwise the action defaults to generating a unique name by appending a timestamp to the repo or organization names.

(default yyyy-mm-dd-hhmmss-<repo/org>)

runnergroup

Name of runner group to assign the runner in an organization.

(defaults to the default runner group)

labels

Custom lables to apply in addition to the defaults.

(default self-hosted,Linux,X64)

work

Relative work directory for the runner

(default _work)

ephemeral

Configure the runner to take only one job, and then un-configure after the job finishes. This is recommend for public runners on public repositories to avoid security risks.

(default true)

Outputs

user-data

Base64 encoded cloud-init user data. Provide this output as the user-data parameter for a cloud provider's metadata service.

Contributing

You want to improve action-runner-userdata! ๐Ÿ˜

Please open a GitHub issue to report bugs or suggest features, or follow the fork and pull model for open source contributions.

Warnings

GitHub runners will display warnings for inputs not specified in action.yml.

This action takes three inputs that are conditionally required depending on the value of scope. Those inputs are repo, owner, and org. Since they are conditionally dependent on the value of another input, statically defining them (each with its own description, default and required fields) would just add unnecessary bloat. For this reason they are intentionally excluded from action.yaml, which results in warnings such as the following:

Warning: Unexpected input(s) 'repo', 'owner', valid inputs are ['entryPoint', 'args', 'scope', 'name', 'runnergroup', 'labels', 'work', 'ephemeral']

These types of warnings can be ignored, as you will see them under normal usage. This action will error (not warn) if input requirements are not met. If it succeeds then everything should have worked properly.

For more information see:

action-runner-userdata's People

Contributors

rylabs-billy avatar

Watchers

 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.