Search code examples
gitgitlabgitlab-cisemantic-release

Deleted tags are present in Gitlab-CI


I'm using semantic-release for versioning. Whenever I push something to my branch, the CI (Gitlab) executes the semantic-release. My problem is that I pushed to my git branch, semantic-release created a release and created the tag (e.g. 1.0.0). Finally, I figured out that I missed something important to this commit. So I deleted the tag in Gitlab (Repository > Tags, e.g. https://gitlab.com/user/project/-/tags) and finally pushed my commit again. But now, semantic-release tells me that the tag already exist but Gitlab doesn't show any tags anymore (I deleted all tags). Now I decided to add the following line to my CI:

git show-ref --tags -d

This shows me all the tags I deleted in Gitlab already, but it seems that they're present in my CI. So I'm confused what's going on here... Any ideas? Do I need something like "syncing tags" in my CI?


Solution

  • This behaviour is caused by the runners dirty cache. In .gitlab-ci.yml you should declare git strategy as clone instead of fetch as follows:

    ajob:
      variables:
        GIT_STRATEGY: clone
    

    Here are some discussions on this specific behaviour:

    Missing tags on repo cloned by GitLab CI

    Removed git tag detected on gitlab remote CI but not on local repository