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

Write to a local md file instead of git #194

Closed
isaaguilar opened this issue Jan 20, 2022 · 11 comments
Closed

Write to a local md file instead of git #194

isaaguilar opened this issue Jan 20, 2022 · 11 comments
Labels
enhancement New feature or request
Milestone

Comments

@isaaguilar
Copy link

It would be nice if the tool can have an option to fill in the plan or apply template to a local file instead of forcing this script to post directly to a PR. I would guess it could be an option of the commands, like:

tfcmt plan -output /my/local/plan.md -- terraform plan
@suzuki-shunsuke suzuki-shunsuke added the enhancement New feature or request label Jan 20, 2022
@suzuki-shunsuke
Copy link
Owner

Could you explain why this feature is needed?
For debugging?

@isaaguilar
Copy link
Author

Debugging is one reason. I did actually strip out the "pr commenter" to test this first.

But another reason, the one I'm solving in my particular case, is the script that executes my terraform doesn't have knowledge of the PR that triggered the execution. By saving a file, i'd be able to send it or read it later when another script might know where to comment.

@vorkos
Copy link

vorkos commented Mar 29, 2022

In my case it could be useful to have summary somewhere. Currently, I need to detect if any resource is going to change. So I parse all output for the phrase "Your infrastructure matches the configuration."

is it possible to export results of -

	HasDestroy         bool
	HasNoChanges       bool
	HasPlanError       bool
	HasParseError      bool

to the environment variables to use them later in the CI?

@robinsk
Copy link

robinsk commented May 11, 2022

Now that GitHub has launched job summaries, it would be nice to post the markdown as $GITHUB_STEP_SUMMARY content.

@suzuki-shunsuke
Copy link
Owner

@suzuki-shunsuke
Copy link
Owner

suzuki-shunsuke commented Feb 18, 2023

#654 was merged and I published a prerelease version v4.2.0-1 v4.2.0-2.

Document: https://suzuki-shunsuke.github.io/tfcmt/output-file

Please try v4.2.0-2 and give me your feedback.
If there is no problem, I'll release v4.2.0.

@NikitaCOEUR
Copy link
Contributor

It's fine for me. No problem to use it via my CI.

Just, I use it to publish MD content to GITHUB_STEP_SUMMARY, and the "CI LINK" is not necessary for me but it's ok.

@suzuki-shunsuke
Copy link
Owner

suzuki-shunsuke commented Feb 20, 2023

Thank you for your feedback.

Just, I use it to publish MD content to GITHUB_STEP_SUMMARY, and the "CI LINK" is not necessary for me but it's ok.

I see. It makes sense but I think there are usecases that CI LINK is necessary.
If you want to remove CI LINK from comment, you can fix the template with configuration file.
And I think of it that we can add a template variable NotifierType or something to support changing the template by notifier type.

e.g.

plan:
  template: |
    {{if and .Link (ne .NotifierType "localfile")}}[CI link]({{.Link}}){{end}}

https://pkg.go.dev/text/template
https://suzuki-shunsuke.github.io/tfcmt/config

But this is just an idea and isn't mandatory.
We would be able to release v4.2.0 without this feature.

@NikitaCOEUR
Copy link
Contributor

I think that using the configuration file to specify not to use the "CI Link" is sufficient, as the existing configuration allows for it. Additionally, in my opinion, it is not necessary to introduce the feature that would support the type of notifier.

@NikitaCOEUR
Copy link
Contributor

Finally, having the type of Notifier available in the config file could be a plus... We could use the same config file for both Github comment and markdown file.

@suzuki-shunsuke
Copy link
Owner

Released. https://github.com/suzuki-shunsuke/tfcmt/releases/tag/v4.2.0

@NikitaCOEUR Thank you for your contribution!

@suzuki-shunsuke suzuki-shunsuke added this to the v4.2.0 milestone Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants