How to deploy to specific channel using deploy-release in teamcity?

Hi,

I have created two channels in octopus with 2 different life cycles. Default channel deploys to dev and test environments using pre-release packages. We use the second channel to deploy release candidates to test, stage and prod. I am having couple of problems with this…we use teamcity plugins to deploy the code. I am able to create a new release using second channel and deploy it to test successfully. I tried to deploy same release to stage but getting below error

Release ‘2016.01.26-ProdRelease’ of project ‘xxxxxx’ cannot be deployed to environment ‘EAP_STAGE’ because the environment is not in the list of environments that this release can be deployed to. This may be because a) the environment does not exist, b) the name is misspelled, c) you don’t have permission to deploy to this environment, or d) the environment is not in the list of environments defined by the lifecycle.

Is there a way to provide the channel name while deploying to stage. we use deploy-release plugin to deploy it. Also one more thing is dashboard for this project show sonly 2 environments dev and test. I am able to see the stage and prod only i click the project and go inside it. Is there a way to see them all on dashboard ? do i have to include all environments in default lifecycle ?

Hi,

Thanks for getting in touch! Generally that error is when you try to deploy to your deployment pipeline but haven’t completed one of the Lifecycle requirements from your previous phases.
If you could provide screenshots of your channels for the project and also their corresponding Lifecycles I should be able to help you figure this out.

You can pass a channel flag with your create or deploy-release commands, --channel=channel name so this might help.

As for the dashboard. The overall dashboard won’t be able to differentiate between channels, but the project dashboard will. It just needs active deployments to your environments to show.

Thanks!
Vanessa

Hi Vanessa,

Thanks for your reply, I have attached the screenshots of dahsboard, channels, lifecycle, overview and also dashboard from test octopus server. I am using latest version of octopus 3.2.20, for some reason I cannot see the stage and prod on dashboard whereas I can see them on Test Server.

Please let me know how to fix this.

Thanks,

Ram

Dashboard.docx (174 KB)

Hi Ram,

Thanks for sending this through. So there are a couple of reasons we would not show all environments on the dashboard. One is if you have more than 10 environments we do some limiting of what we show to stop the dashboard being too full. I cannot tell how many environments you have in total. The other is you can set your individual dashboard settings to show only specific environments or projects, have you set any of those on your prod server? Do you have different permissions on either server?

As for the release giving you that error. When you say you use the deploy-release plugin are you refering to TeamCity? And is it run during a build? Could you give me a full build log. There are two different ways to deploy a release and one is using create-release with a deploy-to field set which then creates a release and then creates the deployment and the other is using deploy-release which takes an existing release and moves it along the deployment pipeline. If you happen to be using the create-release with deploy-to and targeting your stage server it won’t allow it as you have stage second in your phases. If you don’t require that your deployment first go to test, then you can combine both environments into the first phase.

Let me know what you find,
Vanessa

Hi Vanessa,

I deleted some of the environments and now I have just 8 environments but still it is not showing up on dashboard. I tried configuring the dashboard no luck.

And yes I am using teamcity plugin to do the deployments. I already deployed the release to Test server using EAP-Release channel without issue. There is no --channel option for deploy-release, I checked the documenation too. I get this error Unrecognized command arguments: --channel=EAP-Release. Below is the build log in TC

