atlantis
atlantis copied to clipboard
Threaded comments in Azure Devops
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.
- [x] I'd be willing to implement this feature (contributing guide)
Describe the user story
See big Atlantis Plan/Apply output in Threaded mode instead of separate comments in the main thread.
Describe the solution you'd like
Currently when Atlantis comments in the PR, its is updated as "parent" comment, in the main thread. You have to read it Bottom-Up. It would be much better to just continue in "reply".
How it looks currently:
How it could look:
Also it would be great if Atlantis could be more inteligent when splitting output and split between resources, not in the middle of a one.
PRs are welcome.
I think in general it would be great if we could somehow split the output.
I am currently doing for example this, by injecting into MD tags:
The security scanning has its own section, as well in the background the plan JSON gets parsed to extract delete/create/update actions and it adds them dynamically, like:
It would be good to be able to manipulate the output / create custom sections somehow.
@Dilergore that looks very cool. Could you show us how you inject the markdown?
@Dilergore that looks very cool. Could you show us how you inject the markdown?
I am using python as custom scripts, but this would basically work with any scripting language which can output stuff. I am injecting Markdown tags into the output at places where I need them to break the output. For example:
Once Terraform runs successfully I inject
print("```")
print("</details>")
The above closes the "> Output" section.
After that before I run the Wiz scanning I have:
print("### Summary")
print("<details>")
print("<summary>Wiz Scan</summary>")
print("")
print('```diff')
The next section (which creates the summary for resource creations/deletes/updates) starts like:
print("```")
print("</details>")
print("<details>")
print("<summary>Resource " + actionText1 + "</summary>")
print("")
print('```diff')
print("The following resources will be " + actionText2 + ":")
And at the end I inject - which is mainly required to be able to properly close the entire thing, as Atlantis also injects md close tags at the end like it would normally do to close the original "> Output" section:
print("```")
print("</details>")
print("<details>")
print("<summary>Commands</summary>")
print("")
print("```")
Ah that makes sense. Interesting. So you write a python script with print statements to inject html into the output and save a python script on to the container? Then run the script on a run step prior to the plan? Clever!
Ah that makes sense. Interesting. So you write a python script with print statements to inject html into the output and save a python script on to the container? Then run the script on a run step prior to the plan? Clever!
A bit more complex than that what I have but in a nutshell, yes. I have Python scripts because I have a very custom and complex custom workflow, with credential injections and a bunch of other customizations mainly to deploy to Azure used by 40+ teams.
This is just another thing which I developed so people can better see what is happening. They have very long outputs sometimes for big TF states, and it can be very hard to go through it. So this customization helps with that by dividing the output to different sections using MD and HTML (MD close and open tags for the code blocks and HTML for the drop-downs). I store the scripts on an Azure Storage Account, which makes it very easy to change the scripts and also to be able to quickly test in the test environment and to be able to deploy the customizations most of the time without downtime (unless you have a workflow change). The storage account is mounted under an Azure WebApp which runs the container. Most of the steps I have are Python coded, I am only using the init from the built-in steps.
If you have a simpler environment, what you could do is to use the built-in init and plan steps and yes, use a run after to divide and do whatever you want, like here, parse the JSON converted plan file and extract creations/deletions/updates.