Migration Listener no longer working with the latest version of CCMA

Hi all,

Up until yesterday, I was able to migrate my app data from Server to Cloud using CCMA v3.1.6.
However, once I installed the latest release v3.1.7 - it no longer works.

As far as I know, I shouldn’t be affected by the alpha to beta breaking changes as my migration path doesn’t include migration details (project and spaces). But out of curiosity, I went ahead and implemented the recommended changes anyways but still no luck. Here’s what I did;

  • bumped osgi to v0.3.6
  • use MigrationDetailsV1
  • use AppCloudMigrationListenerV1

There was an old post in here that describes a similar situation to mine but that didn’t help either.
Restarted, cleaned, uninstalled and reinstalled - still no luck.

Just before I write this post, I noticed the release notes for the latest version of CCMA states that

This release is to support the app migrations EAP scheduled for March 2021.

Do I need to be in the EAP to use the latest version of CCMA successfully?
Anyone facing similar issues to mine after upgrading?

For references, here’s my original onStartAppMigration and access scopes.

public void onStartAppMigration(String transferId, MigrationDetails migrationDetails) {
        log.info("onStartAppMigration");
        try {
            log.info("Migration context summary: " + new ObjectMapper().writeValueAsString(migrationDetails));
            // If you know exactly the entities you are looking for a migration mapping, you can query them directly by IDs (up to 100 in a single request)
            // Map<String, String> mappingById = gateway.getMappingById(transferId, "identity:user", Collections.singleton("email/admin@example.com"));
            PaginatedMapping paginatedMapping = gateway.getPaginatedMapping(transferId, "confluence:page", 5);
            Integer index = 0;
            while (paginatedMapping.next()) {
                Map<String, String> mappings = paginatedMapping.getMapping();
                log.info("mappings = {}", new ObjectMapper().writeValueAsString(mappings));

                JSONObject migrationData = new JSONObject();
                for (Map.Entry<String, String> pageMapping : mappings.entrySet()) {
                    Page page = pageManager.getPage(Long.parseLong(pageMapping.getKey()));
                    if (page != null && page.isCurrent()) {
                        JSONArray formStructure = scaffoldApiService.getFormStructure(page);
                        JSONArray formData = scaffoldFormService.getFormData(page);

                        log.info("pageMapping {}", pageMapping.toString());
                        log.info("formStructure = {}", formStructure.toString());
                        log.info("formData = {}", formData.toString());

                        if (formStructure.length() == 0 || formData.length() == 0)
                            continue;

                        migrationData.put(pageMapping.getValue(), formData);
                    }
                }

                if (migrationData.length() > 0) {
                    OutputStream firstDataStream = gateway.createAppData(transferId, index.toString());
                    firstDataStream.write(migrationData.toString().getBytes());
                    firstDataStream.close();
                }
                index++;
            }
        } catch (IOException | XhtmlException | JSONException e) {
            log.error("Error retrieving migration mappings", e);
        }
    }

....
public Set<AccessScope> getDataAccessScopes() {
        return Stream.of(PRODUCT_DATA_UGC, APP_DATA_UGC, MIGRATION_TRACING_PRODUCT)
                .collect(Collectors.toCollection(HashSet::new));
    }

Any input or feedback is much appreciated.
Thanks.

1 Like

Hi! You don’t need to be part of the EAP for testing purposes. With the user interface, now your app will only be migrated if it’s marked a “Needed in cloud” in the App Assessment screen and consent is given by the user. You need to use the UI to ensure your app migration will be run as part of the migration.

2 Likes

Hi @DavidAlmeida,

Thanks for the input.
I did what you mentioned and some others described in this post as well.

However, the migration status seems to be stuck in “Running” and progress at “0%” indefinitely with no logs or errors output from my local server instance.

I noticed that this only happens when Apps is selected to be migrated.
Other migration plans ran and completed when no apps are selected as part of the migration plan.

I’m attaching a Loom video of that part of the process incase you could spot anything odd.

For references:
CCMA: v3.1.7
Confluence Server: v6.13.0
atlassian-app-cloud-migration-osgi: v0.3.5
App to be migrated: net.customware.confluence.plugin.scaffolding

This issue is now tracked as a bug here: https://jira.atlassian.com/browse/MIG-521