Differential packaging

If you want to do partial upgrades, this is how I’ve done it:

Given

app1 1.0.0
  service1 1.0.0
    code 1.0.0
    config 1.0.0
  service2 1.0.0
    code 1.0.0
    config 1.0.0

And you want to update only Service 1 to version 1.0.1 as shown below:

app1 1.0.1
  service1 1.0.1
    code 1.0.1
    config 1.0.1
  service2 1.0.0
    code 1.0.0
    config 1.0.0

In your Service1, update the ServiceManifest.xml to have correct version numbers (the service itself and the different packages you want to upgrade).
Then, in your service2 folder, delete everything except the ServiceManifest.xml.

In your ApplicationManifest.xml, you should keep the ServiceManifestImport for Service2 at version 1.0.0. Also update the versionnumber for ServiceManifestImport for Service1.

After that is done, you should be able to do a:

Test-ServiceFabricApplicationPackage $packagePath -ImageStoreConnectionString $ImageStoreConnectionString

to validate that the package works. What this does (as far as I understand) is it uses the local package along with the currently deployed package, and those two combined should then equal a valid complete package.

So, basically, the only thing that changes is:

  • You remove the things you don’t want in your package (but you keep
    the ServiceManifest.xml)
  • You update the version numbers in the services that have changed
  • You update the version numbers in the application manifest for both the application, and the changed services.

Also, see this documentation: https://azure.microsoft.com/en-us/documentation/articles/service-fabric-application-upgrade-advanced/#upgrade-with-a-diff-package

Regarding getting the image store to use for the Test-ServiceFabricApplicationPackage call (you can find it all by looking at the default deploy scripts, but here’s what you need):

Open powershell
Connect to your cluster (Connect-ServiceFabricCluster ...)
Execute the following commands:

$ClusterManifestRaw = Get-ServiceFabricClusterManifest
$ClusterManifestXml = [xml]$ClusterManifestRaw
$ManagementSection = $ClusterManifestXml.ClusterManifest.FabricSettings.Section | ? { $_.Name -eq "Management" }
$ImageStoreConnectionString = $ManagementSection .ChildNodes | ? { $_.Name -eq "ImageStoreConnectionString" } | Select-Object -Expand Value

Leave a Comment