dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
200 stars 37 forks source link

Error: git fetch --tags --update-head-ok #116

Closed giuvincenzi closed 1 year ago

giuvincenzi commented 2 years ago

Sometimes the release process fails with this error:

An error occurred while running semantic-release: Error: Command failed with exit code 1: git fetch --tags --update-head-ok [https://gitlab-ci-token:[secure]@gitlab.com/xxx/xxx/npm-packages.git](https://gitlab-ci-token:%5Bsecure%5D@gitlab.com/xxx/xxx/npm-packages.git) +refs/heads/master:refs/heads/master
error: cannot lock ref 'refs/heads/master': is at 4a2316cceb39c1c3c125cda96d95ba7ffbc5b6a0 but expected 60e6a30decd3acbf6ca6c9d5fe408f3ddf4f06e4

If I re-run the pipeline job the second time it always gets done correctly.

This is the error log: bug_git_fetch

I saw that there is an issue on the semantic-release repository.

The issues were resolved by hot patching execa() to execa.sync()

it says that the problem was solved by calling execa.sync() instead of execa() but I still get the error.

What the right solution would be to avoid this problem?

I'm using:

carvalhoa-ppb commented 1 year ago

Hi guys, I'm having the same issue. For me, to have a success run requires a lot of reruns, since I'm allowing releases for more than 1 branch from what I've understood.

Any idea how to bypass it? 🤔

giuvincenzi commented 1 year ago

If I re-run the pipeline job the second time it always gets done correctly.

Now it is always locked, there is no way to make it work.

gasparecoolshop commented 1 year ago

Hi all, I have the same problem with version 3 too, any idea how to resolve this issue? It's becoming really frustrating to run a pipeline.

alboo89 commented 1 year ago

Hi everybody, same problem and same frustration on every pipeline run. @antongolub can you help us please?

giuvincenzi commented 1 year ago

The problem is not semantic-release or multi semantic-release but the machine where the script runs.

I run the script on a Gitlab runner and I fixed it running the releases job with "git clone strategy" instead of "git fetch strategy"