semantic-release: Missing tags on repo cloned by GitLab CI
I’m running this from gitlab ci/cd and having problems with a repo. The odd thing is other repos with the same .gitlab-ci.yml settings are running just fine.
semantic-release deployed a few versions successfully and then broke. semantic-release appears to be attempting write over an existing tag.
Some things about the repo:
- all tags have been created by semantic-release
- tags have not been added or removed
- there are no branches, only master
- there are some empty commits
- no rebase or rewriting of history
package.json settings:
{
"repository": {
"type": "ssh",
"url": "git@gitlabdev.paciolan.info:development/library/javascript/react/remote-components/evenue-v2-hello-world-component.git"
},
"release": {
"branch": "master",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/exec",
{
"publishCmd": "./scripts/publish.sh ${nextRelease.version}"
}
]
]
}
}
$ git tag
v1.0.0
v1.0.1
v1.0.2
v1.1.0
$ git rev-list -1 v1.1.0
0f97f330745e6067dacf8908184ea8c5f2742fc0
$ echo $?
0
Running with the command:
npx semantic-release
Then I see this log from semantic-release:
[1:15:30 AM] [semantic-release] › ℹ Found git tag v1.0.1 associated with version 1.0.1 on branch master
and finally this:
fatal: tag 'v1.1.0' already exists
I’m a little lost as to what to check next.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (8 by maintainers)
Commits related to this issue
- chore(GitHub): 修復 semantic-release error https://github.com/semantic-release/semantic-release/issues/1410 — committed to hahow/hahow-design by amowu 4 years ago
Hi,
changing the “Shallow Clone” to zero (0), solved the problem.
https://docs.gitlab.com/ee/ci/pipelines/settings.html#git-strategy
Okay, I have changed the
GIT_STRATEGY
toclone
. The pipeline is continuing to work.I don’t know if it will get into that broken state again, or if it’s “fixed fixed”.
I also do not know how to recreate that broken state.
I don’t think so. The problem is related to the way your CI clone the repo. It seems it create a detached head and don’t clone other branches. That’s why we call the following code in semantic-release: https://github.com/semantic-release/semantic-release/blob/3739ab5f34454321aad2bf36f3a5ec03da004d33/lib/git.js#L95
But it seems this code fails to retrieve all the tags in all the branches.
What CI are you using? Can you try to find out what exact
git
command the CI runs to clone the repo and create the detached head?local:
ci/cd runner:
The runner is in Docker using
mhart/alpine-node:10.15.3
. Interesting thing is it works fine in a local container