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(jq): add json convert json tfsec to rdjson #26

Merged
merged 5 commits into from
Nov 9, 2021
Merged

feat(jq): add json convert json tfsec to rdjson #26

merged 5 commits into from
Nov 9, 2021

Conversation

jplanckeel
Copy link
Contributor

@jplanckeel jplanckeel commented Nov 2, 2021

Hello,

exchange in this issue the links to the solutions do not come up, the idea would be to make a json converter from tfsec to rdjson with jq.

This PR install JQ and change tfsec ouput by json, parsing jq to translate to rdjson and change input format for reviewdog

Result :

image

image

script.sh Outdated
REVIEWDOG_PATH="${TEMP_PATH}/reviewdog"
TFSEC_PATH="${TEMP_PATH}/tfsec"
echo '::endgroup::'

echo "::group:: Installing jq ... https://stedolan.github.io/jq"
Copy link
Member

@haya14busa haya14busa Nov 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need to install jq as every Available Environment has jq by default. https://github.com/actions/virtual-environments#available-environments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, on entreprise we don't use runner with jq :/ i fix them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is fixed can you re-run pipeline ? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, i see.

It's ok to include installing jq script when it's not available and it support windows/mac.

script.sh Outdated Show resolved Hide resolved
script.sh Outdated Show resolved Hide resolved
script.sh Outdated Show resolved Hide resolved
script.sh Outdated Show resolved Hide resolved
@haya14busa haya14busa added the bump:minor Attach to PR to automatically bump minor version on merge label Nov 9, 2021
Copy link
Member

@haya14busa haya14busa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank for your contribution! 👍

@haya14busa haya14busa merged commit 5f0c3bd into reviewdog:master Nov 9, 2021
@review-dog
Copy link
Member

Hi, @jplanckeel! We merged your PR to reviewdog! 🐶
Thank you for your contribution! ✨

We just invited you to join the @reviewdog organization on GitHub.
Accept the invite by visiting https://github.com/orgs/reviewdog/invitation.
By joining the team, you'll be a part of reviewdog community and can help the maintainance of reviewdog.

Thanks again!

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2021

🚀 [bumpr] Bumped! New version:v1.12.0 Changes:v1.11.0...v1.12.0

@dhansen-gw
Copy link
Contributor

dhansen-gw commented Nov 9, 2021

Hi, this change is breaking the action in cases where there are no tfsec warnings.

Repro steps

  1. Find a terraform directory with no tfsec violations, confirm with the following command:
$ tfsec --format=json . | jq .
{
  "results": null
}
  1. Run the command added in this PR, using the filter file in this repository:
$ tfsec --format=json . | jq -r -f <your_path>/to-rdjson.jq
jq: error (at <stdin>:3): Cannot iterate over null (null)

I am not a jq expert, but I believe the error is introduced here:

  diagnostics: .results | map({

Cheers!

ETA: better to fix than to complain: #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump:minor Attach to PR to automatically bump minor version on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants