Builds using git tags failing (x-post)

git

#1

(x-post from 2.0 Support - not sure which category is more appropriate)

I’ve been using git tags previously to build on CircleCI 2.0. 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.

I’ve repro’d this by trying to rebuild a historical build from 3 weeks ago. Happy to DM a link to the private repo if needed.


Checkout fails on git-tags, when .git directory is already present
#2

please see if this helps ,


#3

having the same problem. no CIRCLE_TAG variable defined even if the tag is in our github repo.


#4

I had this problem too. I used your suggested code ^ to solve this issue on my workflow and posted my workaround here: Checkout fails on git-tags, when .git directory is already present


closed #5

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