Builds using git tags failing



I’ve been using git tags previously to build on CircleCI. Since about 2 weeks ago(?), it looks like a change to the checkout step is breaking builds.

Previously, the last part of the script looked like this:

if [ -n "$CIRCLE_BRANCH" ]
  git reset --hard $CIRCLE_SHA1
  git checkout -q -B $CIRCLE_BRANCH

git reset --hard $CIRCLE_SHA1

The new code breaks tags:

if [ -n "$CIRCLE_TAG" ]
  git reset --hard "$CIRCLE_SHA1"
  git checkout -q "$CIRCLE_TAG"
elif [ -n "$CIRCLE_BRANCH" ]
  git reset --hard "$CIRCLE_SHA1"
  git checkout -q -B "$CIRCLE_BRANCH"

git reset --hard "$CIRCLE_SHA1"

The new line git checkout -q "$CIRCLE_TAG" is failing, because the tag ref isn’t getting pulled - only the contents of the tag are pulled.


Figured out this is happening because the git repo was cached. The new checkout script tries to checkout git tags, and these new tags aren’t pulled when the git repo is cached.


See if this helps,


Hey @jiaweihli, did you figure out a decent solution to this, seems I’m also having the same/similar problem. I don’t really want to give up the caching of the repo.


@edkellena No, I ended up disabling the caching after profiling it and seeing it run in the same amount of time as with caching. CircleCI support hasn’t responded and we’re not paying for I/O, so I stopped digging.

Fetching $CIRCLE_TAG doesn't seem to work

@jiaweihli Fair enough, just tried that too and it seems comparable so sounds like that’s the way to go. Thanks!


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.