#variant (2019-02)

https://github.com/mumoshu/variant

Discuss variant (the “Universal CLI”) https://github.com/mumoshu/variant

Archive: https://archive.sweetops.com/variant/

2019-02-16

nutellinoit avatar
nutellinoit
08:52:16 AM

@nutellinoit has joined the channel

2019-02-14

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
05:23:43 AM

@Erik Osterman (Cloud Posse) set the channel purpose: Discuss variant (the “Universal CLI”) https://github.com/mumoshu/variant

Archive: https://archive.sweetops.com/variant/

2019-02-13

platinumnj avatar
platinumnj
04:31:20 AM

@platinumnj has joined the channel

2019-02-09

2019-02-08

mumoshu avatar
mumoshu

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

mumoshu avatar
mumoshu

FYI: Trigger your Variant tasks via GitHub Actions https://github.com/mumoshu/github-actions/tree/master/variant

mumoshu/github-actions

Contribute to mumoshu/github-actions development by creating an account on GitHub.

1
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

this is exciting!

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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

antonbabenko avatar
antonbabenko

Seems so. Unfortunately.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

run a pipeline locally as easily as remotely

zadkiel.aharonian avatar
zadkiel.aharonian

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 avatar
dennybaa
12:19:19 PM

@dennybaa has joined the channel

richwine avatar
richwine
10:53:51 PM

@richwine has joined the channel

2019-02-07

mumoshu avatar
mumoshu

Wrote up an another issue that fills one of big missing pieces(to me): https://github.com/mumoshu/variant/issues/57

Experimental: Dependency Management(Packages) · Issue #57 · mumoshu/variant

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 avatar
joshmyers
09:23:20 AM

@joshmyers has joined the channel

joshmyers avatar
joshmyers
mumoshu/variant

Write modern CLIs in YAML. Bash + Workflows + Dataflows + Dependency Injection, JSON Schema for inputs validation - mumoshu/variant

joshmyers avatar
joshmyers

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

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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

2019-02-06

michal.matyjek avatar
michal.matyjek
05:14:47 PM

@michal.matyjek has joined the channel

mallen avatar
mallen
09:03:44 PM

@mallen has joined the channel

mumoshu avatar
mumoshu

@Erik Osterman (Cloud Posse) wdyt? https://github.com/mumoshu/variant/issues/56

Dependency Management(Versioned Directories) · Issue #56 · mumoshu/variant

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…

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Ahhh yes, ultimately this becomes an issue.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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

1
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

I am afk, so will pick up later

1
mumoshu avatar
mumoshu

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

Import variant commands from various versioned sources · Issue #51 · mumoshu/variant

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…

Import config files from various versioned sources · Issue #52 · mumoshu/variant
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-05

mumoshu avatar
mumoshu

This feature will reduce repetitions in your scripts https://github.com/mumoshu/variant/issues/53

Reusing only part(s) of scripts · Issue #53 · mumoshu/variant
I tend to organize my variant scripts to the &quot;header&quot; and the &quot;body&quot; like seen in the following example: script: # header {{ $env := get &quot;environment&quot; }} {{ $state :…
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

that’s awesome!

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

also, like that you support a list under script

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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

mumoshu avatar
mumoshu

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

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

yea, makes sense

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
Import config files from various versioned sources · Issue #52 · mumoshu/variant
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…
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

this!!

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

I want.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

e.g. for terraform, automating force-unlock

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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.

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
Import variant commands from various versioned sources · Issue #51 · mumoshu/variant

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…

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

so cool

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
+ ssh -A [[email protected]](mailto:[email protected]\.us\-west\-2\.staging\.xxxxxxx\.io)
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added '[bastion.us-west-2.staging.even.io](http://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.

mumoshu avatar
mumoshu

interactive: true should work

tasks:
  foo:
    interactive: true
    script: |
      whatever
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
02:45:11 AM
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

hah! that worked, but got this

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

mumoshu avatar
mumoshu

whoa! let me check

mumoshu avatar
mumoshu

whats your variant’s version number?

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

(variant version empty)

1
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
cloudposse/packages

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

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

0.16.1

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

i will try the latest

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

reproducible in 0.18.0

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

in 0.18.0 I see some debug output

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
schema = map[type:object properties:map[] required:[]]
mumoshu avatar
mumoshu

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

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

ALL FIXED!

1
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
       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 [email protected]${KOPS_CLUSTER_NAME}
              eval $(ssh-agent -k) >/dev/null
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

I love it!!!

mixins:
  chamber: &chamber
    source <(chamber exec kops -- sh -c 'export -p' 2>/dev/null)
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

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 [email protected]${KOPS_CLUSTER_NAME}
              eval $(ssh-agent -k) >/dev/null
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

this is shell scripting on steroids

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

I tried to change the default runner by adding

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
runner:
  command: "bash"
  args: ["-ex", "-c"]


Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

should that work?

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

(in the global scope)

Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)

my first advanced variant script:

1
Erik Osterman (Cloud Posse) avatar
Erik Osterman (Cloud Posse)
[kopsctl] add commands to facilitate management of cluster by osterman · Pull Request #378 · cloudposse/geodesic

what Add commands to easily rotate a kops cluster&#39;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…

:1000:1
daveyu avatar
daveyu
04:37:18 AM

@daveyu has joined the channel

    keyboard_arrow_up