Open hayawata3626 opened 2 years ago
@hayawata3626 I think it comes from a misconfiguration of the base branch, the error occurs on the push like if "main" is not a correct ref, what is your base branch, master or main?
@edbzn Thanks for the reply! My base branch is main.
@edbzn Perhaps this has something to do with it? https://forum.gitlab.com/t/src-refspec-master-does-not-match-any/24691
Yeah, it could come from the way you are initializing the repository, did you try to change or remove the GIT_DEPTH
variable?
Yeah, I tried this to debug.
did you try to change or remove the GIT_DEPTH variable?
same here, using GH Actions
@edbzn Any ideas to work around this problem? 🤔
It's hard to say by just looking at the code sample, it can come from the way the repo is initialized in your CI, peraps the main branch is not fetched correctly.
@gabsmprocha @hayawata3626 Did you find a workaround ?
@nhuray No solution has been found yet.
@edbzn for me the git HEAD
is going crazy, any hint please?
is there something I could do to avoid this chain effect?
are some of them running in parallel? :thinking:
> nx run assets:release
[assets] 🆕 Calculated new version "0.0.2".
[assets] 📜 Generated CHANGELOG.md.
[assets] 📝 Updated package.json version.
[assets] ❌ Error: fatal: cannot lock ref 'HEAD': is at 1fd3f3e8fe216c6742173eb23ae7e684d2fbed8c but expected 2dd3456cf558789467c5c8b4625d26f780a3d79f
at /opt/gitlab-runner/builds/mynd/frontend/megarepo/node_modules/@jscutlery/semver/src/executors/common/exec.js:10:34
> nx run select:release
[select] 🆕 Calculated new version "0.0.2".
[select] 📜 Generated CHANGELOG.md.
[select] 📝 Updated package.json version.
[select] 📦 Committed "ci: release @mynd/select@0.0.2".
[select] 🔖 Tagged "@mynd/select@0.0.2".
> nx run common:release
[common] 🆕 Calculated new version "0.0.2".
[common] 📜 Generated CHANGELOG.md.
[common] 📝 Updated package.json version.
[common] ❌ Error: fatal: cannot lock ref 'HEAD': is at 1fd3f3e8fe216c6742173eb23ae7e684d2fbed8c but expected 2dd3456cf558789467c5c8b4625d26f780a3d79f
at /opt/gitlab-runner/builds/mynd/frontend/megarepo/node_modules/@jscutlery/semver/src/executors/common/exec.js:10:34
> nx run checkbox:release
[checkbox] 🆕 Calculated new version "0.0.2".
[checkbox] 📜 Generated CHANGELOG.md.
[checkbox] 📝 Updated package.json version.
[checkbox] ❌ Error: fatal: cannot lock ref 'HEAD': is at ebe032a50be83d3996260515d5326242950ba19b but expected 1fd3f3e8fe216c6742173eb23ae7e684d2fbed8c
at /opt/gitlab-runner/builds/mynd/frontend/megarepo/node_modules/@jscutlery/semver/src/executors/common/exec.js:10:34
> nx run switch:release
[switch] 🆕 Calculated new version "0.0.2".
[switch] 📜 Generated CHANGELOG.md.
[switch] 📝 Updated package.json version.
[switch] ❌ Error: fatal: cannot lock ref 'HEAD': is at ebe032a50be83d3996260515d5326242950ba19b but expected 1fd3f3e8fe216c6742173eb23ae7e684d2fbed8c
at /opt/gitlab-runner/builds/mynd/frontend/megarepo/node_modules/@jscutlery/semver/src/executors/common/exec.js:10:34
> nx run design-tokens:release
[design-tokens] 🆕 Calculated new version "0.0.2".
[design-tokens] 📜 Generated CHANGELOG.md.
[design-tokens] 📝 Updated package.json version.
[design-tokens] ❌ Error: fatal: cannot lock ref 'HEAD': is at 9ecad87159ad0ef13c5d486d25544e1671831e4c but expected ebe032a50be83d3996260515d5326242950ba19b
at /opt/gitlab-runner/builds/mynd/frontend/megarepo/node_modules/@jscutlery/semver/src/executors/common/exec.js:10:34
> nx run radio:release
[radio] 🆕 Calculated new version "0.0.2".
[radio] 📜 Generated CHANGELOG.md.
[radio] 📝 Updated package.json version.
[radio] ❌ Error: fatal: cannot lock ref 'HEAD': is at 9ecad87159ad0ef13c5d486d25544e1671831e4c but expected ebe032a50be83d3996260515d5326242950ba19b
at /opt/gitlab-runner/builds/mynd/frontend/megarepo/node_modules/@jscutlery/semver/src/executors/common/exec.js:10:34
Hi,
I had the same issue and found that nx affected
"parallel" option has a default value of 3.
Using --parallel=1 worked for me
Switching to --parallel=1 did not fix this issue
There are two different issues here. Concerning the lock issue, it's a matter of parallel=1.
Otherwise, it feels like an issue with the way gitlab fetches the refs. Gitlab users, did you try setting GIT_STRATEGY to "clone"?
https://docs.gitlab.com/ee/ci/runners/configure_runners.html
I Hope that this will help.
Having the same issue here, more than 1 year later. Any updates? Thanks!
After generating the tag, the pipeline fails. It seems to be a problem when pushing the code. Is there something wrong with my setup?
I did exactly what the document says. https://github.com/jscutlery/semver#gitlab-ci
my .gitlab-ci.yml
I changed settings of project.json to generate CHANGELOG.md as follows.