#variant (2019-02)
Discuss variant (the “Universal CLI”) https://github.com/mumoshu/variant
Archive: https://archive.sweetops.com/variant/
2019-02-05

This feature will reduce repetitions in your script
s
https://github.com/mumoshu/variant/issues/53
I tend to organize my variant scripts to the "header" and the "body" like seen in the following example: script: | # header {{ $env := get "environment" }} {{ $state :… |

that’s awesome!

also, like that you support a list under script

are those ultimately joined as one script or each run in their own shell?

the former, to cover reuses of both bash variable/func definitions, and template variables!

yea, makes sense

So that you can create a common config file that is versioned and reused in various variant commands in divergent places. tasks: mytask: parameters: - name: config type: object script: | cat <&l… |

this!!

I want.

basically we can create a variant library, then create a cli that imports various capabiltiies

for example, we can create a helm
lib, and a helmfile
lib and a kops
lib and a terraform
lib with useful tricks

e.g. for terraform, automating force-unlock

then in the final implementation, we can include the libs that we want into our cli. for example, one customer might not use kops
, so we wouldn’t need to import that lib.

So that you can create a common/library variant commands to be versioned and reused. tasks: anothercmd: # Basically runs go-getter [github.com/foo/bar?ref=v0.1.0//dir](http://github.com/foo/bar?ref=v0.1.0//dir) /tmp/somewhere
and then inclu…

so cool


@mumoshu I am trying to run an interactive SSH session inside of variant, should that work?

+ ssh -A [email protected]
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added 'bastion.us-west-2.staging.even.io,35.163.154.194' (ECDSA) to the list of known hosts.
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

interactive: true
should work
tasks:
foo:
interactive: true
script: |
whatever



hah! that worked, but got this


whoa! let me check

whats your variant’s version number?


Cloud Posse installer and distribution of native apps, binaries and alpine packages - cloudposse/packages

0.16.1

i will try the latest

reproducible in 0.18.0

in 0.18.0
I see some debug output

schema = map[type:object properties:map[] required:[]]

thanks! please try v0.18.2 that fixes the logging and the hanging


tasks:
# Connect to bastion instance
bastion:
description: "Connect to the bastion"
script: |
set -e
source <(chamber exec kops -- sh -c 'export -p')
eval $(ssh-agent -s)
ssh-add - <<<${KOPS_SSH_PRIVATE_KEY}
ssh -A admin@bastion.${KOPS_CLUSTER_NAME}
eval $(ssh-agent -k) >/dev/null


I love it!!!
mixins:
chamber: &chamber
source <(chamber exec kops -- sh -c 'export -p' 2>/dev/null)

Then anywhere I want chamber, I can just do this:
bastion:
description: "Connect to the bastion using ssh-agent forwarding"
interactive: true
script:
- *chamber
- |
set -e
eval $(ssh-agent -s)
ssh-add - <<<${KOPS_SSH_PRIVATE_KEY}
ssh -A admin@bastion.${KOPS_CLUSTER_NAME}
eval $(ssh-agent -k) >/dev/null

this is shell scripting on steroids


I tried to change the default runner by adding

runner:
command: "bash"
args: ["-ex", "-c"]

should that work?

(in the global scope)


what Add commands to easily rotate a kops cluster's ssh keys Add command to easily connect to a kops cluster Add command to see a kops plan why This are routine operations that are complicat…


@daveyu has joined the channel
2019-02-06

@michal.matyjek has joined the channel

@mallen has joined the channel

@Erik Osterman (Cloud Posse) wdyt? https://github.com/mumoshu/variant/issues/56
variant should provide a generic way to manage dependencies of your variant command: dependent: directories: - path: ./helmfile-libs/stable # multiple library helmfile.yaml files should be maintain…

Ahhh yes, ultimately this becomes an issue.

I would like to discuss some idea that @Igor Rodionov had today


btw: https://github.com/mumoshu/variant/issues/51 and https://github.com/mumoshu/variant/issues/52 has been resolved and included in variant v0.20.0 (haven’t done much testing yet. briefly verified to work with github sources though
So that you can create a common/library variant commands to be versioned and reused. tasks: anothercmd: # Basically runs go-getter [github.com/foo/bar?ref=v0.1.0//dir](http://github.com/foo/bar?ref=v0.1.0//dir) /tmp/somewhere
and then inclu…
So that you can create a common config file that is versioned and reused in various variant commands in divergent places. tasks: mytask: parameters: - name: config type: object script: | cat <&l… |
2019-02-07

Wrote up an another issue that fills one of big missing pieces(to me): https://github.com/mumoshu/variant/issues/57
This is even more experimental than other features :) variant should be able to manage package (direct) dependencies of your variant command, along with those of imported commands(=transitive depen…

@joshmyers has joined the channel

https://github.com/mumoshu/variant have any docs?
Write modern CLIs in YAML. Bash + Workflows + Dataflows + Dependency Injection, JSON Schema for inputs validation - mumoshu/variant

Liking it so far but having to dig through all the tests

Unfortunately the integration tests are the best documentation at this time. Fortunately there are a lot of examples there though!
2019-02-08

any contribution to docs is welcomed! (well, i’ll write more later :)

FYI: Trigger your Variant tasks via GitHub Actions https://github.com/mumoshu/github-actions/tree/master/variant
Contribute to mumoshu/github-actions development by creating an account on GitHub.

this is exciting!

github actions still don’t work on public projects, right?

Seems so. Unfortunately.


variant will be so awesome when they add support for public repos

run a pipeline locally as easily as remotely

I can see the action button on one the projects i’m contributor in. Not sure if I can use them. Maybe the repo owner has to be subscribed to the beta

@dennybaa has joined the channel

@richwine has joined the channel
2019-02-09
2019-02-13

@platinumnj has joined the channel
2019-02-14

set the channel description: Discuss variant (the “Universal CLI”) https://github.com/mumoshu/variant
2019-02-16

@nutellinoit has joined the channel