docker-archive / deploykit

A toolkit for creating and managing declarative, self-healing infrastructure.
Apache License 2.0
2.25k stars 262 forks source link

Callables #847

Closed chungers closed 6 years ago

chungers commented 6 years ago

This PR refactors the playbook implementation to make playbooks callable in a Go program.

This is useful to allow users to write their own Go programs and invoke playbooks that are normally invoked via the infrakit CLI (see examples/playbooks/aws -- to create ondemand or spot instances on AWS). This paves way to unify the playbook concept -- which are documents that dynamically drive the infrakit CLI -- and the upcoming libInfrakit Go API. It will be possible for users to develop or reuse working playbooks (for example a script that installs Docker over ssh) and write programs that can call the playbooks as black box functions which accept parameters (either via CLI flags or can be set programmatically).

For example of calling playbooks from Go program, see the pkg/callable/test directory for example playbooks. This playbook (at index.yml) can be added to the CLI and invoked in code (see pkg/callable/module_test.go).

Signed-off-by: David Chung david.chung@docker.com

codecov[bot] commented 6 years ago

Codecov Report

Merging #847 into master will increase coverage by 0.02%. The diff coverage is 24.32%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #847      +/-   ##
==========================================
+ Coverage   48.49%   48.52%   +0.02%     
==========================================
  Files          89       89              
  Lines        8009     8015       +6     
==========================================
+ Hits         3884     3889       +5     
- Misses       3769     3770       +1     
  Partials      356      356
Impacted Files Coverage Δ
pkg/callable/backend/ssh/script.go 1.21% <0%> (ø)
pkg/cli/playbook/modules.go 64.44% <75%> (+2.09%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fd9804a...2ef5dae. Read the comment docs.