Open anthonyhaussman opened 1 year ago
https://www.runatlantis.io/docs/server-configuration.html#hide-unchanged-plan-comments
On Mon, Aug 28, 2023 at 9:10 AM Tone @.***> wrote:
Community Note
- Please vote on this issue by adding a 👍 reaction https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/ to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Overview of the Issue
By performing a plan via Atlantis does not skipped it if there's no changes:
[image: screenshot_2023-08-28-17:42:45-2] https://user-images.githubusercontent.com/596759/263754424-26d06d02-624d-4b2e-99a5-dc05aceb8428.png Reproduction Steps
Here are the configurations used for the plan via Atlantis. It uses Terragrunt with Terraform v1.5.5.
The plan workflow configuration:
workflows: terragrunt: plan: steps: - env: name: TERRAGRUNT_TFPATH command: 'echo "terraform$(bash /opt/terragrunt-tfversion.sh)"' # Reduce Terraform suggestion output - env: name: TF_IN_AUTOMATION value: 'true' - run: command: "/opt/terragrunt-plan.sh" output: strip_refreshing
The plan script:
cat terragrunt-plan.sh
!/bin/bash
set -e -o pipefail
export TERM="xterm"
direnv allow .
eval "$(direnv export bash)";
export TF_CLI_ARGS="-no-color"
terragrunt plan $(echo "$COMMENT_ARGS" | sed 's/\//g' | sed 's/,/ /g') -out="$PLANFILE" 2>&1 | awk -v owner="${BASE_REPO_OWNER}" -v repo="${BASE_REPO_NAME}" -v pr="${PULL_NUM}" '{ print "[INFO] " owner "/" repo "#" pr ":", $0; fflush(); }' | tee -a /proc/1/fd/1 | cut -d" " -f3-
terragrunt show -no-color -json "$PLANFILE" > "$SHOWFILE";
Logs Logs
[DBUG] pre-hooks configured, running... [DBUG] got workspace lock [DBUG] Setting shell to default: "" [DBUG] Setting shellArgs to default: "" [INFO] successfully ran "sh -c terragrunt-atlantis-config generate --output atlantis.yaml --parallel --automerge --create-project-name --terraform-version=0.14.11 --filter=\"[eu|jp|us|global]*\" --create-workspace" in "/atlantis-data/repos/company/terraform/xxxx/default" [DBUG] 1 files were modified in this pull request [DBUG] got workspace lock [INFO] successfully parsed atlantis.yaml file [DBUG] moduleInfo for /atlantis-data/repos/company/terraform/xxxx/default (matching "") = map[] [DBUG] found downstream projects for "toto/stg/test/terragrunt.hcl": [] ... [INFO] 1 projects are to be planned based on their when_modified config [DBUG] determining config for project at dir: "toto/stg/test" workspace: "toto_stg_test" [DBUG] MergeProjectCfg started [DBUG] setting apply_requirements: [approved,mergeable,undiverged] from repos[1], id: github.com/company/test [DBUG] setting workflow: "terragrunt" from repos[1], id: github.com/company/terraform [DBUG] setting allow_custom_workflows: false from default server config [DBUG] setting repo_locking: true from default server config [DBUG] setting policy_check: false from default server config [DBUG] setting plan_requirements: [] from default server config [DBUG] setting import_requirements: [] from default server config [DBUG] setting allowed_overrides: [] from default server config [DBUG] setting delete_source_branch_on_merge: false from default server config [DBUG] final settings: plan_requirements: [], apply_requirements: [approved,mergeable,undiverged], import_requirements: [], workflow: terragrunt [DBUG] Building project command context for plan [DBUG] deleting previous plans and locks [INFO] Running plans in parallel [INFO] acquired lock with id "company/terraform/toto/stg/test..." [DBUG] acquired lock for project [DBUG] starting "echo \"terraform$(bash /opt/terragrunt-tfversion.sh)\"" in "/atlantis-data/repos/company/terraform/xxxx/..." [DBUG] starting "/opt/terragrunt-plan.sh" in "/atlantis-data/repos/company/terraform/xxxx/..." [INFO] plan success. output available at: https://github.com/company/terraform/pull/xxxx
Environment details
- Atlantis version: v0.25.0
- Deployment method: tf module
- Atlantis flags: ATLANTIS_CHECKOUT_STRATEGY: merge
— Reply to this email directly, view it on GitHub https://github.com/runatlantis/atlantis/issues/3712, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ3ERBYX2EVL72OJSU5JUDXXS7IHANCNFSM6AAAAAA4BUSVOQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
https://www.runatlantis.io/docs/server-configuration.html#hide-unchanged-plan-comments
Even by setting ATLANTIS_HIDE_UNCHANGED_PLAN_COMMENTS
to true, I still have the same behavior.
> kubectl -n atlantis exec -ti atlantis-0 -- env | grep ATLANTIS_HIDE_UNCHANGED_PLAN_COMMENTS
ATLANTIS_HIDE_UNCHANGED_PLAN_COMMENTS=true
It feels like Atlantis does not see the No changes
output.
I'm observing this behavior also. Is there anything I can do to help the developers debug?
Yes, we are observing the same, setting ATLANTIS_HIDE_UNCHANGED_PLAN_COMMENTS to true does not affect PR comments.
Looking at the templates, the only template I see that has a reference to .HideUnchangedPlanComments
is https://github.com/runatlantis/atlantis/blob/main/server/events/templates/multi_project_plan.tmpl. This says to me that the intention of the ATLANTIS_HIDE_UNCHANGED_PLAN_COMMENTS
setting is to reduce clutter within a multi-project plan, some of whose plans are no changes. I'm not sure it's meant to do anything in the case where there is only one plan without changes.
@anthonyhaussman (and others!) what do you expect to see in this situation? Would you want there to be no comment at all? If so, would you want the change to be automatically merged?
Hey @lukemassa .
I have a repo with dozens of projects, each representing a different tf workspace. If I issue a bare atlantis plan
(as opposed to a workspace targeted one, eg atlantis plan -w myWorkspace
, often times my PR is overrun with well-meaning but otherwise non-actionable comments and Check lines from workspaces that have 0/0/0 from the plan. It would be nice to only see plan output in comments and Checks for workspaces that have changes, to reduce noise and better focus on what is actually going to happen. Maybe there could be a single comment added by atlantis at the end of the run, stating that X, Y and Z had no changes, or something similar.
When I run bare atlantis plan
on a repo with multiple projects, I see a multi project plan comment as below, which has toggles to expand for individual workspaces, somewhat similar to your suggestion. Specifically, Atlantis is not making a separate comment per plan of a workspace. Are you seeing something different?
One situation in which I do get separate comments for the same atlantis plan
is if Atlantis needs to split the text into separate comments because it hits the 65k character limit (which happens especially if there are many projects), is this what you're seeing?
If so, there's unfortunately nothing we can do in this situation; the comment length is set by github and it has to be split into multiple comments.
Community Note
Overview of the Issue
By performing a
plan
via Atlantis does not skipped it if there's no changes:Reproduction Steps
Here are the configurations used for the plan via Atlantis. It uses Terragrunt with Terraform
v1.5.5
.The plan workflow configuration:
The
plan
script:Logs
Logs
``` [DBUG] pre-hooks configured, running... [DBUG] got workspace lock [DBUG] Setting shell to default: "" [DBUG] Setting shellArgs to default: "" [INFO] successfully ran "sh -c terragrunt-atlantis-config generate --output atlantis.yaml --parallel --automerge --create-project-name --terraform-version=0.14.11 --filter=\"[eu|jp|us|global]*\" --create-workspace" in "/atlantis-data/repos/company/terraform/xxxx/default" [DBUG] 1 files were modified in this pull request [DBUG] got workspace lock [INFO] successfully parsed atlantis.yaml file [DBUG] moduleInfo for /atlantis-data/repos/company/terraform/xxxx/default (matching "") = map[] [DBUG] found downstream projects for "toto/stg/test/terragrunt.hcl": [] ... [INFO] 1 projects are to be planned based on their when_modified config [DBUG] determining config for project at dir: "toto/stg/test" workspace: "toto_stg_test" [DBUG] MergeProjectCfg started [DBUG] setting apply_requirements: [approved,mergeable,undiverged] from repos[1], id: github.com/company/test [DBUG] setting workflow: "terragrunt" from repos[1], id: github.com/company/terraform [DBUG] setting allow_custom_workflows: false from default server config [DBUG] setting repo_locking: true from default server config [DBUG] setting policy_check: false from default server config [DBUG] setting plan_requirements: [] from default server config [DBUG] setting import_requirements: [] from default server config [DBUG] setting allowed_overrides: [] from default server config [DBUG] setting delete_source_branch_on_merge: false from default server config [DBUG] final settings: plan_requirements: [], apply_requirements: [approved,mergeable,undiverged], import_requirements: [], workflow: terragrunt [DBUG] Building project command context for plan [DBUG] deleting previous plans and locks [INFO] Running plans in parallel [INFO] acquired lock with id "company/terraform/toto/stg/test..." [DBUG] acquired lock for project [DBUG] starting "echo \"terraform$(bash /opt/terragrunt-tfversion.sh)\"" in "/atlantis-data/repos/company/terraform/xxxx/..." [DBUG] starting "/opt/terragrunt-plan.sh" in "/atlantis-data/repos/company/terraform/xxxx/..." [INFO] plan success. output available at: https://github.com/company/terraform/pull/xxxx ```Environment details
ATLANTIS_CHECKOUT_STRATEGY: merge