Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

##[error]7 after "Generating report..." #1

Open
dbackeus opened this issue Jun 24, 2020 · 9 comments
Open

##[error]7 after "Generating report..." #1

dbackeus opened this issue Jun 24, 2020 · 9 comments

Comments

@dbackeus
Copy link

dbackeus commented Jun 24, 2020

Example output:
Screenshot 2020-06-24 at 14 27 22

Here's the workflow yml used:

name: brakeman
on: pull_request
jobs:
  brakeman:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: moneyforward/brakeman-action@v0

I'm too new to GitHub Actions to figure out how to debug this myself. Let me know if there is any more data I can provide.

@naokikimura
Copy link
Contributor

@dbackeus

Please see the following documents first.

Please enable debugging and try again, and check the log. You may know the details of the error.

@dbackeus
Copy link
Author

Unfortunately the additional debug info doesn't appear to help. Here is the log output surrounding the error after enabling debug:

2020-06-24T13:03:23.8997349Z Generating report...
2020-06-24T13:03:24.0853514Z ::remove-matcher owner=@moneyforward/sca-action-core/reporters/annotation-reporter#0::
2020-06-24T13:03:24.0855035Z ##[debug]Removed matchers: '@moneyforward/sca-action-core/reporters/annotation-reporter#0'
2020-06-24T13:03:24.0857244Z ::endgroup::
2020-06-24T13:03:24.0857459Z ##[endgroup]
2020-06-24T13:03:24.0861541Z ##[error]7
2020-06-24T13:03:24.0942831Z ##[debug]Node Action run completed with exit code 1
2020-06-24T13:03:24.0944195Z ##[debug]Finishing: Run moneyforward/brakeman-action@v0

@naokikimura
Copy link
Contributor

