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

Container error fatal: --local can only be used inside a git repository #56

Closed
Michele-Alberti opened this issue Feb 5, 2023 · 9 comments

Comments

@Michele-Alberti
Copy link

Michele-Alberti commented Feb 5, 2023

Description
One of my workflows based on commitizen-action is now returning the following error:
image

It used to work properly and the yaml configuration file for the workflow was not subjected to changes when the issue occurred.

I have already tested that the error is raised for both commitizen-action@0.15.1 and commitizen-action@0.16.0.

The only step before commitizen-tools/commitizen-action@0.15.1 is actions/checkout@v3.

References
A similar issue is reported in peter-evans/create-pull-request#1170 and actions/checkout#760.

Docker image update
I've noticed that the image python:3.8 on DockerHub (used by the Dockerfile) was updated just before the first failure of the above-mentioned workflow.
According to the first reference, this issue may be related to Git version: a building process based on different images may explain why the workflow was successful and then failed in two consequent runs, with no configuration changes (and within a few hours of each other).

@moshevayner
Copy link

Having the exact same issue over here as well, first occurrence of the failure was earlier today (~4 hours ago).
No changed to the CI process were made on our end, which made me check this repo and seems like we weren't the only ones experiencing it.
Thanks for reporting @Michele-Alberti !
Would love to see a quick fix for this, since we heavily rely on this process for our CI/CD process. 🙏🏼 🥺

@woile
Copy link
Member

woile commented Feb 5, 2023

My pipelines also broke 😅 ideas on how to fix it are welcome! Gonna take a look at it

@jmuddle-via
Copy link

As @Michele-Alberti mentioned, the Python 3.8 image did change on 2023-02-04.

One thought is to fork the repository and pin the image to the previous digest from January.

I think this diff shows necessary digest.
I'm assuming that the action runs on Linux AMD64.

I will try this later today or tomorrow, but if someone else feels inspired, please go ahead.

@Michele-Alberti
Copy link
Author

My suspect is that it is a consequence of the recent update to DockerHub's python image.
Maybe a quick fix is possible with a simple change to the line FROM python:3.8 inside the Dockerfile.

It seems that the image for 3.8.15 was not changed in the last two months.

Another way could be to downgrade Git to a less recent version inside the Dockerfile. I have no idea about the old version though...

@woile
Copy link
Member

woile commented Feb 5, 2023

I was thinking of adding to the entrypoint.sh:

# Fix #56
git config --global --add safe.directory "/__w/commitizen-action/commitizen-action" || true
export GIT_CEILING_DIRECTORIES=/__w # for old git versions

Based on this.
Do you think it will work?

@jmuddle-via
Copy link

jmuddle-via commented Feb 5, 2023

@woile that's worth a try, I think the git version in the container is older.

git version 2.30.2

@woile
Copy link
Member

woile commented Feb 5, 2023

PR is open #57

Tests are passing by using:

git config --global --add safe.directory "*"

@woile
Copy link
Member

woile commented Feb 5, 2023

Seems to be working, the tests went ok, and this action was able to release itself.

On a plus, we now use alpine with py3.11, which should make things a bit faster, though I don't know how reliable is alpine this days, I hope better than a couple of years ago.

@Michele-Alberti
Copy link
Author

I've updated commitizen-action to 0.16.1 and now it's working as expected.
Thank you @woile for finding and testing a solution.

I'm closing this issue.

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

No branches or pull requests

4 participants