Hi, I am trying to get a project import working. For some time, I have been manually ‘syncing’ projects between our production Octopus server and a local development instance. This allows me to verify changes before checking-in.
I am using Octopus Deploy version 2.4.10.235 and attempting to perform a project Import using Octopus tools (octo.exe). I am able to Export successfully. However, when I attempt to Import the json project settings, I get an error.
Output
Octopus Deploy Command Line Tool, version 2.4.9.22
Handshaking with Octopus server: http://myserver:8082
Handshake successful. Octopus version: 2.4.10.235; API version: 3.0.0
Finding importer 'project’
Beginning the import
Export file successfully loaded
Checking that all environments exist
System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boo lean add) at OctopusTools.Importers.ProjectImporter.CheckEnvironmentsExist(List1 envir
onmentList)
at OctopusTools.Importers.ProjectImporter.Import(Dictionary`2 paramDictionary
)
at OctopusTools.Importers.BaseImporter.Import(String[] parameters)
at OctopusTools.Commands.ImportCommand.Execute()
at OctopusTools.Commands.ApiCommand.Execute(String[] commandLineArguments)
at OctopusTools.Program.Main(String[] args)
Exit code: -3
I have ensured that nuget feeds, variable sets, project groups and environments already exist
I assumed this error may have been due to environments existing with the same name, but the tool does correctly error if a required environment does not exist
I performed a clean re-install of my local Octopus server, assuming some previous configuratino existed in my RavenDB
Can anyone help? A resolution to this this could be a quite valuable workflow for us!
I have ensured that nuget feeds, variable sets, project groups and environments already exist
I assumed this error may have been due to environments existing with the same name, but the tool does correctly error if a required environment does not exist
I performed a clean re-install of my local Octopus server, assuming some previous configuratino existed in my RavenDB
The upgrade from 1.6->2.X can be quite a painful and lengthy process. Upgrading from 2.x-2.x is much nicer, and requires less effort.
That being said, no, the command line tool does not have to be matched up. But if it is really out of date it will behave badly or error when corresponding features may not exist in either direction.
Octopus -> Tentacle are the strictest in needing to be matched, and that is only within the current version ie 2.5.x -> 2.5.x They can be slightly out of date with patches and still deploy.
Henrik has confirmed this fix should only be for Octopus-Tools.
Vanessa
So I’m getting this same error with a number of my projects too. I think I was able to pinpoint the issue (with mine at least). So let me know if this sounds similar to your setup.
In my case, my projects have many different variables which are scoped between our environments. If I delete all scoped variables except 1 (i.e. leaving a single scoped variable in the project) then the Import will work. I can add other variables at that point which aren’t scoped to an environment. However, once I try to set the scope on a second variable to my Environments then the Import will fail.
I also tried doing the Export/Import on a single server (v 2.5.7.384). So no version upgrade/mismatch.
I am also experiencing this issue on import and can confirm that the import succeeds after I remove the environment scope from most variables, so that each environment is used in no more than one variable scope.