runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.83k stars 1.06k forks source link

Regression: Using max-comments-per-command breaks hide-prev-plan-comments=true #4920

Open mubarak-j opened 2 months ago

mubarak-j commented 2 months ago

Community Note


Overview of the Issue

We recently tested the new flag ATLANTIS_MAX_COMMENTS_PER_COMMAND=1 released in v.029 and we were already using ATLANTIS_HIDE_PREV_PLAN_COMMENTS=true to reduce the clutter in Pull Requests comments. However, we found that when combining these two flags (environment variables in our case), we noticed that Atlantis no longer hides previous plan comments and therefore breaks the existing behavior for --hide-prev-plan-comments=true.

Reproduction Steps

  1. Configure Atlantis pod with the following environment variables: ATLANTIS_HIDE_PREV_PLAN_COMMENTS=true ATLANTIS_MAX_COMMENTS_PER_COMMAND: 1

  2. Run multiple atlantis plan commands in pull request

  3. Observe previous comments not being auto-hidden by Atlantis.

Logs

No relevant details were found in the logs.

Environment details

environment:

  AWS_REGION: us-east-1
  ATLANTIS_ALLOW_COMMANDS: "version,plan,apply,unlock,approve_policies,import,state"
  ATLANTIS_DISABLE_AUTOPLAN_LABEL: "no-autoplan"
  ATLANTIS_DISABLE_UNLOCK_LABEL: "do-not-unlock"
  ATLANTIS_EMOJI_REACTION: "eyes"
  ATLANTIS_ENABLE_REGEXP_CMD: "true"
  ATLANTIS_PARALLEL_POOL_SIZE: 7
  ATLANTIS_HIDE_PREV_PLAN_COMMENTS: "true"
  ATLANTIS_MAX_COMMENTS_PER_COMMAND: 1

Additional Context

NA

benoittoulme commented 1 month ago

I think this may be related: https://github.com/runatlantis/atlantis/pull/4980 the warning comment is breaking the collapsing of the first comment when the command output is being truncated.