This plugin provides an API to create and store persistent permanently unique id's for Jenkins model objects. This is useful when those objects need to be stored in an external database.
There are currently identity stores for items of type PersistenceRoot which covers Runs/Builds, Jobs/Projects and Folders among other Items. Additional stores can be added via the org.jenkinsci.plugins.uniqueid.IdStore extension point.
To create an id for a supported object, just call org.jenkinsci.plugins.uniqueid.IdStore#makeId(Object o). To get the id (if any) call org.jenkinsci.plugins.uniqueid.IdStore#getId(Object o)
If you copy folders or jobs manually then you will need to ensure that you remove any
unique-id.txt files that are present in the destination after the copy.
Prior to 2.0 the plugin stored the unique ID inside Jobs or Folders configuration. What this meant was that if you copied items (either via the UI/ CLI or manually) you would end up with dupliate "unique" ids.
Version 2 solves this by separating the storing of the unique id into a side file.
When you first install 2.0 or higher the plugin will scan all folders, jobs and Runs for IDs and will move them out into a side file along side the items configuration. (
What the migration does not do is validate that the IDs are still unique (if you previously copied a job for example you will have duplicated). Therefor post migration if you really do require uniqueness you will need to manually inspect these files for duplicates. This is not performed by default as it can give a false sense of security as jobs may have been copied across different masters.
If you find duplicates - then all you need to do is to remove the
unique-id.txt files and a new id will be generated when next requested.