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

Support both "commands" and "command" key, of any type #104

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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