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(stats): pass plan stats to markdown templates #3478
Conversation
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
This will be useful to pass down to the templates to include additional information when formatting the messages emitted by Atlantis. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
DRY. Also highlights a bug where the stats should be a field in planSuccessData in order to be accessible from the templates. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've identified the changes in lines 199-211 as something that could be done for the rest of the templates. In fact, I believe this particular function could be refactored further to make it more readable, however, such a change is out of the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Thanks for merging! |
* Capture stats in plan changes regexp Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add PlanSuccessStats model to hold plan stats This will be useful to pass down to the templates to include additional information when formatting the messages emitted by Atlantis. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Return stats for a PlanSuccess Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add plan success stats to template data Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Refactor plan success template data creation DRY. Also highlights a bug where the stats should be a field in planSuccessData in order to be accessible from the templates. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Move plan stats to planSuccessData struct Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> --------- Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> Co-authored-by: PePe Amengual <jose.amengual@gmail.com> Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* Capture stats in plan changes regexp Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add PlanSuccessStats model to hold plan stats This will be useful to pass down to the templates to include additional information when formatting the messages emitted by Atlantis. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Return stats for a PlanSuccess Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add plan success stats to template data Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Refactor plan success template data creation DRY. Also highlights a bug where the stats should be a field in planSuccessData in order to be accessible from the templates. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Move plan stats to planSuccessData struct Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> --------- Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> Co-authored-by: PePe Amengual <jose.amengual@gmail.com> Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
* Capture stats in plan changes regexp Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add PlanSuccessStats model to hold plan stats This will be useful to pass down to the templates to include additional information when formatting the messages emitted by Atlantis. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Return stats for a PlanSuccess Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Add plan success stats to template data Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Refactor plan success template data creation DRY. Also highlights a bug where the stats should be a field in planSuccessData in order to be accessible from the templates. Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> * Move plan stats to planSuccessData struct Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> --------- Signed-off-by: Leandro López (inkel) <leandro.lopez@grafana.com> Co-authored-by: PePe Amengual <jose.amengual@gmail.com> Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
what
why
The following environments have Terraform changes
staging
dev
The following environments have changes outside of Terraform
prod-01
prod-02
The template code to do something like that could be:
tests
I've been testing these changes locally and if everything goes according to plan it is likely we will test it thoroughly at Grafana Labs, where we manage 300+ environments with Atlantis.
Adding tests to the test suite implies changing the default templates, which is not probably something we would like to introduce unless this is first approved/merged.
references