walter-cd / walter

Tiny deployment pipeline
http://walter-cd.net
Apache License 2.0
438 stars 39 forks source link

Support only_if to set condition to run command #84

Closed mizzy closed 9 years ago

mizzy commented 9 years ago

I'd like to run Walter on Wercker and my local machine with same pipeline.yml. But I don't like to run some commands locally. So I've written the setting like this.

pipeline:
  - stage_name: Put SSH public key
    stage_type: command
    command: if [ "$WERCKER" = "true" ]; then echo $DIGITALOCEAN_SSH_KEY_PUBLIC > $HOME/.ssh/id_rsa.pub; fi

This is so ugly. I'd like to write the setting like this.

pipeline:
  - stage_name: Put SSH public key
    stage_type: command
    command: echo $DIGITALOCEAN_SSH_KEY_PUBLIC > $HOME/.ssh/id_rsa.pub
    only_if: test "$WERCKER" = "true"

only_if takes a shell command and if the command returns exit status other than 0, walter does not run this command.

takahi-i commented 9 years ago

Cool!

takahi-i commented 9 years ago

Fixed with #91