Service Fabric Application Deployment task
Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018
Use this task to deploy a Service Fabric application to a cluster. This task deploys an Azure Service Fabric application to a cluster according to the settings defined in the publish profile.
Note
In Microsoft Team Foundation Server (TFS) 2018 and previous versions, build and release pipelines are called definitions, runs are called builds, service connections are called service endpoints, stages are called environments, and jobs are called phases.
Prerequisites
Service Fabric
This task uses a Service Fabric installation to connect and
deploy to a Service Fabric cluster.
Download and install Service Fabric on the build agent.
YAML snippet
# Service Fabric application deployment
# Deploy an Azure Service Fabric application to a cluster
- task: ServiceFabricDeploy@1
inputs:
applicationPackagePath:
serviceConnectionName:
#publishProfilePath: # Optional
#applicationParameterPath: # Optional
#overrideApplicationParameter: false # Optional
#compressPackage: false # Optional
#copyPackageTimeoutSec: # Optional
#registerPackageTimeoutSec: # Optional
#overwriteBehavior: 'SameAppTypeAndVersion' # Options: always, never, sameAppTypeAndVersion
#skipUpgradeSameTypeAndVersion: false # Optional
#skipPackageValidation: false # Optional
#useDiffPackage: false # Optional
#overridePublishProfileSettings: false # Optional
#isUpgrade: true # Optional
#unregisterUnusedVersions: true # Optional
#upgradeMode: 'Monitored' # Required when overridePublishProfileSettings == True && IsUpgrade == True# Options: monitored, unmonitoredAuto, unmonitoredManual
#failureAction: 'Rollback' # Required when overridePublishProfileSettings == True && IsUpgrade == True && UpgradeMode == Monitored# Options: rollback, manual
#upgradeReplicaSetCheckTimeoutSec: # Optional
#timeoutSec: # Optional
#forceRestart: false # Optional
#healthCheckRetryTimeoutSec: # Optional
#healthCheckWaitDurationSec: # Optional
#healthCheckStableDurationSec: # Optional
#upgradeDomainTimeoutSec: # Optional
#considerWarningAsError: false # Optional
#defaultServiceTypeHealthPolicy: # Optional
#maxPercentUnhealthyDeployedApplications: # Optional
#upgradeTimeoutSec: # Optional
#serviceTypeHealthPolicyMap: # Optional
#configureDockerSettings: false # Optional
#registryCredentials: 'AzureResourceManagerEndpoint' # Required when configureDockerSettings == True# Options: azureResourceManagerEndpoint, containerRegistryEndpoint, usernamePassword
#dockerRegistryConnection: # Required when configureDockerSettings == True && RegistryCredentials == ContainerRegistryEndpoint
#azureSubscription: # Required when configureDockerSettings == True && RegistryCredentials == AzureResourceManagerEndpoint
#registryUserName: # Optional
#registryPassword: # Optional
#passwordEncrypted: true # Optional
Task Inputs
| Parameters | Description |
|---|---|
applicationPackagePathApplication Package | (Required) Path to the application package that is to be deployed. [Variables](../../build/variables.md) and wildcards can be used in the path |
serviceConnectionNameCluster Service Connection | (Required) Select an Azure Service Fabric service connection to be used to connect to the cluster. The settings defined in this referenced service connection will override those defined in the publish profile. Choose 'Manage' to register a new service connection. To connect to the cluster, the service fabric task uses the machine cert store to store the information about the certificate. Using the same certificate, if two releases run together on one machine they will start properly. However, if one of the tasks is complete, the certificate from the machine cert store would be cleaned up, which would affect the second release |
publishProfilePathPublish Profile | (Optional) Path to the publish profile file that defines the settings to use. [Variables](../../build/variables.md) and wildcards can be used in the path. Publish profiles can be created in Visual Studio as shown here |
applicationParameterPathApplication Parameters | (Optional) Path to the application parameters file. [Variables](../../build/variables.md) and wildcards can be used in the path. If specified, this will override the value in the publish profile. Application parameters file can be created in Visual Studio as shown here |
overrideApplicationParameterOverride Application Parameters | (Optional) Variables defined in the build or release pipeline will be matched against the 'Parameter Name' entries in the application manifest file. Application parameters file can be created in Visual Studio as shown here Example: If your application has a parameter defined as below-
and you want to change the partition count to 2, you can define a release pipeline or an environment variable "SampleApp_PartitionCount" and its value as "2". |
compressPackageCompress Package | (Optional) Indicates whether the application package should be compressed before copying to the image store. If enabled, this will override the value in the publish profile. More information for compress package can be found here Default value: false |
copyPackageTimeoutSecCopyPackageTimeoutSec | (Optional) Timeout in seconds for copying application package to image store. If specified, this will override the value in the publish profile |
registerPackageTimeoutSecRegisterPackageTimeoutSec | (Optional) Timeout in seconds for registering or un-registering application package |
overwriteBehaviorOverwrite Behavior | (Required) Overwrite Behavior: when upgrade is not configured and an Application with same name already exists in the cluster, then following actions are available => Never, Always, SameAppTypeAndVersion. Never will not remove the existing Application. This is the default behavior. Always will remove the existing Application even if its Application type and Version is different from the Application being created. SameAppTypeAndVersion will remove the existing Application only if its Application type and Version is same as the Application being created Default value: SameAppTypeAndVersion |
skipUpgradeSameTypeAndVersionSkip upgrade for same Type and Version | (Optional) Indicates whether an upgrade will be skipped if the same application type and version already exists in the cluster, otherwise the upgrade fails during validation. If enabled, re-deployments are idempotent. Default value: false |
skipPackageValidationSkip package validation | (Optional) Indicates whether the package should be validated or not before deployment. More information about package validation can be found here Default value: false |
useDiffPackageUse Diff Package | (Optional) Diff package is created by task by comparing the package specified in Application Package input against the package which is currently registered in the target cluster. If a service version in cluster's current package is same as the new package, then this service package will be removed from new Application package. See more details about diff package here. Default value: false |
overridePublishProfileSettingsOverride All Publish Profile Upgrade Settings | (Optional) This will override all upgrade settings with either the values specified below or the default value if not specified. More information about upgrade settings can be found here Default value: false |
isUpgradeUpgrade the Application | (Optional) If false, the application will be overwritten. Default value: true |
unregisterUnusedVersionsUnregister Unused Versions | (Optional) Indicates whether all unused versions of the application type will be removed after an upgrade Default value: true |
upgradeModeUpgrade Mode | (Required) Default value: Monitored |
FailureActionFailureAction | (Required) Default value: Rollback |
UpgradeReplicaSetCheckTimeoutSecUpgradeReplicaSetCheckTimeoutSec | (Optional) |
TimeoutSecTimeoutSec | (Optional) |
ForceRestartForceRestart | (Optional) Default value: false |
HealthCheckRetryTimeoutSecHealthCheckRetryTimeoutSec | (Optional) |
HealthCheckWaitDurationSecHealthCheckWaitDurationSec | (Optional) |
HealthCheckStableDurationSecHealthCheckStableDurationSec | (Optional) |
UpgradeDomainTimeoutSecUpgradeDomainTimeoutSec | (Optional) |
ConsiderWarningAsErrorConsiderWarningAsError | (Optional) Default value: false |
DefaultServiceTypeHealthPolicyDefaultServiceTypeHealthPolicy | (Optional) |
MaxPercentUnhealthyDeployedApplicationsMaxPercentUnhealthyDeployedApplications | (Optional) |
UpgradeTimeoutSecUpgradeTimeoutSec | (Optional) |
ServiceTypeHealthPolicyMapServiceTypeHealthPolicyMap | (Optional) |
configureDockerSettingsConfigure Docker settings | Default value: false |
registryCredentialsRegistry Credentials Source | (Required) Choose how credentials for the Docker registry will be provided Default value: AzureResourceManagerEndpoint |
dockerRegistryEndpointDocker Registry Service Connection | (Required) Select a Docker registry service connection. Required for commands that need to authenticate with a registry. Note: task will try to encrypt the registry secret before transmitting it to service fabric cluster. However, it needs cluster's server certificate to be installed on agent machine in order to do so. If certificate is not present, secret will not be encrypted |
azureSubscriptionEndpointAzure subscription | (Required) Select an Azure subscription. Note: task will try to encrypt the registry secret before transmitting it to service fabric cluster. However, it needs cluster's server certiticate to be installed on agent machine in order to do so. If certificate is not present, secret will not be encrypted |
registryUserNameRegistry User Name | (Optional) Username for the Docker registry |
registryPasswordRegistry Password | (Optional) Password for the Docker registry. If the password is not encrypted, it is recommended that you use a custom release pipeline secret variable to store it |
passwordEncryptedPassword Encrypted | (Optional) It is recommended to encrypt your password using [Invoke-ServiceFabricEncryptText](/azure/service-fabric/service-fabric-application-secret-management#encrypt-application-secrets). If you do not, and a certificate matching the Server Certificate Thumbprint in the Cluster Service Connection is installed on the build agent, it will be used to encrypt the password; otherwise an error will occur |
Also see: Update Service Fabric Manifests task
Arguments
| Argument | Description |
|---|---|
| Publish Profile | The location of the publish profile that specifies the settings to use for deployment, including the location of the target Service Fabric cluster. Can include wildcards and variables. Example:$(system.defaultworkingdirectory)/**/drop/projectartifacts/**/PublishProfiles/Cloud.xml |
| Application Package | The location of the Service Fabric application package to be deployed to the cluster. Can include wildcards and variables. Example: $(system.defaultworkingdirectory)/**/drop/applicationpackage |
| Cluster Connection | The name of the Azure Service Fabric service connection defined in the TS/TFS project that describes the connection to the cluster. |
| Control options | See Control options |
Also see: Update Service Fabric App Versions task
Open source
This task is open source on GitHub. Feedback and contributions are welcome.
الملاحظات
إرسال الملاحظات وعرضها المتعلقة بـ