Closed wagnst closed 3 years ago
Hm... that's weird. Can you set level: info
so we get the reviewdog logs with some more details?
Run reviewdog/action-tfsec@master
with:
github_token: ***
working_directory: .
reporter: github-pr-review
fail_on_error: true
filter_mode: nofilter
level: info
env:
TERRAFORM_CLOUD_TOKENS: app.terraform.io=***
TERRAFORM_CLI_PATH: /home/runner/work/_temp/eb823859-e7eb-4ab4-b03e-af32c7a8823c
/usr/bin/docker run --name e480c16c3e53fa483db67f57973f8b188e_2a9ea4 --label 5588e4 --workdir /github/workspace --rm -e TERRAFORM_CLOUD_TOKENS -e TERRAFORM_CLI_PATH -e INPUT_GITHUB_TOKEN -e INPUT_WORKING_DIRECTORY -e INPUT_REPORTER -e INPUT_FAIL_ON_ERROR -e INPUT_FILTER_MODE -e INPUT_FLAGS -e INPUT_LEVEL -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/base-landingzone/base-landingzone":"/github/workspace" 5588e4:80c16c3e53fa483db67f57973f8b188e
reviewdog: parse error: XML syntax error on line 4: illegal character code U+001B
Unfortunately loglevel info is not quite detailed either
Hm... something in the output coming from tfsec
is unexpected (the XML output has an illegal escape character). My first thoughts would be something is wrong with the .tf
files: are you in the right directory and on Terraform >0.12? Do you have a step that gets the code (with say actions/checkout@v2
)?
In https://github.com/reviewdog/action-tfsec/pull/15 did a whole rewrite of this action to composite actions and added some more debug steps in, especially for this type of issue. You can try running that version for more output, like this:
- name: Run tfsec with reviewdog output on the PR
uses: reviewdog/action-tfsec@revamp-n-move-to-composite
with:
github_token: ${{ secrets.github_token }}
working_directory: .
reviewdog_log_level: info # Get more output from reviewdog
reviewdog_reporter: github-pr-review
reviewdog_filter_mode: nofilter
reviewdog_fail_on_error: true
reviewdog_flags: -tee # Add debug flag to reviewdog
Directory seems right as tfsec finds the vars file. TF version and checkout action included.
code:
...
uses: actions/checkout@v2
...
- name: Run tfsec with reviewdog output on the PR
id: tfsec
uses: reviewdog/action-tfsec@revamp-n-move-to-composite
with:
github_token: ${{ secrets.github_token }}
working_directory: .
reviewdog_log_level: info # Get more output from reviewdog
reviewdog_reporter: github-pr-review
reviewdog_filter_mode: nofilter
reviewdog_fail_on_error: true
reviewdog_flags: -tee # Add debug flag to reviewdog
...
output:
...
Reading required version from terraform file, constraint: ~> 0.15
Switched terraform to version "0.15.1"
Initializing modules...
...
Run reviewdog/action-tfsec@revamp-n-move-to-composite
with:
github_token: ***
working_directory: .
reviewdog_log_level: info
reviewdog_reporter: github-pr-review
reviewdog_filter_mode: nofilter
reviewdog_fail_on_error: true
reviewdog_flags: -tee
env:
TERRAFORM_CLOUD_TOKENS: app.terraform.io=***
TERRAFORM_CLI_PATH: /home/runner/work/_temp/f212ad26-7e36-4716-b945-27334659b603
Preparing ...
Installing reviewdog (v0.11.0) ... https://github.com/reviewdog/reviewdog
reviewdog/reviewdog info checking GitHub for tag 'v0.11.0'
reviewdog/reviewdog info found version: 0.11.0 for v0.11.0/Linux/x86_64
reviewdog/reviewdog info installed /tmp/tmp.kN86cPzVzu/reviewdog/reviewdog
Installing tfsec (latest) ... https://github.com/tfsec/tfsec
Print tfsec details ...
v0.39.26
Running tfsec with reviewdog ...
Warning: A tfvars file was found but not automatically used.
Did you mean to specify the --tf-vars flag?
reviewdog: parse error: XML syntax error on line 4: illegal character code U+001B
<?xml version="1.0" encoding="UTF-8"?>
Error: Process completed with exit code 1.
I am stumped. I am thinking an XML serialization issue maybe?
@haya14busa got any ideas here?
@Vlaaaaaaad @haya14busa any update here what else we could try? Any chance to figure out what goes wrong on the action? Running this directly locally with tfsec (same files) does not yield any error at all, so it must be somehow action related.
Can someone provide a minimum complete example to reproduce?
@shogo82148 is right, an example would help a lot!
I did some more testing on other repos I have, and I could not reproduce the error at all
It would be really helpful to know
reviewdog: parse error: XML syntax error on line 4: illegal character code U+001B
<?xml version="1.0" encoding="UTF-8"?>
not only the line of the parse error but the file itself.
@waxb can you provide an example so we can reproduce this? If not, I'll have to close this issue as there's not anything we can do
Closing this, feel free to reopen with some example code!
Running your action with latest tfsec gives in some of my repos the following error. Just executing
tfsec
locally on the repo does not give any error:Any idea what could possible go wrong?