It seems that more detailed logs are needed. For that, set the environment variable NODE_DEBUG to @moneyforward/*.

  name: brakeman
  on: pull_request
  jobs:
    brakeman:
      runs-on: ubuntu-latest
+     env:
+       NODE_DEBUG: @moneyforward/*
      steps:
        - uses: actions/checkout@v2
        - uses: moneyforward/brakeman-action@v0

Reference:

@dbackeus
Copy link
Author

dbackeus commented Jun 24, 2020

With NODE_DEBUG turned on I can see 2000+ lines of JSON containing the brakeman violations. Curiously it seems to be cut off at the end of the log, just before moving on to the next step and logging the error:

Screenshot 2020-06-24 at 21 28 00

Any thoughts on this?

@naokikimura
Copy link
Contributor

If the log is large, view the raw log or download the log archive.

https://help.github.com/en/actions/configuring-and-managing-workflows/managing-a-workflow-run#downloading-logs

@dbackeus
Copy link
Author

There is no difference between the raw / downloaded logs and what I just posted above (apart from prefixing lines with timestamps). The point is that the JSON payload in the log is cut off which seems like it may indicate that the actual error is due to malformed JSON?

Here is the downloaded raw output from the end of the moneyforwardbrakeman-action@v0.txt file:

2020-06-24T19:21:50.6568497Z         {
2020-06-24T19:21:50.6568607Z           "type": "controller",
2020-06-24T19:21:50.6568720Z           "class": "NewsroomController",
2020-06-24T19:21:50.6568840Z           "method": "related_material_by_type_for_item",
2020-06-24T19:21:50.6568957Z           "line": 85,
2020-06-24T19:21:50.6569073Z           "file": "app/controllers/newsroom_controller.rb",
2020-06-24T19:21:50.6569187Z           "rendered": {
2020-06-24T19:21:50.6569291Z             "name": "newsroom/list/item/_news_type",
2020-06-24T19:21:50.6570287Z ::remove-matcher owner=@moneyforward/sca-action-core/reporters/annotation-reporter#0::
2020-06-24T19:21:50.6571532Z ##[debug]Removed matchers: '@moneyforward/sca-action-core/reporters/annotation-reporter#0'
2020-06-24T19:21:50.6571731Z ::endgroup::
2020-06-24T19:21:50.6571873Z ##[endgroup]
2020-06-24T19:21:50.6572746Z ##[error]7
2020-06-24T19:21:50.6575636Z             "file": "app/views/news
2020-06-24T19:21:50.6576850Z ##[debug]Node Action run completed with exit code 1
2020-06-24T19:21:50.6578522Z ##[debug]Finishing: Run moneyforward/brakeman-action@v0

@naokikimura
Copy link
Contributor

The JSON looks incomplete, but I don't think the JSON could be syntactically incorrect. Because no SyntaxError has occurred.

@naokikimura
Copy link
Contributor

@dbackeus Please set NODE_DEBUG to * and try again. More detailed logs can be obtained.

I expect something is happening around here.

@dbackeus
Copy link
Author

dbackeus commented Jun 25, 2020

Don't believe that helped any. After activating, re-running and downloading the logs and grepping for "Detected" here is the only find:

...
2020-06-25T13:07:39.5860333Z @MONEYFORWARD/CODE-REVIEW-ACTION/REPORTERS/ANNOTATION-REPORTER 2726: {"problemMatcher":[{"owner":"@moneyforward/sca-action-core/reporters/annotation-reporter#0","pattern":[{"regexp":"^\\[([^\\t]+)\\] Detected(?:| `([^\\t]+)`) problem at line (\\d+|NaN)(?:|, column (\\d+|NaN)) of ([^\\t]+)\\t([^\\t]+)$","file":5,"line":3,"column":4,"severity":1,"message":6,"code":2}]}]}
2020-06-25T13:07:39.5870799Z ::add-matcher::/tmp/-h1mFyc/problem-matcher.json
2020-06-25T13:07:39.5903819Z ##[debug]Added matchers: '@moneyforward/sca-action-core/reporters/annotation-reporter#0'. Problem matchers scan action output for known warning or error strings and report these inline.
2020-06-25T13:07:39.5904053Z @MONEYFORWARD/COMMAND 2726: parallelism: 2
2020-06-25T13:07:39.5904189Z @MONEYFORWARD/COMMAND 2726: 1: spawn `brakeman` (arguments length: 1)
...

And the area around the error looks similar:

...
2020-06-25T13:08:12.2599663Z     {
2020-06-25T13:08:12.2599766Z       "warning_type": "Mass Assignment",
2020-06-25T13:08:12.2599871Z       "warning_code": 70,
2020-06-25T13:08:12.2599989Z       "fingerprint": "9c27149ba93e5e100b6430c6ec3d672cb9b187f88cb8b5f2feb7046322b6a14a",
2020-06-25T13:08:12.2600108Z       "check_name": "MassAssignment",
2020-06-25T13:08:12.2600225Z       "message": "Parameters should be whitelisted for mass assignment",
2020-06-25T13:08:12.2600335Z       "file": "app/controllers/admin/pressrooms_controller.rb",
2020-06-25T13:08:12.2600448Z       "line": 68,
2020-06-25T13:08:12.2600618Z       "link": "https://brakemanscanner.org/docs
2020-06-25T13:08:12.2601977Z ::remove-matcher owner=@moneyforward/sca-action-core/reporters/annotation-reporter#0::
2020-06-25T13:08:12.2602914Z ##[debug]Removed matchers: '@moneyforward/sca-action-core/reporters/annotation-reporter#0'
2020-06-25T13:08:12.2603247Z ::endgroup::
2020-06-25T13:08:12.2603399Z ##[endgroup]
2020-06-25T13:08:12.2604645Z ##[error]7
2020-06-25T13:08:12.2609846Z ##[debug]Node Action run completed with exit code 1
2020-06-25T13:08:12.2612212Z ##[debug]Finishing: Run moneyforward/brakeman-action@v0
2020-06-25T13:08:12.2617351Z ##[debug]Evaluating condition for step: 'Post Run actions/checkout@v2'
2020-06-25T13:08:12.2621641Z ##[debug]Evaluating: always()
2020-06-25T13:08:12.2621902Z ##[debug]Evaluating always:
2020-06-25T13:08:12.2622257Z ##[debug]=> true
2020-06-25T13:08:12.2622672Z ##[debug]Result: true
2020-06-25T13:08:12.2623780Z ##[debug]Starting: Post Run actions/checkout@v2
...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants