Builds using git tags failing

git

#1

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" ]
then
  git reset --hard $CIRCLE_SHA1
  git checkout -q -B $CIRCLE_BRANCH
fi

git reset --hard $CIRCLE_SHA1

The new code breaks tags:

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

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.


#2

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.


#3

See if this helps,


#4

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.


#5

@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
#6

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


#7

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