Skip to content

Commit

Permalink
rename admin to adhoc for the new terraform mode stuff (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
smonero authored Mar 19, 2024
1 parent 2a0da82 commit b815a25
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion server/neptune/workflows/activities/terraform/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ type WorkflowMode int
const (
Deploy WorkflowMode = iota
PR
Admin
Adhoc
)
3 changes: 2 additions & 1 deletion server/neptune/workflows/internal/terraform/job/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package job

import (
"context"

"github.com/runatlantis/atlantis/server/neptune/workflows/activities/command"

key "github.com/runatlantis/atlantis/server/neptune/context"
Expand Down Expand Up @@ -215,7 +216,7 @@ func (r *JobRunner) apply(executionCtx *ExecutionContext, planFile string, step
}

func (r *JobRunner) plan(ctx *ExecutionContext, mode *terraform.PlanMode, workflowMode terraform.WorkflowMode, extraArgs []string) (activities.TerraformPlanResponse, error) {
if workflowMode == terraform.Admin {
if workflowMode == terraform.Adhoc {
// Admin mode doesn't need to run a plan.
return activities.TerraformPlanResponse{}, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (r *RootFetcher) Fetch(ctx workflow.Context) (*terraform.LocalRoot, func(wo
return nil, func(_ workflow.Context) error { return nil }, err
}

if r.Request.WorkflowMode == terraform.Admin {
if r.Request.WorkflowMode == terraform.Adhoc {
return fetchRootResponse.LocalRoot, func(c workflow.Context) error { return nil }, nil
}

Expand Down
5 changes: 3 additions & 2 deletions server/neptune/workflows/internal/terraform/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package terraform
import (
"context"
"fmt"
"github.com/runatlantis/atlantis/server/neptune/workflows/activities/conftest"
"net/url"
"time"

"github.com/runatlantis/atlantis/server/neptune/workflows/activities/conftest"

key "github.com/runatlantis/atlantis/server/neptune/context"
"go.temporal.io/api/enums/v1"
"go.temporal.io/sdk/client"
Expand Down Expand Up @@ -350,7 +351,7 @@ func (r *Runner) run(ctx workflow.Context) (Response, error) {
return Response{}, r.toExternalError(err, "running plan job")
}

if r.Request.WorkflowMode == terraform.Admin {
if r.Request.WorkflowMode == terraform.Adhoc {
return Response{}, nil
}

Expand Down
7 changes: 4 additions & 3 deletions server/neptune/workflows/internal/terraform/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"errors"
"fmt"
"github.com/runatlantis/atlantis/server/neptune/workflows/activities/conftest"
"net/url"
"testing"
"time"

"github.com/runatlantis/atlantis/server/neptune/workflows/activities/conftest"

"go.temporal.io/sdk/activity"
"go.temporal.io/sdk/client"

Expand Down Expand Up @@ -176,7 +177,7 @@ func testTerraformWorkflow(ctx workflow.Context, req request) (*response, error)
WorkflowMode: req.WorkflowMode,
}

if req.WorkflowMode == terraformModel.Admin {
if req.WorkflowMode == terraformModel.Adhoc {
tAct = nil
}

Expand Down Expand Up @@ -649,7 +650,7 @@ func TestSuccess_AdminMode(t *testing.T) {

// execute workflow
env.ExecuteWorkflow(testTerraformWorkflow, request{
WorkflowMode: terraformModel.Admin,
WorkflowMode: terraformModel.Adhoc,
})
assert.True(t, env.IsWorkflowCompleted())

Expand Down

0 comments on commit b815a25

Please sign in to comment.