Code Monkey home page Code Monkey logo

variant's Introduction

Why?

Automating DevOps workflows is difficult because it often involve multiple executables like shell/ruby/perl/etc scripts and commands.

Because those executables vary in

  • Its quality, from originally one-off script written in a day but living for several months or even years, to serious commands which are well-designed and written in richer programming languages with enough testing,
  • Its interface. Passing parameters via environment variables, application specific command-line flags, configuration files

writing a single tool which

  • wires up all the executables
  • re-implements all the things currently done in various tools

is both time-consuming.

What?

Variant is a framework to build a CLI application which becomes the single entry point to your DevOps workflows.

It consists of:

  • YAML-based DSL
    • to define a CLI app's commands, inputs
    • which allows splitting commands into separate source files, decoupled from each others
  • Ways to configure your apps written using Variant via:
    • defaults
    • environment variables
    • command-line parameters
    • application specific configuration files
    • environment specific configuration files
  • DI container
    • to implicitly inject required inputs to a commands from configuration files or outputs from another commands
    • to explicit inject inputs to commands and its dependencies via command-line parameters

Inputs

An input named myinput for the task mytask can be one of follows, in order of precedense:

  • Value of the command-line option --myinput
  • Value of the configuration variable mytask.myinput
    • from the environment specific config file: config/environments/<environment name>.yaml
    • from the common config file: <command name>.yaml(normally var.yaml)
  • Output of the task myinput

Using environments

You can switch environment (or context) in which a task is executed by running var env set <env name>.

$ var env set dev
$ var test
#=> reads inputs from var.yaml + config/environments/dev.yaml

$ var env set prod
$ var test
#=> reads inputs from var.yaml + config/environments/prod.yaml

Examples

Extract variant's version using jq:

$ var version --output json | jq -c -r 'select(.msg == "version") | .framework_version'
0.0.3-rc1

Similar projects

Interesting Readings

Future Goals

  • Runners to run tasks in places other than the host running your Variant app
    • Docker
    • Kubernetes
    • etc
  • Tools/instructions to package your Variant app for easier distribution
    • Single docker image containing
      • all the scripts written directly in the yaml
      • maybe all the scripts referenced from scripts in the yaml
      • maybe all the commands run via the host runner
  • Integration with job queues
    • to ensure your tasks are run reliably, at-least-once, tolerating temporary failures

License

Apache License 2.0

variant's People

Contributors

mumoshu avatar cw-ozaki avatar cw-kuoka avatar af12066 avatar toricls avatar

Watchers

James Cloos 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.