5
votes

I have tried to set up continuous integration to deploy my Azure Service Fabric cluster automatically on git push events in Team Services. I followed the default template for a Team Services Build Definition and a Team Services Release Definition based on this guide:

Set up continuous integration for a Service Fabric application by using Visual Studio Team Services

Here are my settings: Build Definition Release Definition

For the most part everything works for the first deployment. After that it throws the following error:

An application with name 'fabric:/<APP>' already exists, its type is '<APP>Type' and version is '1.0.0.20160812.7'. You must first remove the existing application before a new application can be deployed or provide a new name for the application.

From that it appears as though it is trying to completely redeploy the service instead of just upgrading the service. I have searched through all of the settings and tried creating and recreating the tasks but have not been able to resolve.

Has anyone encountered this before?

2

2 Answers

16
votes

You need to add or update a publish profile to enable the upgrade mode and use that profile to deploy the Service Fabric after the first deployment is succeed.

To do this quickly, you can right click on your project and select "Publish" from Visual Studio, check "Upgrade the Application" option and click "Configure Upgrade Settings" if needed, and then click “Save Profile" link and commit/push the changes. enter image description here

4
votes

Though there is an accepted answer, I would still like to add to this thread. In the approach below we need to edit only the Azure Devops Task. Hopefully this will be useful to others who may encounter the same issue: One simple workaround when you encounter this issue is to change the "Overwrite Behavior" under the Advanced Setting for the build task to "Always". However, care must also be exercised so that if there are services which may already be running - all of them do get upgraded via a rolling upgrade (see second image).

enter image description here

To ensure that rolling upgrade is applied to all the services, in addition to the above, also ensure that the upgrade settings are configured as below:

Upgrade Settings