Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configure maxCommentLength #2746

Open
Maddco opened this issue Dec 2, 2022 · 4 comments
Open

feat: configure maxCommentLength #2746

Maddco opened this issue Dec 2, 2022 · 4 comments
Labels
feature New functionality/enhancement Stale

Comments

@Maddco
Copy link

Maddco commented Dec 2, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction 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

  • If you have large atlantis plans or applies and your are trying to reduce the amount of content posted in the merge request custom templates don't override **Warning**: Output length greater than max comment size. Continued in next comment. logic.
  • A 800K characters plan commented on the merge request when it should have stated:
    -- :warning: The plan is to large to render in GitLab comments; run terraform plan locally..

Reproduction Steps

  • Use version v0.21.0-pre.20221120 of atlantis image.
  • Update deployment to use --markdown-template-overrides-dir=home/atlantis/.markdown_templates/ on container args
  • Create configmap that contains multiProjectPlan template.
  • Modify multiProjectPlan template in the following way:
{{ define "multiProjectPlan" -}}
    {{ template "multiProjectHeader" . }}
    {{ $disableApplyAll := .DisableApplyAll }}{{ range $i, $result := .Results }}### {{add $i 1}}. {{ if $result.ProjectName }}project: `{{$result.ProjectName}}` {{ end }}dir: `{{$result.RepoRelDir}}` workspace: `{{$result.Workspace}}`

#########################################
####This is the customization added######
#########################################

    {{ if (le (len $result.Rendered) 500000) }}{{$result.Rendered}}{{ else }}:warning: The plan is to large to render in GitLab comments; run `terraform plan` locally.{{ end }}

#############################################
####This is the end customization added######
#############################################

    {{ if ne $disableApplyAll true }}---
    {{end}}{{end}}{{ if ne .DisableApplyAll true }}{{ if and (gt (len .Results) 0) (not .PlansDeleted) }}* :fast_forward: To **apply** all unapplied plans from this pull request, comment:
        * `atlantis apply`
    * :put_litter_in_its_place: To delete all plans and locks for the PR, comment:
        * `atlantis unlock`{{end}}{{end}}{{ template "log" . }}
    {{ end }}

Logs

N/A

Environment details

  • Upgraded atlantis version to prerelease v0.21.0-pre.20221120
  • Modified template resides on the pod in the home/atlantis/.markdown_templates/ dir

Additional Context

  • I believe this go function overrides desired behavior:

  • I have been able to get this template customization to work when not exceeding gitlab comment size. (i.e {{ if (ge (len $result.Rendered) 500000) }}{{$result.Rendered}}{{ else }}:warning: The plan is to large to render in GitLab comments; run terraform plan locally.{{ end }})

@Maddco Maddco added the bug Something isn't working label Dec 2, 2022
@nitrocode nitrocode changed the title Atlantis Markdown Template Overrides Markdown Template overrides should allow overriding Output length greater than max comment Dec 2, 2022
@nitrocode
Copy link
Member

Related pr #2647

cc @ribejara-te @pseudomorph if you have time

@nitrocode
Copy link
Member

Also here is a code reference to each VCS default

https://github.com/search?q=repo%3Arunatlantis%2Fatlantis+maxCommentLength&type=code

If a flag was created to override the maxCommentLength then if it wasn't set, it should default to the current set for each respective VCS.

@nitrocode nitrocode changed the title Markdown Template overrides should allow overriding Output length greater than max comment feat: configure maxCommentLength Dec 28, 2022
@nitrocode nitrocode added feature New functionality/enhancement and removed bug Something isn't working labels Dec 28, 2022
@Cmadd12
Copy link

Cmadd12 commented Feb 15, 2023

@nitrocode Hey just wanted to ask if there is any hope of this getting picked up? Thanks!

@jamengual
Copy link
Contributor

PRs are welcome

@dosubot dosubot bot added the Stale label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement Stale
Projects
None yet
Development

No branches or pull requests

4 participants