Rename reserved keyword commands to script

A change in the plugin API from 0.4 to 0.5 makes the commands keyword in the build config a reserved keyword and needs to be changed.
This commit is contained in:
Morgan Kesler 2016-08-26 23:02:45 -04:00
parent f158947913
commit eb5a5e2378
4 changed files with 9 additions and 9 deletions

View File

@ -11,7 +11,7 @@ The following parameters are used to configure the plugin:
* **key** - private SSH key for the remote machine * **key** - private SSH key for the remote machine
* **sleep** - sleep for seconds between host connections * **sleep** - sleep for seconds between host connections
* **timeout** - timeout for the tcp connection attempt * **timeout** - timeout for the tcp connection attempt
* **commands** - list of commands to execute * **script** - list of commands to execute
The following secret values can be set to configure the plugin. The following secret values can be set to configure the plugin.
@ -50,7 +50,7 @@ pipeline:
host: foo.com host: foo.com
user: root user: root
port: 22 port: 22
commands: script:
- echo hello - echo hello
- echo world - echo world
``` ```
@ -67,7 +67,7 @@ pipeline:
user: root user: root
port: 22 port: 22
sleep: 5 sleep: 5
commands: script:
- echo hello - echo hello
- echo world - echo world
``` ```

View File

@ -44,7 +44,7 @@ docker run --rm \
-e PLUGIN_HOST=foo.com \ -e PLUGIN_HOST=foo.com \
-e PLUGIN_USER=root \ -e PLUGIN_USER=root \
-e PLUGIN_KEY="$(cat ${HOME}/.ssh/id_rsa)" \ -e PLUGIN_KEY="$(cat ${HOME}/.ssh/id_rsa)" \
-e PLUGIN_COMMANDS=whoami \ -e PLUGIN_SCRIPT=whoami \
-v $(pwd)/$(pwd) \ -v $(pwd)/$(pwd) \
-w $(pwd) \ -w $(pwd) \
plugins/ssh plugins/ssh

View File

@ -51,9 +51,9 @@ func main() {
EnvVar: "PLUGIN_TIMEOUT,SSH_TIMEOUT", EnvVar: "PLUGIN_TIMEOUT,SSH_TIMEOUT",
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
Name: "commands", Name: "script",
Usage: "execute commands", Usage: "execute commands",
EnvVar: "PLUGIN_COMMANDS,SSH_COMMANDS", EnvVar: "PLUGIN_SCRIPT,SSH_SCRIPT",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "env-file", Name: "env-file",
@ -79,7 +79,7 @@ func run(c *cli.Context) error {
Port: c.Int("port"), Port: c.Int("port"),
Sleep: c.Int("sleep"), Sleep: c.Int("sleep"),
Timeout: c.Duration("timeout"), Timeout: c.Duration("timeout"),
Commands: c.StringSlice("commands"), Script: c.StringSlice("script"),
}, },
} }

View File

@ -19,7 +19,7 @@ type (
Port int `json:"port"` Port int `json:"port"`
Sleep int `json:"sleep"` Sleep int `json:"sleep"`
Timeout time.Duration `json:"timeout"` Timeout time.Duration `json:"timeout"`
Commands []string `json:"commands"` Script []string `json:"script"`
} }
Plugin struct { Plugin struct {
@ -70,7 +70,7 @@ func (p Plugin) Exec() error {
session.Stdout = os.Stdout session.Stdout = os.Stdout
session.Stderr = os.Stderr session.Stderr = os.Stderr
if err := session.Run(strings.Join(p.Config.Commands, "\n")); err != nil { if err := session.Run(strings.Join(p.Config.Script, "\n")); err != nil {
return err return err
} }