src-d / hercules

Gaining advanced insights from Git repository history.
Other
2.63k stars 334 forks source link

Github action fails with commits not found #348

Closed tgsoverly closed 4 years ago

tgsoverly commented 4 years ago

The following error was reported in the github actions.

Run src-d/hercules@master
/usr/bin/docker run --name srcdherculeslatest_947185 --label 488dfb --workdir /github/workspace --rm -e INPUT_ARGS -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e GITHUB_ACTIONS=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/root-monorepo/root-monorepo":"/github/workspace" srcd/hercules:latest  "/bin/bash" "-c" "hercules --burndown --burndown-people --devs --couples --pb . | labours -m all -f pb --disable-projector -o hercules_charts && cd hercules_charts && tar -cf ../hercules_charts.tar * ../hercules_charts_* && cd .. && rm -r hercules_charts"
git log...
2020/01/25 15:03:38 failed to list the commits: object not found
Traceback (most recent call last):
  File "/usr/local/bin/labours", line 11, in <module>
    load_entry_point('labours==10.7.2', 'console_scripts', 'labours')()
  File "/usr/local/lib/python3.6/dist-packages/labours/cli.py", line 154, in main
    reader = read_input(args)
  File "/usr/local/lib/python3.6/dist-packages/labours/readers.py", line 439, in read_input
    reader.read(ins)
  File "/usr/local/lib/python3.6/dist-packages/labours/readers.py", line 230, in read
    raise ValueError("empty input")
ValueError: empty input
Reading the input... 

From the output it really does look like the volumes in the docker container are property being setup and it should be running the command in the property directory.

The action was copied/pasted from your example. This tool looks awesome, and lots of great work. Thank you.

vmarkovtsev commented 4 years ago

Hi @tgsoverly Thanks for trying out the Action! Hm, according to

failed to list the commits: object not found

there is probably a go-git problem. It tried to run the analog of git log and hit an error. The repo is not empty, otherwise there would not be any error.

I wonder how we can reproduce this. Can you please try running hercules binary (take it from the Releases) on the same repository and check whether that error persists?

tgsoverly commented 4 years ago

I moved the action to an open source project I have to make this easier.

Same issues reproduced there: https://github.com/tgsoverly/rover/commit/0bfa6001bc95801e7c13ff2e2d5d15c0886d991d/checks?check_suite_id=420002207

I ran the following command from inside that repo with the binary: ./hercules --burndown --burndown-people --devs --couples --pb . | labours -m all -f pb --disable-projector -o hercules_charts That successfully generates the plots, so that seems to point to something about the docker image?

vmarkovtsev commented 4 years ago

The error is different now:

failed to open .: repository does not exist

It is very different from the original error. I am confused. Can you please create another issue to keep them separate?

tgsoverly commented 4 years ago

Whoops, my mistake linked the wrong action before I had it setup correctly.

https://github.com/tgsoverly/rover/runs/408747677?check_suite_focus=true

The above link is showing the correct error.

tgsoverly commented 4 years ago

Also FWIW I was able to switch to a macos image and change the binary and it gave the same error. The same binary works locally so it would appear to be a container or they way it is being called issue.

vmarkovtsev commented 4 years ago

The problem is in the preceeding "Clone Repo" step:

/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin

--depth=1 effectively discards all the development history and renders Hercules useless.

tgsoverly commented 4 years ago

I had that same thought last night, pretty easy fix.

tgsoverly commented 4 years ago
- uses: actions/checkout@v2
  with:
    fetch-depth: 0

Got the action to move on to the next step

vmarkovtsev commented 4 years ago

Cool, closing then. If you have time to PR the update of the sample yaml, it would be very useful to everybody else :+1: