Setting the `VersioningStrategy` on `ProjectResource` is obsolete, can't figure out what the alternative is
Pvlerick opened this issue · comments
Standard way used to be simple:
project.Instance.VersioningStrategy = new VersioningStrategyResource { DonorPackage = new DeploymentActionPackageResource(step.Id) };
This has been made obsolete: https://github.com/OctopusDeploy/OctopusClients/blob/master/source/Octopus.Server.Client/Model/ProjectResource.cs#L105
The recommended alternative is to use DeploymentSettingsResource
on the "deploymentsettings
API."; I can't figure out what that means.
There is no documentation on this nowhere; looking around I found two routes which are both dead-ends:
var deploymentSettings = await client.Repository.DeploymentSettings.Get(project.Instance);
deploymentSettings.VersioningStrategy = new VersioningStrategyResource { DonorPackage = new DeploymentActionPackageResource(step.Id) };
var deploymentSerttings = new DeploymentSettingsResource
{
SpaceId = project.Instance.SpaceId,
ProjectId = project.Instance.Id,
VersioningStrategy = new VersioningStrategyResource { DonorPackage = new DeploymentActionPackageResource(step.Id) }
};
await client.Repository.DeploymentSettings.Modify(project.Instance, deploymentSerttings);
Both will throw a similar exception:
Unhandled exception. System.AggregateException: One or more errors occurred. (The document does not define a link for 'Self')
---> System.Exception: The document does not define a link for 'Self'
at Octopus.Client.Model.Resource.Link(String name)
For the moment, it seems the only way to deal with this is to ignore the warning.