"Before you can deploy this release, you need to add an environment to deploy it to."

When I click on the “Deploy to…” button, I’m getting an error message that says.

“Before you can deploy this release, you need to add an environment to deploy it to.”

I’ve already deploy the release several times to several environments. I do see environments in my life cycle when I’m on the release page (…app#/projects//releases/2.13.0-v213-6260)

If I create another release using the same bits, I can deploy it. I just can’t deploy the release I’ve already deployed.

I have changed some things recently with configurtion, but I can’t figure out why I’m getting this error

Hi,

Thanks for getting in touch. When a release is created a snapshot is made with most of the information required. If certain environmental changes are made, the previous release can be left ‘broken’ in a way as the snapshot is considered read only. As a new release will create a new snapshot, any changes made will be captured again, and your deployment should work as intended.

See our documentation on Releases for some more information here. https://octopus.com/docs/key-concepts/projects/releases

Let me know if you have any further questions here. :slight_smile:

Best regards,
Daniel

How can I get more information about what causes me to see the
“Before you can deploy this release, you need to add an environment to deploy it to.” message?

See the two screenshots below…As you can see, I clearly have environments added to the release…In fact, I’ve deployed to some…But now when I click the ‘deploy to…’ Button, I get the error. The error message is not helpful, I can’t figure out why I’m seeing it.

step1.PNG

Hi,

Thanks for getting in touch! Unfortunately, we have no explicit message that outlines what is missing since it last worked. Our release are designed to work so that each time a change to your projects process, variables or environments are made, a new release should be created. Since an old release will not reflect any changes you made, redeploying old releases can often break after changes.

Seeing as this works when you create a new release, would you be able to attach screenshots of the full project Lifecycle, the project’s process page, and your environments page? This may give me the info I need to see what could be going wrong.

And if you can remember the changes that were made, it will help.

Best regards,
Daniel

I’ve figure out how to reproduce this problem. This might not be minimum # of steps required, but it should work.

  1. Create a library set, add a variable to the library set. scope the variable to an environment.
  2. Add environment to a lifecycle
  3. Add the library set to the project
  4. Create a release
  5. Deploy
  6. Remove environment from lifecycle
  7. Try to deploy the same release again.

I get the above message saying I have to add an environment to this project. I can work around this problem by updating the variables for the release.

It seems like the error is that we have variables scoped to an environment but the release no longer has access to that environment. I understand that this is problematic but

a) The error message is unhelpful
b) still seems like I should still be able to deploy to environments that were not removed.

Hi,

Thanks for the extra information you have provided here. Unfortunately Octopus is not currently smart enough to identify that the deployment can not proceed due to the change which was made. I can run this past the team to see if we can implement some smarter output here, however I’m not sure it will be feasible at the moment.

The way we designed the deployment snapshot to work here is that any changes made to environments, variables or other deployment dependencies, should require a new release to be created as the structure of the deployment has been changed. The snapshot was designed to avoid any potential accidents with redeploying old releases, instead of trying to catch and address any changes that were made, the release is simply considered read only, aide from manual variable update you mention.

If you would like to see some further functionality here, I believe the best place to start would be our UserVoice suggestions page. We use this page to identify enhancements and features the community desires. You can create suggestions and vote / comment on preexisting suggestions. If a suggestion has enough support behind it we can start looking into its implementation into Octopus.

Let me know if you have any further questions.

Best regards,
Daniel