After we upgraded from v2019.12.2 to v2020.5.4, we started getting the following exception from Calamari:
An exception was thrown while executing a resolve operation. See the InnerException for details. —> Deployed package must have a version (See inner exception for details.)
Autofac.Core.DependencyResolutionException
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable
1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable
1 parameters)
at Calamari.Common.CalamariFlavourProgram.Run(String args)
–Inner Exception–
Deployed package must have a version
Calamari.Common.Commands.CommandException
at Calamari.Common.Features.Deployment.Journal.DeployedPackage…ctor(String packageId, String packageVersion, String deployedFrom)
at Calamari.Common.Features.Deployment.Journal.DeployedPackage.FromJournalEntryElement(XElement deploymentElement)
at Calamari.Common.Features.Deployment.Journal.JournalEntry…ctor(XElement element)
at Calamari.Common.Features.Deployment.Journal.DeploymentJournal.<>c.b__8_0(XElement element)
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List
1…ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable
1 source)
at Calamari.Common.Features.Deployment.Journal.DeploymentJournal.GetAllJournalEntries()
at Calamari.Common.Features.Deployment.Journal.DeploymentJournal.GetLatestInstallation(String retentionPolicySubset, String packageId, String packageVersion)
at Calamari.Common.Plumbing.Variables.DeploymentJournalVariableContributor.Previous(IVariables variables, IDeploymentJournal journal, String policySet)
at Calamari.Common.Plumbing.Variables.DeploymentJournalVariableContributor.Contribute(ICalamariFileSystem fileSystem, IVariables variables)
at Calamari.Common.Plumbing.Variables.VariablesFactory.Create(CommonOptions options)
at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass11.<ForDelegate>b__0(IComponentContext c, IEnumerable
1 p)
at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable
1 parameters)
at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable
1 parameters)
I’ve resolved the issue by editing the DeploymentJournal.xml
file in C:\Octopus
on the deployment target and removing any <Deployment>
elements that had empty PackageVersion
attributes. The deployments were from many years ago (in fact it seems the XML schema has changed at some point to have child <Package>
elements?).
Is this a safe thing to do? I’m going to have to write some PowerShell to perform this clean-up across all our deployment targets.
Many thanks,
Ant.