Skip to content

Commit

Permalink
Add CommentArgs to run step runner
Browse files Browse the repository at this point in the history
This should allow the extra args passed in the comment to be used by
run steps

This should resolve runatlantis#670
  • Loading branch information
rowleyaj committed Jun 30, 2019
1 parent 595e1d4 commit d7b81cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/events/runtime/run_step_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"

version "github.com/hashicorp/go-version"
"github.com/runatlantis/atlantis/server/events/models"
Expand All @@ -28,6 +29,7 @@ func (r *RunStepRunner) Run(ctx models.ProjectCommandContext, command string, pa
"BASE_BRANCH_NAME": ctx.Pull.BaseBranch,
"BASE_REPO_NAME": ctx.BaseRepo.Name,
"BASE_REPO_OWNER": ctx.BaseRepo.Owner,
"COMMENT_ARGS": strings.Join(ctx.CommentArgs, ","),
"DIR": path,
"HEAD_BRANCH_NAME": ctx.Pull.HeadBranch,
"HEAD_REPO_NAME": ctx.HeadRepo.Name,
Expand Down
5 changes: 5 additions & 0 deletions server/events/runtime/run_step_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func TestRunStepRunner_Run(t *testing.T) {
Command: "echo user_name=$USER_NAME",
ExpOut: "user_name=acme-user\n",
},
{
Command: "echo args=$COMMENT_ARGS",
ExpOut: "args=-target=resource1,-target=resource2\n",
},
}

projVersion, err := version.NewVersion("v0.11.0")
Expand Down Expand Up @@ -98,6 +102,7 @@ func TestRunStepRunner_Run(t *testing.T) {
RepoRelDir: "mydir",
TerraformVersion: projVersion,
ProjectName: c.ProjectName,
CommentArgs: []string{"-target=resource1", "-target=resource2"},
}
out, err := r.Run(ctx, c.Command, tmpDir)
if c.ExpErr != "" {
Expand Down

0 comments on commit d7b81cb

Please sign in to comment.