prodda

command module
v0.0.0-...-04005c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2015 License: MIT Imports: 9 Imported by: 0

README

prodda Build Status

Prods tasks on schedule.

Overview

Tasks are scheduled using the extended cron syntax:

  • Full crontab specs e.g. "* * * * * ?"
  • Descriptors, e.g. "@midnight", "@every 1h30m"

API reference

Root Endpoint

The root endpoint for the API is at /api/v0. All endpoints are nested below this path.

Authentication and authorization

All API requests must be made using basic authentication e.g:

curl https://username:password@127.0.0.1/api/v0/

Tasks endpoint

The endpoint for managing tasks is found at /tasks/.

Get all tasks
curl -XGET /tasks/
Create new task

The contents of the request body for creating a new task must contain a schedule field, the contents of which must be valid cron syntax, as well as sufficient information to create or update a task. This additional information varies by task type; see supported tasks for further information.

curl -XPOST /tasks/ -d '{<task-body-as-json>}'
Get specific task
curl -XGET /tasks/:id
Update existing task

The contents of the request body for updates must contain a schedule field, the contents of which must be valid cron syntax. Updating attributes of a task is not currently supported - instead the recommended approach is to delete the task and create a new one with the desired attributes.

curl -XPUT /tasks/:id -d '{<updated-task-body-as-json>}'
Delete existing task
curl -XDELETE /tasks/:id

<a name="supported-tasks" Supported tasks

Prodda supports multiple task types.

Travis builds

All travis tasks require a travis token. This can be obtained via the following:

gem install travis && travis login && travis token

More detailed information can be found on the official travis blog.

Re-running an existing travis build

Re-running a specific travis build can be accomplished by creating a new task with the following body:

{
  "schedule":"15 03 * * *",
  "type": "travis-re-run",
  "token":"my-travis-token",
  "buildID":123456789
}

URL Get

A URL Get task is one which will perform an get request to the specified URL, logging the response and any errors encountered. The URL should be fully-formed, including the protocol.

Running a url-get task can be achieved by creating a task with the following body:

{
  "schedule":"15 03 * * *",
  "type": "url-get",
  "url": "http://localhost/"
}
No-op

A no-op task is one which will log its start and finish points, sleeping for a configurable duration in between.

The duration is optional; it will default to zero if not present. If it is present then it must comply with the time.ParseDuration specification:

ParseDuration parses a duration string.

A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m".

Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

Running a no-op task can be achieved by creating a task with the following body:

{
  "schedule":"15 03 * * *",
  "type": "no-op",
  "sleepDuration": "1m"
}

Supported Golang versions

The code is tested against the latest version of golang 1.4.

Getting the code

The develop branch is where active development takes place; it is not guaranteed that any given commit will be stable.

The master branch points to a stable commit. All tests should pass.

Dependency management

Dependencies are managed via godep. To ensure the dependencies are correct, run godep restore. Adding a new dependency requires running godep save; the resultant changes in the Godeps/ directory must be committed.

Git hooks

To set up git hooks, run the following command:

./scripts/install-git-hooks

This will need to be re-run if any new git hooks are added, but not if existing ones change.

Running tests

Running the tests will require ginkgo and gomega:

go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/ginkgo/gomega

In the cloned directory run the following command:

ginkgo -p -r -race -failOnPending -randomizeAllSpecs

Contributing

The upcoming work for prodda can be found on Pivotal Tracker.

Rull-requests are welcome; please make them against the develop branch. Please also include ginkgo tests. Multiple small commits are preferred over a single monolithic commit.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/onsi/ginkgo
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
_workspace/src/github.com/onsi/ginkgo/config
Ginkgo accepts a number of configuration options.
Ginkgo accepts a number of configuration options.
_workspace/src/github.com/onsi/ginkgo/ginkgo
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
_workspace/src/github.com/onsi/ginkgo/internal/remote
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
_workspace/src/github.com/onsi/ginkgo/reporters
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
Gomega's format package pretty-prints objects.
_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
Package gbytes provides a buffer that supports incrementally detecting input.
_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
Package gexec provides support for testing external processes.
_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
_workspace/src/github.com/onsi/gomega/matchers
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
_workspace/src/github.com/tedsuo/ifrit
A process model for go.
A process model for go.
_workspace/src/github.com/tedsuo/ifrit/fake_runner
fake_runner contains test fixtures.
fake_runner contains test fixtures.
_workspace/src/github.com/tedsuo/ifrit/ginkgomon
Ginkgomon provides ginkgo test helpers.
Ginkgomon provides ginkgo test helpers.
_workspace/src/github.com/tedsuo/ifrit/grouper
Grouper implements process orcestration.
Grouper implements process orcestration.
_workspace/src/github.com/tedsuo/ifrit/restart
The restart package implements common restart strategies for ifrit processes.
The restart package implements common restart strategies for ifrit processes.
_workspace/src/gopkg.in/robfig/cron.v2
Package cron implements a cron spec parser and runner.
Package cron implements a cron spec parser and runner.
api
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
middleware/fakes
This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter
v0

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL