แก้ไข

แชร์ผ่าน


ServiceFabricUpdateManifests@2 - Update Service Fabric manifests v2 task

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.

Syntax

# Update Service Fabric manifests v2
# Automatically update portions of application and service manifests in a packaged Azure Service Fabric application.
- task: ServiceFabricUpdateManifests@2
  inputs:
    updateType: 'Manifest versions' # 'Manifest versions' | 'Docker image settings'. Required. Update Type. Default: Manifest versions.
    applicationPackagePath: # string. Required. Application Package. 
    #versionSuffix: '.$(Build.BuildNumber)' # string. Required when updateType = Manifest versions. Version Value. Default: .$(Build.BuildNumber).
    #versionBehavior: 'Append' # 'Append' | 'Replace'. Optional. Use when updateType = Manifest versions. Version Behavior. Default: Append.
    #updateOnlyChanged: false # boolean. Optional. Use when updateType = Manifest versions. Update only if changed. Default: false.
    #pkgArtifactName: # string. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Package Artifact Name. 
    #logAllChanges: true # boolean. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Log all changes. Default: true.
    #compareType: 'LastSuccessful' # 'LastSuccessful' | 'Specific'. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Compare against. Default: LastSuccessful.
    #buildNumber: # string. Optional. Use when updateType = Manifest versions && compareType = Specific. Build Number. 
    #overwriteExistingPkgArtifact: true # boolean. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Overwrite Existing Package Artifact. Default: true.
    #imageNamesPath: # string. Optional. Use when updateType = Docker image settings. Image Names Path. 
    #imageDigestsPath: # string. Required when updateType = Docker image settings. Image Digests Path.
# Update Service Fabric Manifests v2
# Automatically updates portions of the application and service manifests within a packaged Service Fabric application.
- task: ServiceFabricUpdateManifests@2
  inputs:
    updateType: 'Manifest versions' # 'Manifest versions' | 'Docker image settings'. Required. Update Type. Default: Manifest versions.
    applicationPackagePath: # string. Required. Application Package. 
    #versionSuffix: '.$(Build.BuildNumber)' # string. Required when updateType = Manifest versions. Version Value. Default: .$(Build.BuildNumber).
    #versionBehavior: 'Append' # 'Append' | 'Replace'. Optional. Use when updateType = Manifest versions. Version Behavior. Default: Append.
    #updateOnlyChanged: false # boolean. Optional. Use when updateType = Manifest versions. Update only if changed. Default: false.
    #pkgArtifactName: # string. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Package Artifact Name. 
    #logAllChanges: true # boolean. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Log all changes. Default: true.
    #compareType: 'LastSuccessful' # 'LastSuccessful' | 'Specific'. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Compare against. Default: LastSuccessful.
    #buildNumber: # string. Optional. Use when updateType = Manifest versions && compareType = Specific. Build Number. 
    #overwriteExistingPkgArtifact: true # boolean. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Overwrite Existing Package Artifact. Default: true.
    #imageNamesPath: # string. Optional. Use when updateType = Docker image settings. Image Names Path. 
    #imageDigestsPath: # string. Required when updateType = Docker image settings. Image Digests Path.

Inputs

updateType - Update Type
string. Required. Allowed values: Manifest versions, Docker image settings. Default value: Manifest versions.

Specifies 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.


applicationPackagePath - Application Package
string. Required.

Specifies the path to the application package. Variables and wildcards can be used in the path. applicationPackagePath must not have a trailing slash, either \ or /.


versionSuffix - Version Value
string. Required when updateType = Manifest versions. Default value: .$(Build.BuildNumber).

Specifies the version in the manifest files.

Tip

You can modify the build number format directly or use a logging command to dynamically set a variable in a 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"

versionBehavior - Version Behavior
string. Optional. Use when updateType = Manifest versions. Allowed values: Append, Replace. Default value: Append.

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


updateOnlyChanged - Update only if changed
boolean. Optional. Use when updateType = Manifest versions. Default value: false.

Appends 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 no changes were made. Use the deterministic compiler flag to ensure builds with the same inputs produce the same outputs.


pkgArtifactName - Package Artifact Name
string. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true.

Specifies the name of the artifact containing the application package for comparison.


logAllChanges - Log all changes
boolean. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Default value: true.

Compares all files in every package and log if the file was added, removed, or if its content changed. Otherwise, this boolean compares files in a package only until the first change is found for faster performance.


compareType - Compare against
string. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Allowed values: LastSuccessful (Last Successful Build), Specific (Specific Build). Default value: LastSuccessful.

Specifies whether to compare against the last completed and successful build or against a specific build.


buildNumber - Build Number
string. Optional. Use when updateType = Manifest versions && compareType = Specific.

Specifies the build number for comparison.


overwriteExistingPkgArtifact - Overwrite Existing Package Artifact
boolean. Optional. Use when updateType = Manifest versions && updateOnlyChanged = true. Default value: true.

Downloads a new copy of the artifact. Otherwise, this boolean uses an existing copy if present.


imageNamesPath - Image Names Path
string. Optional. Use when updateType = Docker image settings.

Specifies the 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 the 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
string. Required when updateType = Docker image settings.

Specifies the 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 when using the push action. The file should contain lines of text in the format of registry/image_name@digest_value.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

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 requires Windows PowerShell.

This task is not available in release pipelines.

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 updates:

  1. Manifest version: Updates Service and Application versions specified in manifest files in a Service fabric application package. If specified, manifest version compares current files against a previous build and updates the version only for those changed services.

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

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

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

Examples

Requirements

Requirement Description
Pipeline types YAML, Classic build
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: Cmd
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.95.0 or greater
Task category Utility