Can I create multiple "Create Octopus Release" tasks in one pipeline?

Hi

I have created 2 “Create Octopus Release” tasks in a pipeline:
image
But I get an error when I queue this pipeline:


Can I set more than one “Create Octopus Release” in a pipeline at the same time?

Hi @lily.jiang,

Thanks for reaching out! :slight_smile:

Are there any logs on the Octopus Server side at the same time as when you attempted the deployment? You should be able to find these in C:/Octopus/Logs or /Home/Octopus/Logs by default.
Is it possible that there is already a release in that environment with the build/version number you’re attempting to create via ADO?

Looking forward to hearing back!

Kind Regards,
Adam

I have deleted the previous version before queue. I don’t think the error is due to a version problem :smiley:

Hi @lily.jiang,

There shouldn’t be any issues with using more than one of those steps in a pipeline simultaneously.
Others have reported similar issues that were resolved by changing the task version in the task, is this something you can test?

Can you successfully create a release manually within Octopus using the same channel/environment as you’re targeting with that Create Octopus Release step?

Kind Regards,
Adam

Yes, I can do the deployment you mentioned manually.

Hi @lily.jiang,

It looks as though you’re trying to create two releases for the same project, which will almost ensure that the 2nd ‘Create a Release’ step is trying to create the same release version as the 1st step.

Would you be able to show us how you have those Create Release steps configured and send over a build log from an errored build so we can look into it further?

If you’re able to, could you give a high-level overview of what you’re trying to achieve with the two build steps and we can possibly suggest a different approach or it may help pinpoint the fault?

Kind Regards,
Adam





As you said, I want to release the same version of the program to multiple environments/sites in one build, how do I solve this problem?
Thank you very much!


ps: Why is there no version conflict when I deploy manually?

Hi @lily.jiang,

If you’re wanting to deploy the new build to multiple environments or tenants then it isn’t necessary to create multiple Releases.

There are two other ways to handle this.

The first would be to replace the second “Create Release” step within your build pipeline with a “Deploy Octopus Release” step. This would mean that your build pipeline would only create a single Release and then deploy it to whichever environments and tenants you require. This would make it much easier for you to keep track of where your builds are deployed.

The other option would be to configure your Lifecycle for this project to deploy automatically to specific environments within a Phase. This would deploy to the entire environment though, rather than to select Tenants, so, may be too much for what you’re wanting.

Regards,
Paul

Hi Paul,

Following the solution you provided has perfectly solved the problem I had before I encountered.

But I have another problem: every time I publish from Azure DevOps, the DEV environment is always published twice. Where should I look for the cause of the problem?

I need to change the task in the red box to “Deploy…” task?

Thank you !

Hi @lily.jiang,

I believe that the double deployment is occurring due to a combination of a “Deploy Release” step (or enabled option within a Create Release step) within your build pipeline and the Dev environment being set to auto-deploy within the Lifecycle.

If I remember correctly, I believe your “Create Octopus Release to Dev” build step had the Deployment option enabled. If that is still the case then disabling that option should resolve the duplicate deployment problem.

Regards,

Hi Paul,

The situation is the same as what you said.

But I can’t modify the lifecycle because there are several projects using the same lifecycle.

And when I disable “Create Octopus Release to Dev” in Azure DevOps, the latest version of the application cannot be deployed to the server.

If you expand the Deployment section, are there any options configured within there? If so, those are likely the ones that would need amending/removing.

e.g.

That’s correct.
Removing the Development environment from that box should prevent that step from triggering a deployment and instead allow the Lifecycle auto-deploy to handle that part.

Thank you very much. The problem has been solved! :100:

1 Like