aevea / commitsar

Tool to check that commits comply with conventional commit standard
https://commitsar.aevea.ee
MIT License
134 stars 19 forks source link

`--all` flag broken in CI? #384

Open tommyalatalo opened 3 years ago

tommyalatalo commented 3 years ago

I have commitsar running in Gitlab CI, but today for some reason it has stopped working for me. I am running with the docker executor, so the repo is mounted into the commitsar container, and the check run from inside. But as seen below, even if explicitly fetching the branch from origin and checking it out, the --all flag fails, and states it's on the branch refs/heads/goreleaser.

The error message Some errors were found is of no help, there really should be better error output.

If I run the same repo and branch manually in CLI with docker run..., mounted to /src and with --all, then it works fine. So how come it doesn't work in this case? I even checked in the CI job, ls -la outputs the repo contents, so the repo is there.

$ git fetch origin $CI_COMMIT_REF_NAME
From https://<url>
 * branch            goreleaser -> FETCH_HEAD
 * [new branch]      goreleaser -> origin/goreleaser
$ git checkout $CI_COMMIT_REF_NAME
Branch 'goreleaser' set up to track remote branch 'goreleaser' from 'origin'.
Switched to a new branch 'goreleaser'
$ commitsar --all
2021/04/10 18:03:16 config file not found, using defaults
   • Starting pipeline: commit-pipeline
   • Starting analysis of commits on branch refs/heads/goreleaser
Some errors were found
fallion commented 3 years ago

I'll have a look. Thanks for the report :)

tommyalatalo commented 2 years ago

It's been almost a year since I reported this, and the error still persists. Has anything been done to check what's going on with this issue?

With git log --oneline I find a bunch of commits in my CI environment, but running commitsar results in the below. The pipeline is a detached head pipeline on Gitlab.

$ commitsar --all --verbose
2022/02/20 18:58:07 config file not found, using defaults
some errors were found
   • Starting pipeline: commit-pipeline
   • Starting analysis of commits on branch HEAD
   • All pipelines complete   
   • [commit-pipeline] reference not found
   ⨯ pipeline: commit-pipeline, error: reference not found
fallion commented 2 years ago

Hey @tommyalatalo Sorry about that. Could you provide an example Gitlab workflow? Removing any sensitive data ofc.

fallion commented 2 years ago

I think it's time to rethink the approach of using go-git and use git instead as some things could be simplified.

fallion commented 1 year ago

I think this is linked to the issue of shallow clone, which breaks go-git currently.

vikas027 commented 7 months ago

Hey @fallion , I am also facing the same issue as @altosys without even using the --all flag. Not sure what I am missing.

❯ git log --oneline
* be69f73 (HEAD -> main, origin/main, origin/HEAD) docs: updated readme
* 44806dc (tag: azure-aks@1.0.0) chore(release): version [skip ci]
* 7f21e15 feat: updated main.tf
* 19f9e18 (tag: azure-aks@0.1.1) chore(release): version [skip ci]
* dd1df05 fix: fixed main.tf
* 9d7ecbf (tag: azure-aks@0.1.0) chore(release): version [skip ci]
* 867d909 feat: azure module added package.json and terraform file
* cf7e791 (tag: aws-ecr@0.1.0) chore(release): version [skip ci]
* 5f81688 feat: aws module added package.json and terraform file
* e03024c feat: initialized lerna
* 17b42bc Initial commit

❯ commitsar -v  
2024/02/15 05:42:55 config file not found, using defaults
   • Starting pipeline: commit-pipeline
   • Starting analysis of commits on branch refs/heads/main
   • All pipelines complete   
   • [commit-pipeline] reference not found
   ⨯ pipeline: commit-pipeline, error: reference not found
some errors were found
fallion commented 6 months ago

GitHub actions? @vikas027

vikas027 commented 6 months ago

Yes, this was on GitHub actions custom host running containerd runtime

dekobon commented 4 months ago

I'm having this problem both on Github actions and my local machine. My local machine has a long history of commits.