Data Center Migration provides two plugin points that can be used by plugin developer to integrate into the migration process
Exporter
- used to add plugin data to a migration archiveImporter
- used to read plugin data from a migration archiveRegistered export modules are called when the export process encounters one of three top level "scopes"
In addition to the entity being exported an ExportContext
is also supplied to
the relevant method. The export context can be used to add data to the export archive, add errors, warnings and entity mappings to the export job.
When the import process encounters an entry that is the responsibility of an [Importer
] (https://docs.atlassian.com/bitbucket-server/javadoc/latest/spi/com/atlassian/bitbucket/migration/Importer.html) either the
onArchiveEntry
or onEntry
will be called depending on the type of entry encountered. This will allow the importer to access the content of the entry and perform the import.
An ImportContext
is used to add errors, warnings and provide entity mappings to the import job.
Bitbucket provides no guarantee the ID's of entities being imported and exported will be stable across instances. This is a problem because entities need to refer to each other e.g. a PullRequest
references a Repository
.
The solution: ExportContext
provides the concept of a MigrationEntityType
that is supplied to getEntityMapping
which provides a mapping between the original id of an entity on the source instance and the id of the entity on the target instance.
The root element for the Data Center Migration plugin module is <migration-handler/>
. It allows the following
configuration attributes:
Name | Required | Description |
---|---|---|
key | Yes | The identifier of the plugin module. This key must be unique within the plugin where it is defined. |
exporter | Yes | An exporter definition containing a fully qualified class name This class must implement Exporter |
importer | Yes | An importer definition containing a fully qualified class name. This class must implement Importer |
weight | The (integer) weight of the plugin module. Migration handlers with a higher weight will be processed later. Third party plugins must use a weight greater than 100 |
Here is an example for a custom Data Center Migration handler
1 2<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}" /> </plugin-info> <migration-handler key="ExampleMigrationHandler" weight="101"> <exporter class="this.is.an.ExampleExporter"/> <importer class="this.is.an.ExampleImporter"/> </migration-handler> </atlassian-plugin>
Third party plugins must use a plugin weight greater than 100
Rate this page: