Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting the VersioningStrategy on ProjectResource is obsolete, can't figure out what the alternative is #630

Open
Pvlerick opened this issue Feb 4, 2022 · 0 comments

Comments

@Pvlerick
Copy link

Pvlerick commented Feb 4, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant