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

Cake Build Create Release with Package version ignors them and uses latest #388

Open
Jamie-Clayton opened this issue Feb 17, 2019 · 1 comment

Comments

@Jamie-Clayton
Copy link

Jamie-Clayton commented Feb 17, 2019

The documentation for Cake.Build with example implies that the Releases can be automated and set specific versions of packages.

https://cakebuild.net/api/Cake.Common.Tools.OctopusDeploy/OctopusDeployAliases/CAA9AA55

Packages = new Dictionary<string, string>
{
{ "PackageOne", "1.0.2.3" },
{ "PackageTwo", "5.2.3" }
},

However the Default release channel will automatically select the latest release, which is consistent with the Octopus documentation and warnings found https://octopus.com/docs/deployment-process/project-triggers/automatic-release-creation

When you push a package to your trigger step, Octopus will look for the latest available package for all other steps excluding pre-release packages by default - see this thread for background.

The documentation seems consistent with the CLI Code that creates the release. However it would be helpful for automated builds to be able to specify version, so you can deploy patches to production, without having to manually edit the release details that were created via automation scripts like Cake.Build.

We had previously used the DefaultPackageVersion to complete that, but with more complex CICD processes, we now run infrastructure builds with independant versions to the software steps in Octopus, which causes issues when octopus can not find the the default, it does not want to fall back to the latest version. When the software changes and gets built, we know the software deployment step version, but we want that to be independant of the cadence/versioning of the infrastructure deployment steps.

Task("Create-ArqGroup-Octopus-Release")
.IsDependentOn("Set-Version")
.IsDependentOn("Publish-To-ArqGroup-Octopus")
.IsDependentOn("Publish-To-VSTS-PackageFeed")
.ContinueOnError()
.Does(() =>
{
if (ArqGroupOctopusApiKey != APIKEY_WARNING){
var SoftwarePackages = new Dictionary<string, string> ();
IEnumerable preciousPackages = GetFiles("./BuildOutput/" + buildConfiguration + "/**/*.nupkg");
foreach (FilePath package in preciousPackages){
var packageNameWithVersion = package.GetFilenameWithoutExtension().ToString();
packageNameWithVersion = packageNameWithVersion.Substring(0, packageNameWithVersion.Length - majorMinorPatchVersion.Length - 1);
Information("Adding Package {0}, Version: {1} to octopus release.", packageNameWithVersion, majorMinorPatchVersion);
};
OctoCreateRelease(ArqGroupOctopusProjectName,
new CreateReleaseSettings {
Server = ArqGroupOctopusServer,
ApiKey = ArqGroupOctopusApiKey,
ReleaseNumber = majorMinorPatchVersion,
Channel = "default",
//DefaultPackageVersion = majorMinorPatchVersion,
Packages = SoftwarePackages,
ReleaseNotes = octopusReadMe,
});
}
});

@Jamie-Clayton
Copy link
Author

Jamie-Clayton commented Feb 17, 2019

The senario I'm trying to resolve here is a modern automated software deployment senario

  1. Step one, infrastructure as code is configured via terraform with matching git repo.
  2. Step 2-4, traditional software deployment build and release onto the infrastructure from step 1.
  3. The Azure DevOps pipeline for the software (with software git repo) generates the octopus packages and creates a release, trying to set the matching version for step 2-4 only, hoping that the latest package for step 1 is "assumed".

Happy to chat about it if you need.

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