Code Monkey home page Code Monkey logo

strider-simple-runner's Introduction

strider-simple-runner

Worker Picture

Easy-to-configure in-process runner implementation for Strider Continous Deployment. This runner comes bundled with Strider.

Build Status

Spec

require('strider-simple-runner').create(emitter, config, done)

Config

All options are optional.

pty(false):              use 'pty' for running commands. Currently disabled
logger(console):         .log, .warn, .error
io(new EventEmitter):    the channel of internal communication with the job worker
processJob(core.process):function to run a job. (task, config, ondone)
pluginDirs:              the directories in which to look for plugins
dataDir($HOME/.strider): the directory in which to clone/test/etc
concurrentJobs(1):       maximum number of jobs to execute at once

Events

Expected to consume

  • 'job.new'
{
  id: Oid,
  type: 'TEST_ONLY' | 'TEST_AND_DEPLOY',
  user_id: Oid,
  trigger: {
  },
  ref: {
    branch: String,
    id: String // commit id
  },
  // this stuff is not part of the "job" document in mongo, but is added
  project: {
    // project config straight from db, includes plugin config and
    // project level provider config
  },
  userProvider: { // user-level config for the provider. Things like a github
  }               // OAuth token. Retrieved from user.providers.[providerid]
}

Ex: github provider config

{
  id: 'github',
  user: {
    token: '1234',
    username: 'hacker'
  },
  project: {
    url: 'example.com/repo.git',
    display_url: 'http://example.com/repo',
    auth: {
      method: 'https',
      username: null, // use user's gh auth
      password: null // use user's gh token
    }
  }
}

Ex: git provider config

{
  id: 'git',
  user: {},
  project: {
    url: 'example.com/repo.git',
    method: 'ssh',
    privkey: null, // use repo-level ssh keys
    pubkey: null
  }
}

Project config looks like:

{
  name: 'owner/name',
  public: false,
  active: true,
  deploy_on_green: true,
  secret: // what's this for?
  runner: {
    id: 'simple', // or docker, etc.
    pty: false
    // other config for the runner
  },
  privkey: '',
  pubkey: '',
  provider: {}, // provider config
  // owner is implicit, as it's embedded ...
  collaborators: [],
  plugins: [{
    id: 'heroku',
    // plugin config
  }, ...]
}

Plugins needed:

  • heroku
  • webhooks

Providers:

  • git
  • github

Tests

Strider-simple-runner comes with tests. To run, simply execute npm test.

License

Strider-simple-runner is released under a BSD license.

Credits

Picture of worker ant CC-BY myprofe from http://www.flickr.com/photos/myprofe/5883651745/sizes/m/in/photostream/

strider-simple-runner's People

Contributors

alagopus avatar dependabot[bot] avatar jaredly avatar kfatehi avatar kinya-terasaka-visasq avatar knownasilya avatar michaelmior avatar niallo avatar oliversalzburg avatar peterbraden avatar smashwilson avatar watson avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

strider-simple-runner's Issues

can't update

Clicking the update button in the Strider UI, I get:

warning: Could not find remote branch 0.15.0 to clone.
fatal: Remote branch 0.15.0 not found in upstream origin

Pleas create the 0.15.0 tag

Builds hang

Something strange is happening on https://hosted.stridercd.com:

Builds for project "strider" will run once, and then never run again. They hang in gitStep somewhere.

However, this doesn't happen locally on OS X and doesn't seem to happen with any other projects.

Possible memory leak with EventEmitter

Some why I get this kind of error log. Should we increase emitter MaxListeners or is this causes by some other reason ?

