Update Service Fabric Manifests task

Update Service Fabric App Versions task

Azure Pipelines | Azure DevOps Server 2019 | TFS 2018 | TFS 2017

Use this task in a build pipeline to automatically update the versions of a packaged Service Fabric app. This task appends a version suffix to all service and app versions, specified in the manifest files, in an Azure Service Fabric app package.

Note

This task is not yet available in release pipelines.

Demands

None

YAML snippet

# Update Service Fabric manifests
# Automatically update portions of application and service manifests in a packaged Azure Service Fabric application
- task: ServiceFabricUpdateManifests@2
  inputs:
    #updateType: 'Manifest versions' # Options: manifest Versions, docker Image Settings
    applicationPackagePath: 
    #versionSuffix: '.$(Build.BuildNumber)' # Required when updateType == Manifest Versions
    #versionBehavior: 'Append' # Optional. Options: append, replace
    #updateOnlyChanged: false # Required when updateType == Manifest Versions
    #pkgArtifactName: # Optional
    #logAllChanges: true # Optional
    #compareType: 'LastSuccessful' # Optional. Options: lastSuccessful, specific
    #buildNumber: # Optional
    #overwriteExistingPkgArtifact: true # Optional
    #imageNamesPath: # Optional
    #imageDigestsPath: # Required when updateType == Docker Image Settings

Arguments

Argument Description
Application Package

The location of the Service Fabric application package to be deployed to the cluster.

  • Example: `$(system.defaultworkingdirectory)/**/drop/applicationpackage`
  • Can include wildcards and variables.
Version Value

The value appended to the versions in the manifest files. Default is `.$(Build.BuildNumber)`.

**Tip:** You can modify the [build number format](https://go.microsoft.com/fwlink/?LinkId=761520) directly or use a [logging command](https://go.microsoft.com/fwlink/?LinkId=821347) to dynamically set a variable in any format. For example, you can use `$(VersionSuffix)` defined in a PowerShell task:

`$versionSuffix = ".$([DateTimeOffset]::UtcNow.ToString('yyyyMMdd.HHmmss'))"`

`Write-Host "##vso[task.setvariable variable=VersionSuffix;]$versionSuffix"`

Version Behavior

Specify whether to append the version value to existing values in the manifest files, or replace them.

Update only if changed

Select this check box if you want to append the new version suffix to only the packages that have changed from a previous build. If no changes are found, the version suffix from the previous build will be appended.

**Note:** By default, the compiler will create different outputs even if you made no changes. Use the [deterministic compiler flag](https://go.microsoft.com/fwlink/?LinkId=808668) to ensure builds with the same inputs produce the same outputs.

Package Artifact Name

The name of the artifact containing the application package from the previous build.

Log all changes

Select this check box to compare all files in every package and log if the file was added, removed, or if its content changed. Otherwise, compare files in a package only until the first change is found for potentially faster performance.

Compare against

Specify whether to compare against the last completed, successful build or against a specific build.

Build Number

If comparing against a specific build, the build number to use.

Control options

Also see: Service Fabric Application Deployment task

This task can only be used in a build pipeline to automatically update the versions of a packaged Service Fabric app.

This task support two types of update:

  1. Manifest version: It will update Service and Application versions specified in manifest files in Service fabric application package. It specified, it compares current files against a previous build and updates version only for those services which have been changed.

  2. Docker image settings: It will update docker container image settings specified in manifest files in Service fabric application package. The image settings to be placed are picked from two files:

    a. Image names file: This file is generated by build task

    b. Image digests file: This file is generated by docker task when it pushes images to registry

Task Inputs

ParametersDescription
updateType
Update Type
(Required) Specify the type of update that should be made to the manifest files. In order to use both update types, add an instance of this task to the build pipeline for each type of update to be executed
Default value: Manifest versions
applicationPackagePath
Application Package
(Required) Path to the application package. [Variables](https://go.microsoft.com/fwlink/?LinkID=550988) and wildcards can be used in the path
versionSuffix
Version Value
(Required) The value used to specify the version in the manifest files. Default is .$(Build.BuildNumber)
Default value: .$(Build.BuildNumber)
versionBehavior
Version Behavior
Specify whether to append the version value to existing values in the manifest files or replace them
Default value: Append
updateOnlyChanged
Update only if changed
(Required) Incrementally update only the packages that have changed. Use the [deterministic compiler flag](https://go.microsoft.com/fwlink/?LinkId=808668) to ensure builds with the same inputs produce the same outputs
Default value: false
pkgArtifactName
Package Artifact Name
The name of the artifact containing the application package for comparison
logAllChanges
Log all changes
Compare all files in every package and log if the file was added, removed, or if its content changed. Otherwise, compare files in a package only until the first change is found for faster performance
Default value: true
compareType
Compare against
The build for comparison
Default value: LastSuccessful
buildNumber
Build Number
The build number for comparison
overwriteExistingPkgArtifact
Overwrite Existing Package Artifact
Always download a new copy of the artifact. Otherwise use an existing copy, if present
Default value: true
imageNamesPath
Image Names Path
Path to a text file that contains the names of the Docker images associated with the Service Fabric application that should be updated with digests. Each image name must be on its own line and must be in the same order as the digests in Image Digests file. If the images are created by the Service Fabric project, this file is generated as part of the Package target and its output location is controlled by the property BuiltDockerImagesFilePath
imageDigestsPath
Image Digests Path
(Required) Path to a text file that contains the digest values of the Docker images associated with the Service Fabric application. This file can be output by the [Docker task](https://go.microsoft.com/fwlink/?linkid=848006) when using the push action. The file should contain lines of text in the format of 'registry/image_name@digest_value'

Example

Also see: Service Fabric Application Deployment task

Open source

This task is open source on GitHub. Feedback and contributions are welcome.

Q & A

Do I need an agent?

You need at least one agent to run your build or release. Get an agent for Linux, macOS, or Windows.

I'm having problems. How can I troubleshoot them?

See Troubleshoot Build and Release.

I can't select a default agent pool and I can't queue my build or release. How do I fix this?

See Agent pools.

I use TFS on-premises and I don't see some of these features. Why not?

Some of these features are available only on Azure Pipelines and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.