Importing using Octopus Migrator may fail if the data contains Runbooks with Step Templates. Using the --dry-run switch when using Migrator for the same data shows as successful. However, Import attachments are skipped when using --dry-run and are likely the cause of the issue.
Reproduction
Reproduced using customer generated data against a fresh, blank Octopus Server instance of the same version the data was exported from.
Error and Stacktrace
Import attachments
Step took "00:00:00"s
1 "error was" encountered
The transaction will be rolled back
1 errors were encountered
Octopus.Shared.ControlledFailureException: 1 errors were encountered
at Octopus.Migrator.Core.ImportProcess.ImportController.CommitOperation(Boolean hasErrors, ImportContext context, IRawRelationalTransaction transaction) in ./source/Octopus.Migrator.Core/ImportProcess/ImportController.cs:line 221
at Octopus.Migrator.Core.ImportProcess.ImportController.ImportDocuments(IImportedDocumentSource backup) in ./source/Octopus.Migrator.Core/ImportProcess/ImportController.cs:line 124
at Octopus.Migrator.Core.ImportProcess.ImportController.Import(IImportedDocumentSource backup) in ./source/Octopus.Migrator.Core/ImportProcess/ImportController.cs:line 97
at Octopus.Migrator.Cli.Commands.ImportFilesCommand.Start() in ./source/Octopus.Migrator.Cli/Commands/ImportFilesCommand.cs:line 143
at Octopus.Shared.Startup.AbstractCommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in ./source/Octopus.Shared/Startup/AbstractCommand.cs:line 100
at Octopus.Shared.Startup.OctopusProgram.Start(ICommandRuntime commandRuntime) in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 498
at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in ./source/Octopus.Shared/Startup/ConsoleHost.cs:line 34
at Octopus.Shared.Startup.OctopusProgram.RunHost(ICommandHost host) in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 215
at Octopus.Shared.Startup.OctopusProgram.Run() in ./source/Octopus.Shared/Startup/OctopusProgram.cs:line 166
Probable cause is a runbook with a published snapshot. Setting the PublishedRunbookSnapshotId property in the json file to null seems to workaround the import error.
Severity
No response
Version
2022.3.10807
Latest Version
None
What happened?
Importing using Octopus Migrator may fail if the data contains Runbooks with Step Templates. Using the
--dry-run
switch when using Migrator for the same data shows as successful. However,Import attachments
are skipped when using--dry-run
and are likely the cause of the issue.Reproduction
Reproduced using customer generated data against a fresh, blank Octopus Server instance of the same version the data was exported from.
Error and Stacktrace
More Information
See internal discussion here
Workaround
No response