Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #104 from readysettech/command-list
Browse files Browse the repository at this point in the history
Support both "commands" and "command" key, of any type
  • Loading branch information
adikari authored Nov 3, 2022
2 parents c6b6c78 + 2900bd4 commit af5ff8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ type Step struct {
Trigger string `yaml:"trigger,omitempty"`
Label string `yaml:"label,omitempty"`
Build Build `yaml:"build,omitempty"`
Command string `yaml:"command,omitempty"`
Command interface{} `yaml:"command,omitempty"`
Commands interface{} `yaml:"commands,omitempty"`
Agents Agent `yaml:"agents,omitempty"`
Artifacts []string `yaml:"artifacts,omitempty"`
RawEnv interface{} `json:"env" yaml:",omitempty"`
Expand Down Expand Up @@ -172,7 +173,7 @@ func appendEnv(watch *WatchConfig, env map[string]string) {
watch.Step.Build.Env, _ = parseEnv(watch.Step.Build.RawEnv)

for key, value := range env {
if watch.Step.Command != "" {
if watch.Step.Command != nil || watch.Step.Commands != nil {
if watch.Step.Env == nil {
watch.Step.Env = make(map[string]string)
}
Expand Down
10 changes: 10 additions & 0 deletions tests/command.bats
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ EOM
"config": {
"trigger": "markdown-pipeline"
}
},
{
"path": "bat-service/",
"config": {
"command": ["echo one", "echo two"]
}
}
]
}
Expand Down Expand Up @@ -206,6 +213,9 @@ steps:
soft_fail:
- exit_status: 1
- exit_status: "255"
- command:
- echo one
- echo two
- wait
- command: echo "hello world"
- command: cat ./foo-file.txt
Expand Down

0 comments on commit af5ff8d

Please sign in to comment.