How do I prevent annotated tags being converted to lightweight tags?

I am successful at creating annotated tags in Bitbucket, however, in less than a minute, the annotated tag changes to a lightweight tag. Is there a reason why the annotated tag would automatically convert to a lightweight tag with no user intervention? How to you prevent the automated transition to a lightweight tag?

3 answers

1 accepted

Hi Glen,

I work in the Bitbucket team that implemented that feature, and that doesn't describe any known part of the feature, so I'm interested in how this might be occurring too! 

When using the Bitbucket UI to create a tag, a lightweight tag will be created when you add an annotation, but no message. If you add any message in the provided dialog, then the tag will be created as an annotated tag.

If this doesn't describe what you're running into, I'd be interested in finding out how you're creating this tag, whether it be via the git command line, the REST api, or the Bitbucket web UI. 

Cheers

Paul

Bitbucket v4.3.0

Project is a migration from SVN, and still linked to SVN

Method 1
Bitbucket UI
* select commits
* select master in commits (and probably is not needed)
* select merge commit for the merge to master
	** a release branch was created from develop branch
    ** this was merged into release
* selected "Tag this Commit"
* Entered Tag name "2.0.1"
* Entered Description "Release 2.0.1 PROJ-123"
* Click tags, there it is an annotated tag
* Click tags, "Where did the annotated tag go?" 
 
Method 2
git checkout master
git tag -a 2.0.1 -m "anno master PROJ-123" master
git push --tags
 
Method 3
git checkout master
git tag -a v2.0.1 -m "Annotated version PROJ-123"
git push origin v2.01

 

Each method generated the annotated tag. Then when clicking tags a second time the annotated tag vanishes. On my source side, 

git fetch --all
git tag
* no annotated tags

 

The annotated tags definitely disappear on the Bitbucket JIRA suite for team's project. Other projects on the same suite succeed in retaining the annotated tags they generate. 

 

Note, I tried to create a lightweight tag with  the Bitbucket UI by not entering name/description. The UI responded by requiring the entry of name/description. I have not succeeded in creating a lightweight tag from the Bitbucket UI, only via git. 

Hi Glen,

Attempting this myself, you should be able to add a tag just with a name and no description. That will create a lightweight tag, see as follows:

image2016-8-26 9:4:22.png

As for the behaviour you're finding with the disappearing tags, that sounds very strange. Pushing a tag via git push --tags should work. If you're interested you can open a support case at http://support.atlassian.com and we can see if we can dive into the cause.

Cheers

Paul

Oops, I just remembered I did not enter the Tag name. However, I am not concerned with creating lightweight tags, that has been working. I am having problems with the annotated tags. Where entering a tag name and description fails.

Well, creating the lightweight with the UI did fail with just the tag name. I guess I need to open issue with Atlassian. Are you sure there is not a setting that blocks tag creations with the UI or for certain types of commits?

image2016-8-25 18:39:31.png

I tried another commit, and notice the red asterisk * for the for entry which is a UI standard for required values. Therefore, why is the Description field requiring an entry.

Hi Glen,

Just having a look, you're on Bitbucket 4.3 which doesn't ship with inbuilt support for tags. Therefore the tag support your currently receiving is via a plugin. Integrated support for tags shipped in 4.7. 

If you're after Bitbucket web ui support for tags, you'll need to upgrade to 4.7 or 4.8. Once upgraded you'll most likely want to uninstall the plugin that provides duplicate functionality.

Cheers

Paul

Hi Paul,

Your analysis sounds possible. To fully understand, one 'project' could be using the plugin, and my 'project' has not set up the plugin. I will check with the other project team admin to see if he has a tag plugin.

Thanks,

Glen

Discovered we are using Calmware v1.5.4, and it enforces the "tag name" and "description" entry. It is not working for my project. I am pushing for our JIRA Suite group to update Atlassian, and removing the Calmware.

We upgraded to Bitbucket v4.9.1 and diabled the pluggin. However, not I cannot create a Lightweight or Annotated tag for my project. Do we have to uninstall the Calmware plugin? 

found the trouble. We had a "Push Check" Hook enabled. Disabling the hook for the tag creation solved the creation of tags from the Bitbucket commit.

Some members on another project with the same JIRA Suite are successful with the annotated tag. Is there a project configuration or user setting that prevents annotated tags?

Verify your Pre receive Hooks are not blocking your tag. You may have to disable your "Push Check" hook to add your tag. The git push origin <tag_name> gave me a message to show the hook was enabled, and blocking my tag push. 

It would be nice if the Bitbucket error messging would notify the user when the tag is blocked by the "Push Check" hook. Currently, on v4.9.1, I did not see an error message to check the hook, and it was mystery why the tag would fail or not annotate.

With git you get the following message

! [remote rejected] tag_name -> tag_name (pre-receive hook declined)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,942 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you