Giter Club home page Giter Club logo

myshoes's Introduction

myshoes: Auto scaling self-hosted runner for GitHub Actions

awesome-runners Go Reference test MIT License Go Report Card

Auto scaling self-hosted runner ๐Ÿƒ (like GitHub-hosted) for GitHub Actions!

Features

Setup (only once)

Please see Documents.

How to contribute

  1. Fork it
  2. Clone original repository git clone https://github.com/whywaita/myshoes
  3. Add remote your repository git remote add your-name https://github.com/${your-name}/myshoes
  4. Create your feature branch git switch -c my-new-feature
  5. Commit your changes git commit -am 'Add some feature'
  6. Push to the branch git push your-name my-new-feature
  7. Create new Pull Request

Publications

Talk

myshoes's People

Contributors

ak1ra24 avatar camonster avatar chez-shanpu avatar gamoutatsumi avatar jajimajp avatar jonico avatar site0801 avatar takonomura avatar whywaita avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

myshoes's Issues

Support multiple image ID

This project is great!
Thank you for developing it.

By the way, I would like to be able to change an image ID for each target.
Are there any plans to support multiple image ID?

API for operation

  • found dust runner #72
    • stadium has a runner, but not registered on GitHub
    • no events if not registered on GitHub, but need to delete runner
  • #91

use directory cache if already extracted

now, myshoes skip downloading runner's file if found cache.

elif [ -f "/usr/local/etc/${runner_file}" ]; then
echo "${runner_file} cache is found. skipping download."
mv /usr/local/etc/${runner_file} ./

But this logic executes gzip -d always. It has occurrs many i/o tasks.

So myshoes need to add directory cache that extracted gzip.

validate more in REST API

  • check permission before creating
    • need to error response if mistake token or scope
  • check status before deleting
    • maybe not delete runner if status is active

text file busy in remote provider

2021/04/20 19:20:40 failed to bung: failed to get plugin client: failed to get shoes client: fork/exec /tmp/shoes-lxd: text file busy

Input validator

  • Exist runner_version in update / create target
  • input github.com in ghe_domain

myshoes can't delete targets if runners is exist

mysql> delete from targets where uuid = "UUID";
ERROR 1451 (23000): Cannot delete or update a parent row: a foreign key constraint fails (`myshoes`.`runners`, CONSTRAINT `runners_ibfk_1` FOREIGN KEY (`target_id`) REFERENCES `targets` (`uuid`) ON DELETE RESTRICT)

Add parameter in target

  • runner version
    • Newest GitHub Runner can't run in the old GitHub Enterprise Server if broken backward compatibility.
  • provider URL
    • e.g.) /shoes-lxd

Move `ghe_domain` to Environment value

#61 changed the method of authentication.
one myshoes uses one GitHub Apps.

So, myshoes host only one ghe_domain.
targets table does not need to has a ghe_domain column.

The target error status is always overwritten to active by the lines below

for _, r := range sanitizedRunners {
if err := m.deleteRunner(ctx, client, r.ds, *r.github.ID, owner, repo, r.status); err != nil {
logger.Logf(false, "failed to delete runner: %+v\n", err)
if err := datastore.UpdateTargetStatus(ctx, m.ds, t.UUID, datastore.TargetStatusErr, ""); err != nil {
logger.Logf(false, "failed to update target status (target ID: %s): %+v\n", t.UUID, err)
}
continue
}
}
if err := datastore.UpdateTargetStatus(ctx, m.ds, t.UUID, datastore.TargetStatusActive, ""); err != nil {
logger.Logf(false, "failed to update target status (target ID: %s): %+v\n", t.UUID, err)
return fmt.Errorf("failed to update target status: %w", err)
}
return nil

When the deleteRunner function is failed, target status becomes "error", but the lines below (L179~182) always set the status as โ€‹"active".
Therefore the target status will be always "active" even though all the runner deletion was failed.

failed to get target from repo: %!w(<nil>) when already deleted

  • configure organization (example)
  • configure repository (example/repo)
  • delete repository (example/repo)

Correct

  • Use config for organization

Now

  • No queuing job and output error log
failed to process check_run event: failed to search registered target: failed to get target from repo: %!w(<nil>)

GetClient() call after getSetupScript()

client, teardown, err := shoes.GetClient()
if err != nil {
return "", "", "", fmt.Errorf("failed to get plugin client: %w", err)
}
defer teardown()
script, err := s.getSetupScript(ctx, target)
if err != nil {
return "", "", "", fmt.Errorf("failed to get setup scripts: %w", err)
}

Mode change API

#87 becomes checking registration before deleting a job.
But actions/runner has a problem with race. So myshoes needs API for mode chenge.

searchRepo return deleted target

func searchRepo(ctx context.Context, ds datastore.Datastore, gheDomain, repo string) (*datastore.Target, error) {

searchRepo() not check the status of the target.

  • registered scope repository octocat/example
  • registered scope organization octocat
  • delete scope repository octocat/example

So, searchRepo return octocat/example, but this target is deleted.

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.