2015-02-01T20:33:13.518Z - info: [runner:simple-runner] Job started. Project: test/test Job ID: 54ce8d8375d06fe50f1819a0
2015-02-01T20:33:13.522Z - error: (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
2015-02-01T20:33:13.524Z - error: Trace
    at EventEmitter.growListenerTree (/test/strider/node_modules/eventemitter2/lib/eventemitter2.js:206:23)
    at EventEmitter.on (/test/strider/node_modules/eventemitter2/lib/eventemitter2.js:366:24)
    at Object.Job.listen (/test/strider/node_modules/strider-simple-runner/node_modules/strider-runner-core/lib/job.js:113:13)
    at Object.Job (/test/strider/node_modules/strider-simple-runner/node_modules/strider-runner-core/lib/job.js:57:8)
    at Object.processBuildJob [as processJob] (/test/strider/node_modules/strider-simple-runner/node_modules/strider-runner-core/lib/index.js:9:13)
    at /test/strider/node_modules/strider-simple-runner/lib/index.js:345:21
    at /test/strider/node_modules/strider-simple-runner/lib/index.js:264:7
    at /test/strider/node_modules/strider-simple-runner/node_modules/async/lib/async.js:190:13
    at /test/strider/node_modules/strider-simple-runner/node_modules/async/lib/async.js:94:25
    at /test/strider/node_modules/strider-simple-runner/node_modules/async/lib/async.js:187:17
    at /test/strider/node_modules/strider-simple-runner/node_modules/async/lib/async.js:459:34
    at /test/strider/node_modules/strider-simple-runner/lib/index.js:254:15
    at handler (/test/strider/node_modules/strider-simple-runner/lib/index.js:28:10)
    at module.exports.init (/test/strider/node_modules/strider-email-notifier/worker.js:3:12)
    at /test/strider/node_modules/strider-simple-runner/lib/index.js:257:35
    at /test/strider/node_modules/strider-simple-runner/node_modules/async/lib/async.js:454:21
2015-02-01T20:33:13.546Z - info: Git Version:1.8

For jobs data directory keeper is not branch aware and count is not configurable on ui

When deploying new builds sometimes it is beneficial to keep job data. As an example when you run a test deployment on test server you want to keep old data files so application keep running even though new builds are deployed. This can be mitigated by increasing count in keeper on jobs init dirs.

However another issue with this is when there are multiple branches one active branch would starve count in keeper, so branch deployment that you want to keep might also be deleted. Here is an example:

Project with multiple branches:
master
newFeature
anotherFeature
development

If count is 4, and if there were one deployment for newFeature, and anotherFeature, having 4 builds in development would destroy builds that you want to keep.

While development branch having new commits, it is very likely that you are testing newFeature branch and committing there as well.

Expected working of keeper is to be branch aware and keep 'count' old builds for each branch as users wish.

split into two modules

I think there ought to be a strider-worker-core module that contains the logic for gitane, pty, etc, and then strider-simple-worker would just be a thin shell around it. This way we could have consistency across different worker implementations; strider-worker-core could be used by strider-remote-worker and strider-docker-worker, etc.

Use --recursive for `git clone`

As requested by @peterbraden, simple worker should support sub-modules.

We can do this by using the --recursive flag.

May break on older versions of git, but not worrying about that for us right now.

Is this repo still alive?

A strider Dockerfile I found on google did a npm i strider-simple-worker here on my server and there is a npm@1... in your package.json which is really old.

--> How do you feel about putting a message in your README explaining that the strider-simple-worker is old?

Tests appear to be currently broken

Not sure if its just for me, but I get the following when running "npm test"

1..9
ok 1 JobData with a job get should retrieve the job
ok 2 JobData with a job pop should retrieve and remove the job
ok 3 JobData with a job listeners should propagate to the job
RUNNER INIT
ok 4 Runner should listen for job.new
RUNNER INIT
not ok 5 Runner with a few queued jobs cancelJob should cancel a queued job
  TypeError: Cannot call method 'some' of undefined
      at Object.Runner.plugins (/Users/adam/projects/strider/strider-simple-runner/lib/index.js:242:30)
      at jobDirsReady (/Users/adam/projects/strider/strider-simple-runner/lib/index.js:326:12)
      at /Users/adam/projects/strider/strider-simple-runner/lib/index.js:97:5
      at /Users/adam/projects/strider/strider-simple-runner/node_modules/async/lib/async.js:190:13
      at /Users/adam/projects/strider/strider-simple-runner/node_modules/async/lib/async.js:116:25
      at /Users/adam/projects/strider/strider-simple-runner/node_modules/async/lib/async.js:187:17
      at /Users/adam/projects/strider/strider-simple-runner/node_modules/async/lib/async.js:491:34
      at /Users/adam/projects/strider/strider-simple-runner/node_modules/mkdirp/index.js:38:26
      at Object.oncomplete (fs.js:107:15)
RUNNER INIT
ok 6 Runner with a few queued jobs cancelJob should pass on the cancel event if the job is not queued
ok 7 utils ensureCommand when there are no commands should create a command if there were none
ok 8 utils ensureCommand when the last command is not completed should not add a command
ok 9 utils ensureCommand when the last command has completed should add a command
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

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.