Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow workflow shell commands to be any (complex) shell commands #277

Merged
merged 3 commits into from Dec 15, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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