Can I make octopus deploy the last uploaded package and disregard version?


(Ivan) #1

Hi guys,

My question might sound a bit strange, but…
In short - the devs are working with separate branches for each feature/ticket/issue which are then merging to the branch that I’m building and deploying from. When someone merges older branch, the version of the latest package is actually lower than the version of a package that’s two days old for example.
I combed the interface for an option to switch the deployed package from highest version to most currently uploaded package, but could not find such an option.
Can anyone please give me a hint how to tackle this?

(Michael Baumann) #2

I am doing exactly that but had to deploy packages with nuget.exe (via PS Script). I have a variable for each Tenant which is set to either None, a version number or Latest.

$version = $OctopusParameters["Tenant.PSCustomizations.Version"]
$packagename = $OctopusParameters["Tenant.ID"]
$tempfolder = $env:TEMP
$destinationFolder = "c:\deployfolder\$packagename\"
IF ($version -ne "None") {
	If ($version -eq "Latest") {
    	Write-Output "Getting the latest version of $packagename"
    	$v = (& "\\path_to_my_nuget\nuget.exe" list $packagename -Source \\path_to_my_package_repo).Split(" ")
        $version = $v[1]
        Write-Output "Found version $version for package $packagename"
	Write-Output "Attempting to install $packagename.$version"
    & "\\path_to_my_nuget\nuget.exe" install $packagename -Source \\path_to_my_repo\OctopusNuGet -OutputDirectory $tempfolder -Version $version
	#Deploying contents to deploy Folder
    Write-Output ""
	Copy-Item -Path "$tempfolder\$packagename.$version\*" -Destination $destinationFolder -Force -Exclude "*.nupkg" -Recurse
	#Cleaning up temp folder item
	Remove-Item -Path "$tempfolder\$packagename.$version" -Force -Recurse
	Write-Output "Tenant Version is set to NONE - no deployment will occur"

(Pawel Pabich) #3

Hi Ivan,

Thanks for getting in touch! The way you work is very similar to the way we work at Octopus and we’ve solved the problem you described using GitVersion. What you want is to make sure your version numbers in a branch are ever increasing and GitVersion can do that for you.

Please let me know how you go.



(Ivan) #4

Thanks a lot guys! That’s exactly what I needed.

(system) #5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.