#variant - February 2019

variantArchived
50 messages

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

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

February 2019
mumoshu
mumoshuover 7 years ago
This feature will reduce repetitions in your scripts 😉
https://github.com/mumoshu/variant/issues/53
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
that's awesome!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
also, like that you support a list under script
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
are those ultimately joined as one script or each run in their own shell?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
this!!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I want.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
basically we can create a variant library, then create a cli that imports various capabiltiies
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
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)
Erik Osterman (Cloud Posse)over 7 years ago
e.g. for terraform, automating force-unlock
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
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)
Erik Osterman (Cloud Posse)over 7 years ago
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
so cool
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
------------
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
@mumoshu I am trying to run an interactive SSH session inside of variant, should that work?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago

+ ssh -A <mailto:admin@bastion.us-west-2.staging.xxxxxxx.io|admin@bastion.us-west-2.staging.xxxxxxx.io>
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added '<http://bastion.us-west-2.staging.even.io|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.

Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago

       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
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
-------
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I love it!!!


mixins:
  chamber: &chamber
    source <(chamber exec kops -- sh -c 'export -p' 2>/dev/null)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
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
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
this is shell scripting on steroids
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
------
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I tried to change the default runner by adding
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago

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


Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
should that work?
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
(in the global scope)
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
my first advanced variant script:
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Dave Yu
Dave Yuover 7 years ago
@Dave Yu has joined the channel
Michal Matyjek
Michal Matyjekover 7 years ago
@Michal Matyjek has joined the channel
mallen
mallenover 7 years ago
@mallen has joined the channel
mumoshu
mumoshuover 7 years ago
@Erik Osterman (Cloud Posse) wdyt? https://github.com/mumoshu/variant/issues/56
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Ahhh yes, ultimately this becomes an issue.
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I would like to discuss some idea that @Igor Rodionov had today
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
I am afk, so will pick up later
mumoshu
mumoshuover 7 years ago
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
mumoshu
mumoshuover 7 years ago
Wrote up an another issue that fills one of big missing pieces(to me): https://github.com/mumoshu/variant/issues/57
joshmyers
joshmyersover 7 years ago
@joshmyers has joined the channel
joshmyers
joshmyersover 7 years ago
joshmyers
joshmyersover 7 years ago
Liking it so far but having to dig through all the tests
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
Unfortunately the integration tests are the best documentation at this time. Fortunately there are a lot of examples there though!
mumoshu
mumoshuover 7 years ago
any contribution to docs is welcomed! (well, i’ll write more later :)
mumoshu
mumoshuover 7 years ago
FYI: Trigger your Variant tasks via GitHub Actions
https://github.com/mumoshu/github-actions/tree/master/variant
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
this is exciting!
Erik Osterman (Cloud Posse)
Erik Osterman (Cloud Posse)over 7 years ago
github actions still don’t work on public projects, right?
dennybaa
dennybaaover 7 years ago
@dennybaa has joined the channel
richwine
richwineover 7 years ago
@richwine has joined the channel
platinumnj
platinumnjover 7 years ago
@platinumnj has joined the channel
erik
erikover 7 years ago
set the channel description: Discuss variant (the “Universal CLI”) https://github.com/mumoshu/variant

Archive: https://archive.sweetops.com/variant/
nutellinoit
nutellinoitover 7 years ago
@nutellinoit has joined the channel