[14:46:27]Skip checking for changes - there are no VCS roots defined
[14:46:27]Clearing temporary directory: D:\AGT09\temp\buildTmp
[14:46:27]Publishing internal artifacts (4s)
[14:46:31][Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[14:46:31][Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[14:46:27]Checkout directory: D:\AGT09\work\16c4d0342cece8f7
[14:46:27]Step 1/1: Deploy to Stage (OctopusDeploy: Deploy release) (4s)
[14:46:28][Step 1/1] Octopus Deploy (2s)
[14:46:28][Octopus Deploy] Running command: octo.exe deploy-release --server http://octopus.xxxx.org --apikey SECRET --project GemsChannel-web2 --enableservicemessages --version 2016.01.26-ProdRelease --deployto EAP_STAGE --progress --forcepackagedownload --specificmachines=machinename --channel=EAP-Release
[14:46:28][Octopus Deploy] Deploying Octopus Deploy release
[14:46:29][Octopus Deploy] Octopus Deploy Command Line Tool, version 3.3.0+Branch.master.Sha.dbca2469436b65404660559315baeb71d40c5d53
[14:46:29][Octopus Deploy]
[14:46:31][Octopus Deploy] Unrecognized command arguments: --channel=EAP-Release
[14:46:31][Octopus Deploy] Exit code: -1
[14:46:31][Octopus Deploy] Octo.exe exit code: -1
[14:46:31][Step 1/1] Unable to create or deploy release. Please check the build log for details on the error.
[14:46:32][Step 1/1] Step Deploy to Stage (OctopusDeploy: Deploy release) failed
[14:46:32]Publishing internal artifacts
[14:46:32][Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[14:46:33][Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[14:46:34]Build finished

Hi Ram,

That error is good, because once you have a release you do not need to define a channel, it should only been determined when the release is created. You can only define it at the create-release level.
Could you remove it from that instance and run it again and give me the full build log so I can replicate the problem.

I will also try to replicate the dashboard issue you are seeing. I am not sure what else you could provide for that, hopefully I can get it to show me the same behavior.

Thanks for all your troubleshooting and information so far,
Vanessa

Hi Vanessa,

I removed the channel parameter and deployed getting below error:

[14:55:13]Skip checking for changes - there are no VCS roots defined
[14:55:14]Clearing temporary directory: D:\AGT05\temp\buildTmp
[14:55:14]Free disk space requirement (1m:15s)
[14:55:14][Free disk space requirement] Removing files to meet 3 GB of free disk space required for directory D:\AGT05\temp (only 2.93 GB is free now).
[14:56:29][Free disk space requirement] Free disk space requirement of 3 GB is met for directory D:\AGT05\temp (3.29 GB is free)
[14:56:29]Publishing internal artifacts (4s)
[14:56:33][Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[14:56:33][Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[14:56:29]Checkout directory: D:\AGT05\work\16c4d0342cece8f7
[14:56:29]Step 1/1: Deploy to Stage (OctopusDeploy: Deploy release) (5s)
[14:56:29][Step 1/1] Octopus Deploy (3s)
[14:56:29][Octopus Deploy] Running command: octo.exe deploy-release --server http://octopus.xxxx.org --apikey SECRET --project GemsChannel-web2 --enableservicemessages --version 2016.01.26-ProdRelease --deployto EAP_STAGE --progress --forcepackagedownload --specificmachines=VAVS-SOA-WEB04
[14:56:29][Octopus Deploy] Deploying Octopus Deploy release
[14:56:30][Octopus Deploy] Octopus Deploy Command Line Tool, version 3.3.0+Branch.master.Sha.dbca2469436b65404660559315baeb71d40c5d53
[14:56:30][Octopus Deploy]
[14:56:30][Octopus Deploy] Handshaking with Octopus server: http://octopus.xxxx.org
[14:56:32][Octopus Deploy] Handshake successful. Octopus version: 3.2.20; API version: 3.0.0
[14:56:33][Octopus Deploy] Authenticated as: xxxx, xxxx (Contractor) xxxx.xxxx-contractor@xxxx.coop
[14:56:33][Octopus Deploy] Finding project: GemsChannel-web2
[14:56:33][Octopus Deploy] Finding release: 2016.01.26-ProdRelease
[14:56:33][Octopus Deploy] Release ‘2016.01.26-ProdRelease’ of project ‘GemsChannel-web2’ cannot be deployed to environment ‘EAP_STAGE’ because the environment is not in the list of environments that this release can be deployed to. This may be because a) the environment does not exist, b) the name is misspelled, c) you don’t have permission to deploy to this environment, or d) the environment is not in the list of environments defined by the lifecycle.
[14:56:33][Octopus Deploy] Exit code: -1
[14:56:33][Octopus Deploy] Octo.exe exit code: -1
[14:56:33][Step 1/1] Unable to create or deploy release. Please check the build log for details on the error.
[14:56:34][Step 1/1] Step Deploy to Stage (OctopusDeploy: Deploy release) failed
[14:56:34]Publishing internal artifacts
[14:56:34][Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[14:56:35][Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[14:56:36]Build finished

Same release I deployed to EAP_STAGE without any issue using Octopus GUI, below is sample log from gui

Task ID: ServerTasks-4019
Task status: Success
Task queued: Thursday, January 14, 2016 6:58 PM
Task started: Thursday, January 14, 2016 6:58 PM
Task duration: 23 seconds
Server version: 3.2.6+Branch.master.Sha.61f0c2f50db3f40f7bd0a9032ad73491f81fda14

                | == Success: Deploy GemsChannel-web2 release 2016.01.26-ProdRelease to EAP_Stage ==

18:58:59 Verbose | Guided failure is not enabled for this task
18:59:22 Info | The deployment completed successfully.
|

Hi Ram,

We can’t figure this one out from the information you have given. My left-over thoughts are, are you connecting to the correct server from TeamCity (not to your testing server) and are the machines correct for the specific machines.
If they both look right to you we will need to schedule a call to see what might be going wrong here.
Please select a suitable time from our scheduler:
Vanessa

Hi Ram,

Here are the meeting details:

  1. Please join my meeting.
    https://global.gotomeeting.com/join/980873709

  2. Use your microphone and speakers (VoIP) - a headset is recommended. Or, call in using your telephone.

Australia: +61 2 8355 1024
United States: +1 (224) 501-3217

Access Code: 980-873-709

Audio PIN: Shown after joining the meeting
Meeting ID: 980-873-709

GoToMeeting®
Online Meetings Made Easy®

Speak Soon,
Vanessa

Hi Vanessa,

Last time we had a support call, I mentioned you about the two issues we had with octopus. One issue was case sensitivity when using Environment name in Teamcity plugin (Teamcity plugin was failing when I used EAP_STAGE instead of EAP_stage for environment name) and other issue is when we have multiple channels for a project, dashboard shows only the environments from default Channel/Lifecycle. It doesn’t show other environments which are included in other channels/Lifecycle(Which have diff lifecycle). You mentioned about creating issues for these on github, looks like atleast dashboard is still not fixed. Could you please let me know, If there is a work around to fix this. Let me know, If you have any questions.

Thanks,

Ram

Hi Ram,

The dashboard is getting an overhaul for the Multi-tenancy feature in 3.4 where channels were included in the discussions for the design. Due to timing it won’t be included in the beta 1 release, but possibly for beta 2 or just after for the 3.4.1 release.

Vanessa