1
votes

We are using Octopus Deploy and we would like to have two feeds, one for development branch and the other for our main branch in TFS. When we are done with a piece of functionality we merge it from the development branch to the main branch. We have builds for both branches that produce nuget packages. The DEV builds get the code from the DEV branch and publish nuget packages to the DEV feed, the MAIN builds get from the MAIN branch and publish packages to the MAIN feed. We'd like the dev build to automatically kick off a deployment in Octopus and have it use the nuget packages from the DEV feed. We'd also like to use that same Octopus deployment project to deploy to our QA, Production, and Training environments but from the MAIN feed instead of the DEV feed.

We have tried a couple different ways to solve this problem but haven't been successful yet. The Octopus UI for creating the steps allows a variable entry in the feed field so I'm assuming we can do it but we just have something slightly wrong. But it is possible that, because we have the variable set up based on environment (Octopus environment) that is part of the problem?

We also tried having the TFS build tell Octopus which feed to use and this seems to work to get the release created but when it tries to deploy it can't figure out what that variable is anymore.

I have found these posts with similar or the same problem but no posted solution yet:

I have tried creating a variable scoped by environment called testFeed and used the below syntax as the feed value in the step and it allows me to save the change and create a release but when I try to deploy is says "There was a problem with your request. Pre-deployment validation failed: one or more feeds referenced by steps in this project no longer exist. You will need to create a new release.":

#{#{testFeed}|feeds-33}
1

1 Answers

2
votes

Fortunately this now has a very easy solution that has been documented by Paul in the comments of this post.

Instead of using the or syntax I had been trying all you have to do is set up an additional variable that is not scoped to environment that acts as the default.

So for my situation, I set up a variable called nugetFeed with the value of feeds-33 (my dev feed) and row in the variable table also called nugetFeed with the value of feeds-34 (my MAIN feed) and scoped it for the QA and PROD environments. Then in the process step feed field use a custom expression of #{nugetFeed}.

Note: once you save the process step it will look like you've choosen the default feed but that is just the UI resolving the value. When you actually deploy it is using the variable values.

Currently there is a bug to watch out for described as: When you enter the #{Feed} variable and save everything works fine. But when you open the package in Edit again the #{Feed} variable is evaluated in the designer to the first of the feeds e.g. feeds-1. If you change something else and save again you process is broken since the feed now has the value feeds-1 and not #{Feed}.