Deploy release step

Hi,
We would like to separate database changes deployment into a own project and deploy it from other projects. If we try to create release from project A which should deploy project B as well we get an error
“Can’t find version” Why “Deploy release” step requires that given release has been created already?
We would like to deploy exact same version we have created in project A in project B(db changes)
We are using version 2020.1.17

Hi @joona_hook,

Thanks for reaching out.

Would you be able to utilize the Chain Deployment step template? It’s quite a bit more robust than the Deploy Release step. It has the create a new release functionality built in.

Please let me know what you think.

Thanks,
Jeremy

Hi,
Thanks for the fast reply. I tried the Chain Deployment step it looks just what we need however I noticed that there is no way to define package version?
It seems to have some sort of logic to figure out package version though.

Hi @joona_hook,

You’re very welcome.

I’m glad to hear it will work for you, thank you for letting me know.

Here is the code snippet that defines the package selection if you didnt dig in to look at it already:

    Write-Host 'Resolving package versions...'
    $template.Packages | % {
        $preReleaseTag = $this.Channel.Rules | ? Actions -contains $_.StepName | ? { $null -ne $_ } | % { '&preReleaseTag={0}' -f $([System.Net.WebUtility]::UrlEncode($_.Tag)) }
        $versionRange = $this.Channel.Rules | ? Actions -contains $_.StepName | ? { $null -ne $_ } | % { '&versionRange={0}' -f $([System.Net.WebUtility]::UrlEncode($_.VersionRange)) }

        $package = Invoke-OctopusApi ("$($this.BaseApiUrl)/feeds/{0}/packages?packageId={1}&partialMatch=false&includeMultipleVersions=false&includeNotes=false&includePreRelease=true&take=1{2}{3}" -f $_.FeedId, $_.PackageId, $preReleaseTag, $versionRange)

        Write-Host "Found $($package.Title) @ $($package.Version) for step $($_.StepName)"
        $selectedPackages += @{
            StepName = $_.StepName
            Version = $package.Version
        }

        if ( (Test-String $releaseVersion -ForAbsence) -and ($_.StepName -eq $template.VersioningPackageStepName) ) {
            Write-Host "Release will be created using the version number from package step $($template.VersioningPackageStepName): $($package.Version)"
            $releaseVersion = $package.Version
        }
    }

Please let me know if you have any questions or concerns and I hope you have a great rest of your week.

Best
Jeremy

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