Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Samra Belachew committed Oct 12, 2023
1 parent ef108a9 commit f313820
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/neptune/temporalworker/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ func (s Server) Start() error {
Interceptors: []interceptor.WorkerInterceptor{
temporal.NewWorkerInterceptor(),
},
EnableLoggingInReplay: true,
})
prWorker.RegisterActivity(s.GithubActivities)
prWorker.RegisterActivity(s.TerraformActivities)
Expand Down
8 changes: 8 additions & 0 deletions server/neptune/workflows/internal/notifier/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func (c *GithubCheckRunCache) CreateOrUpdate(ctx workflow.Context, deploymentID

// if we haven't created one, let's do so now
if !ok {
workflow.GetLogger(ctx).Info("cache before create", "cache", c.deploymentCheckRunCache)
resp, err := c.load(ctx, deploymentID, request)
if err != nil {
return 0, err
Expand All @@ -66,17 +67,20 @@ func (c *GithubCheckRunCache) CreateOrUpdate(ctx workflow.Context, deploymentID
if resp.ID != 0 {
c.deploymentCheckRunCache[key] = resp.ID
c.deleteIfCompleted(resp.Status, key)
workflow.GetLogger(ctx).Info("cache after create", "cache", c.deploymentCheckRunCache)
}

return resp.ID, nil
}

// update existing checks
workflow.GetLogger(ctx).Info("cache before update", "cache", c.deploymentCheckRunCache)
resp, err := c.update(ctx, deploymentID, request, checkRunID)
if err != nil {
return 0, err
}
c.deleteIfCompleted(resp.Status, key)
workflow.GetLogger(ctx).Info("cache after update", "cache", c.deploymentCheckRunCache)

return checkRunID, nil
}
Expand All @@ -102,7 +106,9 @@ func (c *GithubCheckRunCache) update(ctx workflow.Context, externalID string, re
}

var resp activities.UpdateCheckRunResponse
workflow.GetLogger(ctx).Info("executing update check run", "title", request.Title, "rev", request.Sha)
err := workflow.ExecuteActivity(ctx, c.activities.GithubUpdateCheckRun, updateCheckRunRequest).Get(ctx, &resp)
workflow.GetLogger(ctx).Info("update check run completed", "title", request.Title, "rev", request.Sha)
if err != nil {
return resp, errors.Wrapf(err, "updating check run with id: %d", checkRunID)
}
Expand All @@ -122,7 +128,9 @@ func (c *GithubCheckRunCache) load(ctx workflow.Context, externalID string, requ
}

var resp activities.CreateCheckRunResponse
workflow.GetLogger(ctx).Info("executing create check run", "title", request.Title, "rev", request.Sha)
err := workflow.ExecuteActivity(ctx, c.activities.GithubCreateCheckRun, createCheckRunRequest).Get(ctx, &resp)
workflow.GetLogger(ctx).Info("create check run completed", "title", request.Title, "rev", request.Sha)
if err != nil {
return resp, errors.Wrap(err, "creating check run")
}
Expand Down
1 change: 1 addition & 0 deletions server/neptune/workflows/internal/pr/revision/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func (p *Processor) awaitChildTerraformWorkflows(ctx workflow.Context, futures [
workflow.GetLogger(workflow.WithValue(ctx, internalContext.ErrKey, err)).Error("executing terraform workflow")
return
}
workflow.GetLogger(ctx).Info("child tf workflow ready", "id", resp.WorkflowState.ID)
results = append(results, resp)
})
}
Expand Down
1 change: 1 addition & 0 deletions server/neptune/workflows/internal/pr/revision/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func (s *StateReceiver) Notify(ctx workflow.Context, workflowState *state.Workfl
workflow.GetLogger(ctx).Warn(fmt.Sprintf("skipping notifying root %s", workflowState.ID))
return
}
workflow.GetLogger(ctx).Info("receiving state change signal", "root", rootInfo.Root.Name)

for _, notifier := range s.InternalNotifiers {
if err := notifier.Notify(ctx, rootInfo.ToInternalInfo(), workflowState); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions server/neptune/workflows/internal/terraform/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"github.com/runatlantis/atlantis/server/neptune/workflows/activities/conftest"
"net/url"
"strings"
"time"

key "github.com/runatlantis/atlantis/server/neptune/context"
Expand Down Expand Up @@ -145,6 +146,9 @@ func (r *Runner) Plan(ctx workflow.Context, root *terraform.LocalRoot, serverURL
if err := r.Store.UpdatePlanJobWithStatus(state.InProgressJobStatus); err != nil {
return response, newUpdateJobError(err, "unable to update job with in-progress status")
}
if strings.HasSuffix(root.Path, "simple") {
_ = workflow.Sleep(ctx, 20*time.Second)
}

response, err = r.JobRunner.Plan(ctx, root, jobID.String(), r.Request.WorkflowMode)

Expand Down

0 comments on commit f313820

Please sign in to comment.