Skip to content

Commit

Permalink
Allow workflow shell commands to be any (complex) shell commands (#277)
Browse files Browse the repository at this point in the history
Co-authored-by: Andriy Knysh <aknysh@users.noreply.github.com>
  • Loading branch information
stoned and aknysh committed Dec 15, 2022
1 parent 608fe65 commit 30663dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/exec/worflow.go
Expand Up @@ -101,7 +101,7 @@ func ExecuteWorkflowCmd(cmd *cobra.Command, args []string) error {
return err
}

err = executeWorkflowSteps(workflowDefinition, dryRun, commandLineStack)
err = executeWorkflowSteps(workflow, workflowDefinition, dryRun, commandLineStack)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions internal/exec/worflow_utils.go
Expand Up @@ -8,10 +8,10 @@ import (
u "github.com/cloudposse/atmos/pkg/utils"
)

func executeWorkflowSteps(workflowDefinition cfg.WorkflowDefinition, dryRun bool, commandLineStack string) error {
func executeWorkflowSteps(workflow string, workflowDefinition cfg.WorkflowDefinition, dryRun bool, commandLineStack string) error {
var steps = workflowDefinition.Steps

for _, step := range steps {
for stepIdx, step := range steps {
var command = strings.TrimSpace(step.Command)
var commandType = strings.TrimSpace(step.Type)

Expand All @@ -22,8 +22,8 @@ func executeWorkflowSteps(workflowDefinition cfg.WorkflowDefinition, dryRun bool
}

if commandType == "shell" {
args := strings.Fields(command)
if err := ExecuteShellCommand(args[0], args[1:], ".", []string{}, dryRun, true); err != nil {
commandName := fmt.Sprintf("%s-step-%d", workflow, stepIdx)
if err := ExecuteShell(command, commandName, ".", []string{}, dryRun, true); err != nil {
return err
}
} else if commandType == "atmos" {
Expand Down

0 comments on commit 30663dd

Please sign in to comment.