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:
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?
In Select a template, select the Azure Service Fabric application template and click Apply. In Tasks, enter "Hosted VS2017" as the Agent pool. Under Triggers, enable continuous integration by checking Enable continuous integration. Within Branch filters, the Branch specification defaults to master. Select Save and queue to manually start a build.
Start Visual Studio and open an existing Service Fabric application project. In Solution Explorer, right-click the application and select Publish.... Choose a target profile within your application project to use for your continuous integration workflow, for example Cloud. Specify the cluster connection endpoint.
Thank you. You can manage your Azure Service Fabric applications and services through Visual Studio. Once you've set up your development environment, you can use Visual Studio to create Service Fabric applications, add services, or package, register, and deploy applications in your local development cluster.
An Azure Pipelines build pipeline describes a workflow that is composed of a set of build steps that are executed sequentially. Create a build pipeline that produces a Service Fabric application package, and other artifacts, to deploy to a Service Fabric cluster. Learn more about Azure Pipelines build pipelines.
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.
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).
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With