diff --git a/server/controllers/events/events_controller.go b/server/controllers/events/events_controller.go index 40768fc845..8bc7854e8f 100644 --- a/server/controllers/events/events_controller.go +++ b/server/controllers/events/events_controller.go @@ -302,7 +302,6 @@ func (e *VCSEventsController) Post(w http.ResponseWriter, r *http.Request) { e.respond(w, logging.Debug, http.StatusBadRequest, "Ignoring request since not configured to support GitLab") return } - e.Logger.Debugf("handling GitLab post") e.handleGitlabPost(w, r) return } else if r.Header.Get(bitbucketEventTypeHeader) != "" { @@ -313,7 +312,6 @@ func (e *VCSEventsController) Post(w http.ResponseWriter, r *http.Request) { e.respond(w, logging.Debug, http.StatusBadRequest, "Ignoring request since not configured to support Bitbucket Cloud") return } - e.Logger.Debugf("handling Bitbucket Cloud post") e.handleBitbucketCloudPost(w, r) return } else if r.Header.Get(bitbucketServerRequestIDHeader) != "" { @@ -321,7 +319,6 @@ func (e *VCSEventsController) Post(w http.ResponseWriter, r *http.Request) { e.respond(w, logging.Debug, http.StatusBadRequest, "Ignoring request since not configured to support Bitbucket Server") return } - e.Logger.Debugf("handling Bitbucket Server post") e.handleBitbucketServerPost(w, r) return } @@ -330,7 +327,6 @@ func (e *VCSEventsController) Post(w http.ResponseWriter, r *http.Request) { e.respond(w, logging.Debug, http.StatusBadRequest, "Ignoring request since not configured to support AzureDevops") return } - e.Logger.Debugf("handling AzureDevops post") e.handleAzureDevopsPost(w, r) return } @@ -348,11 +344,9 @@ func (e *VCSEventsController) handleBitbucketCloudPost(w http.ResponseWriter, r } switch eventType { case bitbucketcloud.PullCreatedHeader, bitbucketcloud.PullUpdatedHeader, bitbucketcloud.PullFulfilledHeader, bitbucketcloud.PullRejectedHeader: - e.Logger.Debugf("handling as pull request state changed event") e.handleBitbucketCloudPullRequestEvent(w, eventType, body, reqID, r) return case bitbucketcloud.PullCommentCreatedHeader: - e.Logger.Debugf("handling as comment created event") e.HandleBitbucketCloudCommentEvent(w, body, reqID, r) return default: @@ -384,11 +378,9 @@ func (e *VCSEventsController) handleBitbucketServerPost(w http.ResponseWriter, r } switch eventType { case bitbucketserver.PullCreatedHeader, bitbucketserver.PullMergedHeader, bitbucketserver.PullDeclinedHeader, bitbucketserver.PullDeletedHeader: - e.Logger.Debugf("handling as pull request state changed event") e.handleBitbucketServerPullRequestEvent(w, eventType, body, reqID, r) return case bitbucketserver.PullCommentCreatedHeader: - e.Logger.Debugf("handling as comment created event") e.HandleBitbucketServerCommentEvent(w, body, reqID, r) return default: @@ -403,7 +395,6 @@ func (e *VCSEventsController) handleAzureDevopsPost(w http.ResponseWriter, r *ht e.respond(w, logging.Warn, http.StatusUnauthorized, err.Error()) return } - e.Logger.Debugf("request valid") azuredevopsReqID := "Request-Id=" + r.Header.Get("Request-Id") event, err := azuredevops.ParseWebHook(payload) @@ -413,10 +404,8 @@ func (e *VCSEventsController) handleAzureDevopsPost(w http.ResponseWriter, r *ht } switch event.PayloadType { case azuredevops.PullRequestCommentedEvent: - e.Logger.Debugf("handling as pull request commented event") e.HandleAzureDevopsPullRequestCommentedEvent(w, event, azuredevopsReqID, r) case azuredevops.PullRequestEvent: - e.Logger.Debugf("handling as pull request event") e.HandleAzureDevopsPullRequestEvent(w, event, azuredevopsReqID, r) default: e.respond(w, logging.Debug, http.StatusOK, "Ignoring unsupported event: %v %s", event.PayloadType, azuredevopsReqID) @@ -556,17 +545,13 @@ func (e *VCSEventsController) handleGitlabPost(w http.ResponseWriter, r *http.Re e.respond(w, logging.Warn, http.StatusBadRequest, err.Error()) return } - e.Logger.Debugf("request valid") switch event := event.(type) { case gitlab.MergeCommentEvent: - e.Logger.Debugf("handling as comment event") e.HandleGitlabCommentEvent(w, event, r) case gitlab.MergeEvent: - e.Logger.Debugf("handling as pull request event") e.HandleGitlabMergeRequestEvent(w, event, r) case gitlab.CommitCommentEvent: - e.Logger.Debugf("comments on commits are not supported, only comments on merge requests") e.respond(w, logging.Debug, http.StatusOK, "Ignoring comment on commit event") default: e.respond(w, logging.Debug, http.StatusOK, "Ignoring unsupported event") diff --git a/server/controllers/github_app_controller.go b/server/controllers/github_app_controller.go index e6e61099eb..cdd55ceb86 100644 --- a/server/controllers/github_app_controller.go +++ b/server/controllers/github_app_controller.go @@ -54,7 +54,6 @@ func (g *GithubAppController) ExchangeCode(w http.ResponseWriter, r *http.Reques g.respond(w, logging.Debug, http.StatusOK, "Ignoring callback, missing code query parameter") } - g.Logger.Debugf("Exchanging GitHub app code for app credentials") creds := &vcs.GithubAnonymousCredentials{} // TODO: unify this in a single inject.go file @@ -72,8 +71,6 @@ func (g *GithubAppController) ExchangeCode(w http.ResponseWriter, r *http.Reques return } - g.Logger.Debugf("Found credentials for GitHub app %q with id %d", app.Name, app.ID) - err = templates.GithubAppSetupTemplate.Execute(w, templates.GithubSetupData{ Target: "", Manifest: "", diff --git a/server/controllers/locks_controller.go b/server/controllers/locks_controller.go index 4f569900e2..5cd9c34d9a 100644 --- a/server/controllers/locks_controller.go +++ b/server/controllers/locks_controller.go @@ -147,8 +147,6 @@ func (l *LocksController) DeleteLock(w http.ResponseWriter, r *http.Request) { if err = l.VCSClient.CreateComment(lock.Pull.BaseRepo, lock.Pull.Num, comment, ""); err != nil { l.Logger.Warnf("failed commenting on pull request: %s", err) } - } else { - l.Logger.Debugf("skipping commenting on pull request and deleting workspace because BaseRepo field is empty") } l.respond(w, logging.Info, http.StatusOK, "Deleted lock id %q", id) } diff --git a/server/core/config/valid/global_cfg.go b/server/core/config/valid/global_cfg.go index 3c249b028d..5aa3fe05f8 100644 --- a/server/core/config/valid/global_cfg.go +++ b/server/core/config/valid/global_cfg.go @@ -2,13 +2,11 @@ package valid import ( "fmt" - "regexp" - "strings" - "github.com/graymeta/stow" "github.com/graymeta/stow/s3" version "github.com/hashicorp/go-version" "github.com/runatlantis/atlantis/server/logging" + "regexp" ) const MergeableApplyReq = "mergeable" @@ -236,7 +234,6 @@ func (g GlobalCfg) PlatformModeEnabled() bool { // MergeProjectCfg merges proj and rCfg with the global config to return a // final config. It assumes that all configs have been validated. func (g GlobalCfg) MergeProjectCfg(log logging.SimpleLogging, repoID string, proj Project, rCfg RepoCfg) MergedProjectCfg { - log.Debugf("MergeProjectCfg started") var applyReqs []string var workflow Workflow var pullRequestWorkflow Workflow @@ -261,7 +258,6 @@ func (g GlobalCfg) MergeProjectCfg(log logging.SimpleLogging, repoID string, pro switch key { case ApplyRequirementsKey: if proj.ApplyRequirements != nil { - log.Debugf("overriding server-defined %s with repo settings: [%s]", ApplyRequirementsKey, strings.Join(proj.ApplyRequirements, ",")) applyReqs = proj.ApplyRequirements } case WorkflowKey: @@ -279,7 +275,6 @@ func (g GlobalCfg) MergeProjectCfg(log logging.SimpleLogging, repoID string, pro if w, ok := rCfg.Workflows[name]; allowCustomWorkflows && ok { workflow = w } - log.Debugf("overriding server-defined %s with repo-specified workflow: %q", WorkflowKey, workflow.Name) } case PullRequestWorkflowKey: if proj.PullRequestWorkflowName != nil { @@ -288,8 +283,6 @@ func (g GlobalCfg) MergeProjectCfg(log logging.SimpleLogging, repoID string, pro pullRequestWorkflow = w } } - - log.Debugf("overriding server-defined %s with repo-specified pull_request_workflow: %q", PullRequestWorkflowKey, workflow.Name) case DeploymentWorkflowKey: if proj.DeploymentWorkflowName != nil { name := *proj.DeploymentWorkflowName @@ -297,19 +290,7 @@ func (g GlobalCfg) MergeProjectCfg(log logging.SimpleLogging, repoID string, pro deploymentWorkflow = w } } - - log.Debugf("overriding server-defined %s with repo-specified deployment_workflow: %q", DeploymentWorkflowKey, workflow.Name) } - log.Debugf("MergeProjectCfg completed") - } - - if g.PlatformModeEnabled() { - log.Debugf("final settings: %s: %s, %s: %s, %s: %s", - WorkflowKey, workflow.Name, DeploymentWorkflowKey, deploymentWorkflow.Name, PullRequestWorkflowKey, pullRequestWorkflow.Name) - - } else { - log.Debugf("final settings: %s: [%s], %s: %s", - ApplyRequirementsKey, strings.Join(applyReqs, ","), WorkflowKey, workflow.Name) } return MergedProjectCfg{ @@ -331,7 +312,6 @@ func (g GlobalCfg) MergeProjectCfg(log logging.SimpleLogging, repoID string, pro // DefaultProjCfg returns the default project config for all projects under the // repo with id repoID. It is used when there is no repo config. func (g GlobalCfg) DefaultProjCfg(log logging.SimpleLogging, repoID string, repoRelDir string, workspace string) MergedProjectCfg { - log.Debugf("building config based on server-side config") repo := g.foldMatchingRepos(repoID) mrgPrj := MergedProjectCfg{ diff --git a/server/core/runtime/apply_step_runner.go b/server/core/runtime/apply_step_runner.go index 1fc6830421..00a0432cd6 100644 --- a/server/core/runtime/apply_step_runner.go +++ b/server/core/runtime/apply_step_runner.go @@ -134,7 +134,6 @@ func (a *ApplyStepRunner) runRemoteApply( } // Start the async command execution. - prjCtx.Log.Debugf("starting async tf remote operation") inCh := make(chan string) defer close(inCh) outCh := a.AsyncTFExec.RunCommandAsyncWithInput(ctx, prjCtx, filepath.Clean(path), applyArgs, envs, tfVersion, prjCtx.Workspace, inCh) @@ -156,7 +155,6 @@ func (a *ApplyStepRunner) runRemoteApply( nextLineIsRunURL = true } else if nextLineIsRunURL { runURL = strings.TrimSpace(line.Line) - prjCtx.Log.Debugf("remote run url found, updating commit status") updateStatusF(models.PendingCommitStatus, runURL) nextLineIsRunURL = false } @@ -164,8 +162,6 @@ func (a *ApplyStepRunner) runRemoteApply( // If the plan is complete and it's waiting for us to verify the apply, // check if the plan is the same and if so, input "yes". if a.atConfirmApplyPrompt(lines) { - prjCtx.Log.Debugf("remote apply is waiting for confirmation") - // Check if the plan is as expected. planChangedErr = a.remotePlanChanged(string(planfileBytes), strings.Join(lines, "\n"), tfVersion) if planChangedErr != nil { @@ -177,12 +173,10 @@ func (a *ApplyStepRunner) runRemoteApply( continue } - prjCtx.Log.Debugf("plan generated during apply matches expected plan, continuing") inCh <- "yes\n" } } - prjCtx.Log.Debugf("async tf remote operation complete") output := strings.Join(lines, "\n") if planChangedErr != nil { updateStatusF(models.FailedCommitStatus, runURL) diff --git a/server/core/runtime/init_step_runner.go b/server/core/runtime/init_step_runner.go index 6a050c47e0..89e66b96a7 100644 --- a/server/core/runtime/init_step_runner.go +++ b/server/core/runtime/init_step_runner.go @@ -28,7 +28,6 @@ func (i *InitStepRunner) Run(ctx context.Context, prjCtx command.ProjectContext, // delete it as it probably has been created by a previous run of // terraform init if common.FileExists(terraformLockfilePath) && !terraformLockFileTracked { - prjCtx.Log.Debugf("Deleting `%s` that was generated by previous terraform init", terraformLockfilePath) delErr := os.Remove(terraformLockfilePath) if delErr != nil { prjCtx.Log.Infof("Error Deleting `%s`", lockFileName) diff --git a/server/core/runtime/plan_step_runner.go b/server/core/runtime/plan_step_runner.go index 305d4a5f97..69e23b59bd 100644 --- a/server/core/runtime/plan_step_runner.go +++ b/server/core/runtime/plan_step_runner.go @@ -50,7 +50,6 @@ func (p *PlanStepRunner) Run(ctx context.Context, prjCtx command.ProjectContext, planCmd := p.buildPlanCmd(prjCtx, extraArgs, path, tfVersion, planFile) output, err := p.TerraformExecutor.RunCommandWithVersion(ctx, prjCtx, filepath.Clean(path), planCmd, envs, tfVersion, prjCtx.Workspace) if p.isRemoteOpsErrorf(output, err) { - prjCtx.Log.Debugf("detected that this project is using TFE remote ops") return p.remotePlan(ctx, prjCtx, extraArgs, path, tfVersion, planFile, envs) } if err != nil { @@ -255,7 +254,6 @@ func (p *PlanStepRunner) runRemotePlan( } // Start the async command execution. - prjCtx.Log.Debugf("starting async tf remote operation") outCh := p.AsyncTFExec.RunCommandAsync(ctx, prjCtx, filepath.Clean(path), cmdArgs, envs, tfVersion, prjCtx.Workspace) var lines []string nextLineIsRunURL := false @@ -275,13 +273,11 @@ func (p *PlanStepRunner) runRemotePlan( nextLineIsRunURL = true } else if nextLineIsRunURL { runURL = strings.TrimSpace(line.Line) - prjCtx.Log.Debugf("remote run url found, updating commit status") updateStatusF(models.PendingCommitStatus, runURL) nextLineIsRunURL = false } } - prjCtx.Log.Debugf("async tf remote operation complete") output := strings.Join(lines, "\n") if err != nil { updateStatusF(models.FailedCommitStatus, runURL) diff --git a/server/core/runtime/plan_type_step_runner_delegate.go b/server/core/runtime/plan_type_step_runner_delegate.go index 1b9ea01412..7bcf2be928 100644 --- a/server/core/runtime/plan_type_step_runner_delegate.go +++ b/server/core/runtime/plan_type_step_runner_delegate.go @@ -13,8 +13,6 @@ import ( type NullRunner struct{} func (p NullRunner) Run(ctx context.Context, prjCtx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) { - prjCtx.Log.Debugf("runner not configured for plan type") - return "", nil } @@ -22,8 +20,6 @@ func (p NullRunner) Run(ctx context.Context, prjCtx command.ProjectContext, extr type RemoteBackendUnsupportedRunner struct{} func (p RemoteBackendUnsupportedRunner) Run(ctx context.Context, cmdCtx command.ProjectContext, extraArgs []string, path string, envs map[string]string) (string, error) { - cmdCtx.Log.Debugf("runner not configured for remote backend") - return "Remote backend is unsupported for this step.", nil } diff --git a/server/core/runtime/policy/conftest_client.go b/server/core/runtime/policy/conftest_client.go index b811141c98..8a702d9917 100644 --- a/server/core/runtime/policy/conftest_client.go +++ b/server/core/runtime/policy/conftest_client.go @@ -163,7 +163,6 @@ func NewConfTestExecutorWorkflow(log logging.SimpleLogging, versionRootDir strin func (c *ConfTestExecutorWorkflow) Run(ctx context.Context, prjCtx command.ProjectContext, executablePath string, envs map[string]string, workdir string, extraArgs []string) (string, error) { policyArgs := []Arg{} policySetNames := []string{} - prjCtx.Log.Debugf("policy sets, %s ", prjCtx.PolicySets) for _, policySet := range prjCtx.PolicySets.PolicySets { path, err := c.SourceResolver.Resolve(policySet) diff --git a/server/core/runtime/run_step_runner.go b/server/core/runtime/run_step_runner.go index c32e0218da..f534157391 100644 --- a/server/core/runtime/run_step_runner.go +++ b/server/core/runtime/run_step_runner.go @@ -29,7 +29,7 @@ func (r *RunStepRunner) Run(ctx context.Context, prjCtx command.ProjectContext, err := r.TerraformExecutor.EnsureVersion(prjCtx.Log, tfVersion) if err != nil { err = fmt.Errorf("%s: Downloading terraform Version %s", err, tfVersion.String()) - prjCtx.Log.Debugf("error: %s", err) + prjCtx.Log.Errorf("error: %s", err) return "", err } @@ -71,7 +71,7 @@ func (r *RunStepRunner) Run(ctx context.Context, prjCtx command.ProjectContext, if err != nil { err = fmt.Errorf("%s: running %q in %q: \n%s", err, command, path, out) - prjCtx.Log.Debugf("error: %s", err) + prjCtx.Log.Errorf("error: %s", err) return "", err } prjCtx.Log.Infof("successfully ran %q in %q", command, path) diff --git a/server/core/terraform/async_client.go b/server/core/terraform/async_client.go index b0496735cb..08fad29d79 100644 --- a/server/core/terraform/async_client.go +++ b/server/core/terraform/async_client.go @@ -70,7 +70,6 @@ func (c *AsyncClient) RunCommandAsyncWithInput(ctx context.Context, prjCtx comma } cmd.Env = envVars - prjCtx.Log.Debugf("starting %q in %q", cmd.String(), path) err = cmd.Start() if err != nil { err = errors.Wrapf(err, "running %q in %q", cmd.String(), path) @@ -83,7 +82,6 @@ func (c *AsyncClient) RunCommandAsyncWithInput(ctx context.Context, prjCtx comma // This function will exit when inCh is closed which we do in our defer. go func() { for line := range input { - prjCtx.Log.Debugf("writing %q to remote command's stdin", line) _, err := io.WriteString(stdin, line) if err != nil { prjCtx.Log.Errorf(errors.Wrapf(err, "writing %q to process", line).Error()) diff --git a/server/events/approve_policies_command_runner.go b/server/events/approve_policies_command_runner.go index e7704972d1..43fa1dd827 100644 --- a/server/events/approve_policies_command_runner.go +++ b/server/events/approve_policies_command_runner.go @@ -54,7 +54,6 @@ func (a *ApprovePoliciesCommandRunner) Run(ctx *command.Context, cmd *command.Co // If there were no projects modified, we set successful commit statuses // with 0/0 projects approve_policies successfully because some users require // the Atlantis status to be passing for all pull requests. - ctx.Log.Debugf("setting VCS status to success with no projects found") if err := a.commitStatusUpdater.UpdateCombinedCount(context.TODO(), ctx.Pull.BaseRepo, ctx.Pull, models.SuccessCommitStatus, command.PolicyCheck, 0, 0); err != nil { ctx.Log.Warnf("unable to update commit status: %s", err) } diff --git a/server/events/db_updater.go b/server/events/db_updater.go index 951387f5ab..a22e1e5bc1 100644 --- a/server/events/db_updater.go +++ b/server/events/db_updater.go @@ -17,11 +17,9 @@ func (c *DBUpdater) updateDB(ctx *command.Context, pull models.PullRequest, resu var filtered []command.ProjectResult for _, r := range results { if _, ok := r.Error.(DirNotExistErr); ok { - ctx.Log.Debugf("ignoring error result from project at dir %q workspace %q because it is dir not exist error", r.RepoRelDir, r.Workspace) continue } filtered = append(filtered, r) } - ctx.Log.Debugf("updating DB with pull results") return c.DB.UpdatePullWithResults(pull, filtered) } diff --git a/server/events/delete_lock_command.go b/server/events/delete_lock_command.go index 02527e0f2c..9409ec27de 100644 --- a/server/events/delete_lock_command.go +++ b/server/events/delete_lock_command.go @@ -46,7 +46,6 @@ func (l *DefaultDeleteLockCommand) DeleteLocksByPull(repoFullName string, pullNu return numLocks, err } if numLocks == 0 { - l.Logger.Debugf("No locks found for pull") return numLocks, nil } @@ -63,7 +62,6 @@ func (l *DefaultDeleteLockCommand) deleteWorkingDir(lock models.ProjectLock) { // installations of Atlantis will have locks in their DB that do not have // this field on PullRequest. We skip deleting the working dir in this case. if lock.Pull.BaseRepo == (models.Repo{}) { - l.Logger.Debugf("Not deleting the working dir.") return } unlock, err := l.WorkingDirLocker.TryLock(lock.Pull.BaseRepo.FullName, lock.Pull.Num, lock.Workspace) diff --git a/server/events/git_cred_writer.go b/server/events/git_cred_writer.go index d454cc095a..481d2553fe 100644 --- a/server/events/git_cred_writer.go +++ b/server/events/git_cred_writer.go @@ -34,7 +34,6 @@ func WriteGitCreds(gitUser string, gitToken string, gitHostname string, home str return err } if hasLine { - logger.Debugf("git credentials file has expected contents, not modifying") return nil } diff --git a/server/events/plan_command_runner.go b/server/events/plan_command_runner.go index 3433137e40..4a8638338b 100644 --- a/server/events/plan_command_runner.go +++ b/server/events/plan_command_runner.go @@ -67,7 +67,6 @@ func (p *PlanCommandRunner) runAutoplan(ctx *command.Context) { // If there were no projects modified, we set successful commit statuses // with 0/0 projects planned/policy_checked/applied successfully because some users require // the Atlantis status to be passing for all pull requests. - ctx.Log.Debugf("setting VCS status to success with no projects found") if err := p.commitStatusUpdater.UpdateCombinedCount(context.TODO(), baseRepo, pull, models.SuccessCommitStatus, command.Plan, 0, 0); err != nil { ctx.Log.Warnf("unable to update commit status: %s", err) } diff --git a/server/events/policy_check_command_runner.go b/server/events/policy_check_command_runner.go index 90e3d0e557..9c962fa1f7 100644 --- a/server/events/policy_check_command_runner.go +++ b/server/events/policy_check_command_runner.go @@ -37,7 +37,6 @@ func (p *PolicyCheckCommandRunner) Run(ctx *command.Context, cmds []command.Proj // If there were no projects modified, we set successful commit statuses // with 0/0 projects policy_checked successfully because some users require // the Atlantis status to be passing for all pull requests. - ctx.Log.Debugf("setting VCS status to success with no projects found") if err := p.commitStatusUpdater.UpdateCombinedCount(context.TODO(), ctx.Pull.BaseRepo, ctx.Pull, models.SuccessCommitStatus, command.PolicyCheck, 0, 0); err != nil { ctx.Log.Warnf("unable to update commit status: %s", err) } diff --git a/server/events/pre_workflow_hooks_command_runner.go b/server/events/pre_workflow_hooks_command_runner.go index a7ff4cd805..aa1db3392b 100644 --- a/server/events/pre_workflow_hooks_command_runner.go +++ b/server/events/pre_workflow_hooks_command_runner.go @@ -49,13 +49,10 @@ func (w *DefaultPreWorkflowHooksCommandRunner) RunPreHooks( return nil } - log.Debugf("pre-hooks configured, running...") - unlockFn, err := w.WorkingDirLocker.TryLock(baseRepo.FullName, pull.Num, DefaultWorkspace) if err != nil { return errors.Wrap(err, "locking working dir") } - log.Debugf("got workspace lock") defer unlockFn() repoDir, _, err := w.WorkingDir.Clone(log, headRepo, pull, DefaultWorkspace) diff --git a/server/events/project_command_builder.go b/server/events/project_command_builder.go index 7cb779bda2..b9e2739c69 100644 --- a/server/events/project_command_builder.go +++ b/server/events/project_command_builder.go @@ -132,7 +132,6 @@ func (p *DefaultProjectCommandBuilder) BuildAutoplanCommands(ctx *command.Contex var autoplanEnabled []command.ProjectContext for _, projCtx := range projCtxs { if !projCtx.AutoplanEnabled { - ctx.Log.Debugf("ignoring project at dir %q, workspace: %q because autoplan is disabled", projCtx.RepoRelDir, projCtx.Workspace) continue } autoplanEnabled = append(autoplanEnabled, projCtx) @@ -178,7 +177,6 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context if err != nil { return nil, err } - ctx.Log.Debugf("%d files were modified in this pull request", len(modifiedFiles)) // Need to lock the workspace we're about to clone to. workspace := DefaultWorkspace @@ -188,7 +186,6 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context ctx.Log.Warnf("workspace was locked") return nil, err } - ctx.Log.Debugf("got workspace lock") defer unlockFn() repoDir, _, err := p.WorkingDir.Clone(ctx.Log, ctx.HeadRepo, ctx.Pull, workspace) @@ -218,7 +215,6 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context ctx.Log.Infof("%d projects are to be planned based on their when_modified config", len(matchingProjects)) for _, mp := range matchingProjects { - ctx.Log.Debugf("determining config for project at dir: %q workspace: %q", mp.Dir, mp.Workspace) mergedCfg := p.GlobalCfg.MergeProjectCfg(ctx.Log, ctx.Pull.BaseRepo.ID(), mp, repoCfg) contextFlags := &command.ContextFlags{ ForceApply: forceApply, @@ -245,7 +241,6 @@ func (p *DefaultProjectCommandBuilder) buildPlanAllCommands(ctx *command.Context } ctx.Log.Infof("automatically determined that there were %d projects modified in this pull request: %s", len(modifiedProjects), modifiedProjects) for _, mp := range modifiedProjects { - ctx.Log.Debugf("determining config for project at dir: %q", mp.Path) pCfg := p.GlobalCfg.DefaultProjCfg(ctx.Log, ctx.Pull.BaseRepo.ID(), mp.Path, DefaultWorkspace) contextFlags := &command.ContextFlags{ @@ -277,14 +272,12 @@ func (p *DefaultProjectCommandBuilder) buildProjectPlanCommand(ctx *command.Cont } var pcc []command.ProjectContext - ctx.Log.Debugf("building plan command") unlockFn, err := p.WorkingDirLocker.TryLock(ctx.Pull.BaseRepo.FullName, ctx.Pull.Num, workspace) if err != nil { return pcc, err } defer unlockFn() - ctx.Log.Debugf("cloning repository") _, _, err = p.WorkingDir.Clone(ctx.Log, ctx.HeadRepo, ctx.Pull, workspace) if err != nil { return pcc, err @@ -524,7 +517,6 @@ func (p *DefaultProjectCommandBuilder) buildProjectCommandCtx(ctx *command.Conte repoRelDir = projCfg.RepoRelDir workspace = projCfg.Workspace for _, mp := range matchingProjects { - ctx.Log.Debugf("Merging config for project at dir: %q workspace: %q", mp.Dir, mp.Workspace) projCfg = p.GlobalCfg.MergeProjectCfg( ctx.Log, ctx.Pull.BaseRepo.ID(), diff --git a/server/events/project_command_context_builder.go b/server/events/project_command_context_builder.go index 3887f52370..264d899223 100644 --- a/server/events/project_command_context_builder.go +++ b/server/events/project_command_context_builder.go @@ -64,7 +64,6 @@ func buildContext( repoDir string, contextFlags *command.ContextFlags, ) []command.ProjectContext { - ctx.Log.Debugf("Building project command context for %s", cmdName) projectCmds := make([]command.ProjectContext, 0) // If TerraformVersion not defined in config file look for a @@ -142,13 +141,11 @@ func getTfVersion(ctx *command.Context, absProjDir string) *version.Version { re := regexp.MustCompile(`^=?\s*([^\s]+)\s*$`) matched := re.FindStringSubmatch(requiredVersionSetting) if len(matched) == 0 { - ctx.Log.Debugf("did not specify exact version in terraform configuration, found %q", requiredVersionSetting) return nil } - ctx.Log.Debugf("found required_version setting of %q", requiredVersionSetting) version, err := version.NewVersion(matched[1]) if err != nil { - ctx.Log.Debugf(err.Error()) + ctx.Log.Errorf(err.Error()) return nil } diff --git a/server/events/project_finder.go b/server/events/project_finder.go index 72727ffab1..eadfa81a6a 100644 --- a/server/events/project_finder.go +++ b/server/events/project_finder.go @@ -84,7 +84,6 @@ func (p *DefaultProjectFinder) DetermineProjects(log logging.SimpleLogging, modi func (p *DefaultProjectFinder) DetermineProjectsViaConfig(log logging.SimpleLogging, modifiedFiles []string, config valid.RepoCfg, absRepoDir string) ([]valid.Project, error) { var projects []valid.Project for _, project := range config.Projects { - log.Debugf("checking if project at dir %q workspace %q was modified", project.Dir, project.Workspace) var whenModifiedRelToRepoRoot []string for _, wm := range project.Autoplan.WhenModified { wm = strings.TrimSpace(wm) @@ -115,11 +114,9 @@ func (p *DefaultProjectFinder) DetermineProjectsViaConfig(log logging.SimpleLogg for _, file := range modifiedFiles { match, err := pm.Matches(file) if err != nil { - log.Debugf("match err for file %q: %s", file, err) continue } if match { - log.Debugf("file %q matched pattern", file) // If we're checking using an atlantis.yaml file we downloaded // directly from the repo (when doing a no-clone check) then // absRepoDir will be empty. Since we didn't clone the repo @@ -131,8 +128,6 @@ func (p *DefaultProjectFinder) DetermineProjectsViaConfig(log logging.SimpleLogg _, err := os.Stat(filepath.Join(absRepoDir, project.Dir)) if err == nil { projects = append(projects, project) - } else { - log.Debugf("project at dir %q not included because dir does not exist", project.Dir) } } else { projects = append(projects, project) @@ -157,7 +152,6 @@ func (p *DefaultProjectFinder) filterToFileList(log logging.SimpleLogging, files } match, err := patternMatcher.Matches(fileName) if err != nil { - log.Debugf("filter err for file %q: %s", fileName, err) continue } if match { diff --git a/server/events/vcs/github_client.go b/server/events/vcs/github_client.go index e838a65d97..13f3e4e36f 100644 --- a/server/events/vcs/github_client.go +++ b/server/events/vcs/github_client.go @@ -106,7 +106,6 @@ func NewGithubClient(hostname string, credentials GithubCredentials, logger logg ) user, err := credentials.GetUser() - logger.Debugf("GH User: %s", user) if err != nil { return nil, errors.Wrap(err, "getting user") @@ -147,7 +146,6 @@ func (g *GithubClient) GetModifiedFiles(repo models.Repo, pull models.PullReques if nextPage != 0 { opts.Page = nextPage } - g.logger.Debugf("GET /repos/%v/%v/pulls/%d/files", repo.Owner, repo.Name, pull.Num) pageFiles, resp, err := g.client.PullRequests.ListFiles(g.ctx, repo.Owner, repo.Name, pull.Num, &opts) if err != nil { return files, err @@ -188,7 +186,6 @@ func (g *GithubClient) CreateComment(repo models.Repo, pullNum int, comment stri comments := common.SplitComment(comment, maxCommentLength, sepEnd, sepStart) for i := range comments { - g.logger.Debugf("POST /repos/%v/%v/issues/%d/comments", repo.Owner, repo.Name, pullNum) _, _, err := g.client.Issues.CreateComment(g.ctx, repo.Owner, repo.Name, pullNum, &github.IssueComment{Body: &comments[i]}) if err != nil { return err @@ -201,7 +198,6 @@ func (g *GithubClient) HidePrevCommandComments(repo models.Repo, pullNum int, co var allComments []*github.IssueComment nextPage := 0 for { - g.logger.Debugf("GET /repos/%v/%v/issues/%d/comments", repo.Owner, repo.Name, pullNum) comments, resp, err := g.client.Issues.ListComments(g.ctx, repo.Owner, repo.Name, pullNum, &github.IssueListCommentsOptions{ Sort: github.String("created"), Direction: github.String("asc"), @@ -269,7 +265,6 @@ func (g *GithubClient) PullIsApproved(repo models.Repo, pull models.PullRequest) if nextPage != 0 { opts.Page = nextPage } - g.logger.Debugf("GET /repos/%v/%v/pulls/%d/reviews", repo.Owner, repo.Name, pull.Num) pageReviews, resp, err := g.client.PullRequests.ListReviews(g.ctx, repo.Owner, repo.Name, pull.Num, &opts) if err != nil { return approvalStatus, errors.Wrap(err, "getting reviews") diff --git a/server/events/vcs/instrumented_client.go b/server/events/vcs/instrumented_client.go index 599824eab5..895b5c930a 100644 --- a/server/events/vcs/instrumented_client.go +++ b/server/events/vcs/instrumented_client.go @@ -79,7 +79,7 @@ func (c *InstrumentedGithubClient) GetContents(owner, repo, branch, path string) executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("fetched contents", map[string]interface{}{ + c.Logger.Info("fetched contents", map[string]interface{}{ logging.RepositoryKey.String(): repo, }) @@ -109,7 +109,7 @@ func (c *InstrumentedGithubClient) GetPullRequestFromName(repoName string, repoO executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("fetched pull request", map[string]interface{}{ + c.Logger.Info("fetched pull request", map[string]interface{}{ logging.RepositoryKey.String(): fmt.Sprintf("%s/%s", repoOwner, repoName), logging.PullNumKey.String(): strconv.Itoa(pullNum), }) @@ -136,7 +136,7 @@ func (c *InstrumentedGithubClient) GetRepoChecks(repo models.Repo, pull models.P executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("fetched vcs repo checks", fields.PullRequest(pull)) + c.Logger.Info("fetched vcs repo checks", fields.PullRequest(pull)) return statuses, err } @@ -160,7 +160,7 @@ func (c *InstrumentedGithubClient) GetRepoStatuses(repo models.Repo, pull models executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("fetched vcs repo statuses", fields.PullRequest(pull)) + c.Logger.Info("fetched vcs repo statuses", fields.PullRequest(pull)) return statuses, err } @@ -190,7 +190,7 @@ func (c *InstrumentedClient) GetModifiedFiles(repo models.Repo, pull models.Pull executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("fetched pull request modified files", fields.PullRequest(pull)) + c.Logger.Info("fetched pull request modified files", fields.PullRequest(pull)) return files, err @@ -212,7 +212,7 @@ func (c *InstrumentedClient) CreateComment(repo models.Repo, pullNum int, commen executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("created pull request comment", map[string]interface{}{ + c.Logger.Info("created pull request comment", map[string]interface{}{ logging.RepositoryKey.String(): repo.FullName, logging.PullNumKey.String(): strconv.Itoa(pullNum), }) @@ -235,7 +235,7 @@ func (c *InstrumentedClient) HidePrevCommandComments(repo models.Repo, pullNum i executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("hid previous comments", map[string]interface{}{ + c.Logger.Info("hid previous comments", map[string]interface{}{ logging.RepositoryKey.String(): repo.FullName, logging.PullNumKey.String(): strconv.Itoa(pullNum), }) @@ -261,7 +261,7 @@ func (c *InstrumentedClient) PullIsApproved(repo models.Repo, pull models.PullRe executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("fetched pull request approval status", fields.PullRequest(pull)) + c.Logger.Info("fetched pull request approval status", fields.PullRequest(pull)) return approvalStatus, err @@ -284,7 +284,7 @@ func (c *InstrumentedClient) PullIsMergeable(repo models.Repo, pull models.PullR executionSuccess.Inc(1) //TODO: thread context and use related logging methods. - c.Logger.Debug("fetched pull request mergeability", fields.PullRequest(pull)) + c.Logger.Info("fetched pull request mergeability", fields.PullRequest(pull)) return mergeable, err } diff --git a/server/events/working_dir.go b/server/events/working_dir.go index bd298abd7c..491c3e376e 100644 --- a/server/events/working_dir.go +++ b/server/events/working_dir.go @@ -85,8 +85,6 @@ func (w *FileWorkspace) Clone( // If the directory already exists, check if it's at the right commit. // If so, then we do nothing. if _, err := os.Stat(cloneDir); err == nil { - log.Debugf("clone directory %q already exists, checking if it's at the right commit", cloneDir) - // We use git rev-parse to see if our repo is at the right commit. // If just checking out the pull request branch, we can use HEAD. // If doing a merge, then HEAD won't be at the pull request's HEAD @@ -108,11 +106,8 @@ func (w *FileWorkspace) Clone( // We're prefix matching here because BitBucket doesn't give us the full // commit, only a 12 character prefix. if strings.HasPrefix(currCommit, p.HeadCommit) { - log.Debugf("repo is at correct commit %q so will not re-clone", p.HeadCommit) return cloneDir, w.warnDiverged(log, p, headRepo, cloneDir), nil } - - log.Debugf("repo was already cloned but is not at correct commit, wanted %q got %q", p.HeadCommit, currCommit) // We'll fall through to re-clone. } @@ -168,8 +163,6 @@ func (w *FileWorkspace) warnDiverged(log logging.SimpleLogging, p models.PullReq hasDiverged := w.HasDiverged(log, cloneDir) if hasDiverged { log.Infof("remote master branch is ahead and thereby has new commits, it is recommended to pull new commits") - } else { - log.Debugf("remote master branch has no new commits") } return hasDiverged } @@ -269,7 +262,6 @@ func (w *FileWorkspace) forceClone(log logging.SimpleLogging, sanitizedErrMsg := w.sanitizeGitCredentials(err.Error(), p.BaseRepo, headRepo) return fmt.Errorf("running %s: %s: %s", cmdStr, sanitizedOutput, sanitizedErrMsg) } - log.Debugf("ran: %s. Output: %s", cmdStr, strings.TrimSuffix(sanitizedOutput, "\n")) } return nil } diff --git a/server/events/working_dir_iterator.go b/server/events/working_dir_iterator.go index 05f363d20c..55160b51eb 100644 --- a/server/events/working_dir_iterator.go +++ b/server/events/working_dir_iterator.go @@ -74,8 +74,6 @@ func (f *FileWorkDirIterator) ListCurrentWorkingDirPulls() ([]models.PullRequest return errors.Wrapf(err, "parsing pull num %s", pathComponents[2]) } - f.Log.Debugf("Fetching pull for %s/%s #%d", ownerName, repoName, pullNum) - pull, err := f.GithubClient.GetPullRequestFromName(repoName, ownerName, pullNum) if err != nil { diff --git a/server/lyft/feature/allocator.go b/server/lyft/feature/allocator.go index bbd08d8f04..4717c60968 100644 --- a/server/lyft/feature/allocator.go +++ b/server/lyft/feature/allocator.go @@ -107,8 +107,6 @@ func (r *PercentageBasedAllocator) ShouldAllocate(featureID Name, fullRepoName s repo := ffuser.NewUser(fullRepoName) shouldAllocate, err := ffclient.BoolVariation(string(featureID), repo, false) - r.logger.Debugf("feature %s allocation: %t for repo: %s", featureID, shouldAllocate, fullRepoName) - // if we error out we shouldn't enable the feature, could be risky // Note: if the feature doesn't exist, the library returns the default value. if err != nil { diff --git a/server/lyft/temporal/activities/clone.go b/server/lyft/temporal/activities/clone.go index a300225704..75e5bf0a82 100644 --- a/server/lyft/temporal/activities/clone.go +++ b/server/lyft/temporal/activities/clone.go @@ -68,7 +68,6 @@ func Clone(ctx context.Context, request CloneActivityRequest) (CloneActivityResp sanitizedErrMsg := sanitizeGitCredentials(err.Error(), headRepo) return CloneActivityResponse{}, fmt.Errorf("running %s: %s: %s", cmdStr, sanitizedOutput, sanitizedErrMsg) } - log.Debug("ran: %s. Output: %s", cmdStr, strings.TrimSuffix(sanitizedOutput, "\n")) } return CloneActivityResponse{Dir: cloneDir}, nil } diff --git a/server/middleware.go b/server/middleware.go index bbc9293564..543587a118 100644 --- a/server/middleware.go +++ b/server/middleware.go @@ -17,7 +17,6 @@ import ( "net/http" "github.com/runatlantis/atlantis/server/logging" - "github.com/urfave/negroni" ) // NewRequestLogger creates a RequestLogger. @@ -32,7 +31,5 @@ type RequestLogger struct { // ServeHTTP implements the middleware function. It logs all requests at DEBUG level. func (l *RequestLogger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { - l.logger.Debugf("%s %s – from %s", r.Method, r.URL.RequestURI(), r.RemoteAddr) next(rw, r) - l.logger.Debugf("%s %s – respond HTTP %d", r.Method, r.URL.RequestURI(), rw.(negroni.ResponseWriter).Status()) } diff --git a/server/sync/project.go b/server/sync/project.go index 15ade22465..900dd35672 100644 --- a/server/sync/project.go +++ b/server/sync/project.go @@ -68,7 +68,6 @@ func (p *ProjectSyncer) sync( result.Failure = lockResponse.LockFailureReason return } - ctx.Log.Debugf("acquired lock for project") result = execute(ctx) if result.Error != nil {