max

command module
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2018 License: MIT Imports: 2 Imported by: 0

README

max Build Status Build status GoDoc Go Report Card

Max is a YAML-based task runner with Docker support.

Check out the examples.

Installation

go get -u github.com/frozzare/max

or using homebrew.

brew install frozzare/tap/max

Usage

Running max help will print help output.

Task help

$ max help [task]

Usage:

  max hello [name]

Summary:

  Hello task

Configuration

The default task is default

Default task can be changed by using MAX_DEFAULT_TASK environment variable.

$ MAX_DEFAULT_TASK=custom max

Task output

Starting and finished logs:

$ max hello
Starting task hello
Hello
Finished task hello

Minimal logs (quiet flag):

$ max hello -q
Hello
Basic task

Config

tasks:
  hello:
    summary: Hello task
    commands:
      - echo Hello

Output

$ max hello -q
Hello
Task with arguments

Config

tasks:
  hello:
    args:
      name: default
    summary: Hello task
    commands:
      - echo Hello {{ .name }}
    usage: "[--name]"

Output

$ max hello -q
Hello default

$ max hello -q --name max
Hello max
Task running other tasks

Config

tasks:
  hello:
    args:
      name: default
    summary: Hello task
    commands:
      - echo Hello {{ .name }}
  default:
    tasks:
      - hello

Output

$ max -q
Hello default

$ max default -q --name max
Hello max
Task with global arguments

Config

args:
  name: default

tasks:
  hello:
    summary: Hello task
    commands:
      - echo Hello {{ .name }}

Output

$ max hello -q
Hello default

$ max hello -q --name max
Hello max
Include task from other files.

Config max.yml

tasks:
  hello: !include hello.yml

Config hello.yml

args:
  name: default
summary: Hello task
commands:
  - echo Hello {{ .name }}

Output

$ max hello -q
Hello default

$ max hello -q --name max
Hello max

Docker

Tasks can be runned in docker images, you need to configure docker for each task.

Not tested with windows containers (yet, pull request?).

tasks:
  build:
    docker:
      image: golang:1.10
      volumes:
        - .:/go/src/app
      working_dir: /go/src/app
    commands:
      - go build -o main

Max file spec

The default file name is max.yml but you can specific another file by using the --config flag.

Other supported default files are:

  • max_windows.yml
  • max_linux.yml
  • max_darwin.yml
args: Global arguments that all tasks can use. Key/Value map that can be used with --key flag.
tasks:
  task: task id (os specific tasks can be loaded before real task id, e.g build_windows is loaded when build is called on windows)
    args: Arguments that all tasks can use. Key/Value map that can be used with --key flag.
    deps: [task] # task dependencies, e.g [build, that]
    dir: Custom directory to execute commands in. Default is where the max file is located.
    docker: # docker config
      auth: # private registry auth
        email:
        username:
        password:
      entrypoint: docker entrypoint
      image: docker image
      volumes:
        - single/multi-line array of docker volumes
      working_dir: docker working directory
    interval: task interval (cron format)
    summary: task summary
    tasks:
      - single/multi-line array of tasks to run
    commands:
      - single/multi-line array of commands to run (go text template)
      - access environment variables via $NAME
    status:
      - single/multi-line array of commands to run to test that the task is up to date.
      - (test -e main)
    usage: string of usage text, e.g "[--name]"

License

MIT © Fredrik Forsmo

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
examples
internal

Jump to

Keyboard shortcuts

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