Redaguoti

Bendrinti naudojant


AzureSpringCloud@0 - Azure Spring Apps v0 task

This task deploys applications to Azure Spring Apps and manages those deployments.

Syntax

# Azure Spring Apps v0
# Deploy applications to Azure Spring Apps and manage deployments.
- task: AzureSpringCloud@0
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure subscription. 
    Action: 'Deploy' # 'Deploy' | 'Set Production' | 'Delete Staging Deployment'. Required. Action. Default: Deploy.
    AzureSpringCloud: # string. Required. Azure Spring Apps Name. 
    AppName: # string. Required. App. 
    #DeploymentType: 'Artifacts' # 'Artifacts' | 'CustomContainer'. Optional. Use when Action = Deploy. Deployment Type. Default: Artifacts.
    #UseStagingDeployment: true # boolean. Optional. Use when Action = Deploy || Action = Set Production. Use Staging Deployment. Default: true.
    #CreateNewDeployment: false # boolean. Optional. Use when Action = Deploy && UseStagingDeployment = false. Create a new staging deployment if one does not exist. Default: false.
    #DeploymentName: # string. Optional. Use when UseStagingDeployment = false && Action != Delete Staging Deployment. Deployment. 
    #Package: '$(System.DefaultWorkingDirectory)/**/*.jar' # string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Package or folder. Default: $(System.DefaultWorkingDirectory)/**/*.jar.
    #RegistryServer: 'docker.io' # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Registry Server. Default: docker.io.
    #RegistryUsername: # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Registry Username. 
    #RegistryPassword: # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Registry Password. 
    #ImageName: 'hello-world:v1' # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Image Name and Tag. Default: hello-world:v1.
    #ImageCommand: # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Image Command. 
    #ImageArgs: # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Image Arguments. 
    #ImageLanguageFramework: # 'springboot'. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Language Framework. 
  # Application and Configuration Settings
    #Builder: # string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Builder. 
    #EnvironmentVariables: # string. Optional. Use when Action = Deploy. Environment Variables. 
    #JvmOptions: # string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. JVM Options. 
    #RuntimeVersion: 'Java_11' # 'Java_8' | 'Java_11' | 'Java_17' | 'Java_21' | 'NetCore_31'. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Runtime Version. Default: Java_11.
    #DotNetCoreMainEntryPath: # string. Optional. Use when RuntimeVersion = NetCore_31. Main Entry Path. 
    #Version: # string. Optional. Use when Action = Deploy. Version.
# Azure Spring Apps v0
# Deploy applications to Azure Spring Apps and manage deployments.
- task: AzureSpringCloud@0
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure subscription. 
    Action: 'Deploy' # 'Deploy' | 'Set Production' | 'Delete Staging Deployment'. Required. Action. Default: Deploy.
    AzureSpringCloud: # string. Required. Azure Spring Apps Name. 
    AppName: # string. Required. App. 
    #DeploymentType: 'Artifacts' # 'Artifacts' | 'CustomContainer'. Optional. Use when Action = Deploy. Deployment Type. Default: Artifacts.
    #UseStagingDeployment: true # boolean. Optional. Use when Action = Deploy || Action = Set Production. Use Staging Deployment. Default: true.
    #CreateNewDeployment: false # boolean. Optional. Use when Action = Deploy && UseStagingDeployment = false. Create a new staging deployment if one does not exist. Default: false.
    #DeploymentName: # string. Optional. Use when UseStagingDeployment = false && Action != Delete Staging Deployment. Deployment. 
    #Package: '$(System.DefaultWorkingDirectory)/**/*.jar' # string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Package or folder. Default: $(System.DefaultWorkingDirectory)/**/*.jar.
    #RegistryServer: 'docker.io' # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Registry Server. Default: docker.io.
    #RegistryUsername: # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Registry Username. 
    #RegistryPassword: # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Registry Password. 
    #ImageName: 'hello-world:v1' # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Image Name and Tag. Default: hello-world:v1.
    #ImageCommand: # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Image Command. 
    #ImageArgs: # string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Image Arguments. 
    #ImageLanguageFramework: # 'springboot'. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Language Framework. 
  # Application and Configuration Settings
    #Builder: # string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Builder. 
    #EnvironmentVariables: # string. Optional. Use when Action = Deploy. Environment Variables. 
    #JvmOptions: # string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. JVM Options. 
    #RuntimeVersion: 'Java_11' # 'Java_8' | 'Java_11' | 'NetCore_31'. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Runtime Version. Default: Java_11.
    #DotNetCoreMainEntryPath: # string. Optional. Use when RuntimeVersion = NetCore_31. Main Entry Path. 
    #Version: # string. Optional. Use when Action = Deploy. Version.
# Azure Spring Apps v0
# Deploy applications to Azure Spring Apps and manage deployments.
- task: AzureSpringCloud@0
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceName. Required. Azure subscription. 
    Action: 'Deploy' # 'Deploy' | 'Set Production' | 'Delete Staging Deployment'. Required. Action. Default: Deploy.
    AzureSpringCloud: # string. Required. Azure Spring Apps Name. 
    AppName: # string. Required. App. 
    #UseStagingDeployment: true # boolean. Optional. Use when Action = Deploy || Action = Set Production. Use Staging Deployment. Default: true.
    #CreateNewDeployment: false # boolean. Optional. Use when Action = Deploy && UseStagingDeployment = false. Create a new staging deployment if one does not exist. Default: false.
    #DeploymentName: # string. Optional. Use when UseStagingDeployment = false && Action != Delete Staging Deployment. Deployment. 
    #Package: '$(System.DefaultWorkingDirectory)/**/*.jar' # string. Optional. Use when Action = Deploy. Package or folder. Default: $(System.DefaultWorkingDirectory)/**/*.jar.
  # Application and Configuration Settings
    #EnvironmentVariables: # string. Optional. Use when Action = Deploy. Environment Variables. 
    #JvmOptions: # string. Optional. Use when Action = Deploy. JVM Options. 
    #RuntimeVersion: 'Java_11' # 'Java_8' | 'Java_11' | 'NetCore_31'. Optional. Use when Action = Deploy. Runtime Version. Default: Java_11.
    #DotNetCoreMainEntryPath: # string. Optional. Use when RuntimeVersion = NetCore_31. Main Entry Path. 
    #Version: # string. Optional. Use when Action = Deploy. Version.

Inputs

azureSubscription - Azure subscription
Input alias: ConnectedServiceName. string. Required.

Specifies the Azure Resource Manager subscription for the deployment.


Action - Action
string. Required. Allowed values: Deploy, Set Production (Set Production Deployment), Delete Staging Deployment. Default value: Deploy.

The action to be performed on Azure Spring Apps.


AzureSpringCloud - Azure Spring Apps Name
string. Required.

The name or resource ID of the Azure Spring Apps instance to deploy.


AppName - App
string. Required.

The name of the Azure Spring Apps app to deploy. The app must exist prior to the task execution.


DeploymentType - Deployment Type
string. Optional. Use when Action = Deploy. Allowed values: Artifacts, CustomContainer (Custom Container). Default value: Artifacts.

To deploy with source code or Java package, choose "Artifacts"; To deploy with container image, choose "Custom Container".


UseStagingDeployment - Use Staging Deployment
boolean. Optional. Use when Action = Deploy || Action = Set Production. Default value: true.

At the time the task runs, this input automatically selects the deployment that's set as staging.

If set to true, apply the task to the deployment that is set as the staging deployment at time of execution. If omitted, the DeploymentName parameter must be set.


CreateNewDeployment - Create a new staging deployment if one does not exist.
boolean. Optional. Use when Action = Deploy && UseStagingDeployment = false. Default value: false.

If set to true, and the deployment specified by DeploymentName does not exist at execution time, it will be created. If omitted, the DeploymentName parameter must be set.


DeploymentName - Deployment
string. Optional. Use when UseStagingDeployment = false && Action != Delete Staging Deployment.

The deployment to which this task will apply. If not using blue-green deployments, set this field to default. The value must start with a letter and consist of lowercase letters and numbers only.


Package - Package or folder
string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Default value: $(System.DefaultWorkingDirectory)/**/*.jar.

The file path to the package or folder containing the Azure Spring Apps app contents (.jar file for Java, .zip for .NET Core).
Variables ( Build | Release) and wildcards are supported.
For example, $(System.DefaultWorkingDirectory)/**/*.jar


Package - Package or folder
string. Optional. Use when Action = Deploy. Default value: $(System.DefaultWorkingDirectory)/**/*.jar.

The file path to the package or folder containing the Azure Spring Apps app contents (.jar file for Java, .zip for .NET Core).
Variables ( Build | Release) and wildcards are supported.
For example, $(System.DefaultWorkingDirectory)/**/*.jar


Builder - Builder
string. Optional. Use when Action = Deploy && DeploymentType = Artifacts.

Select a builder of VMware Tanzu® Build Service™, this can be used in enterprise tier.
For detailed description, please check Use Tanzu Build Service.


RegistryServer - Registry Server
string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Default value: docker.io.

The registry of the container image. Default: docker.io.


RegistryUsername - Registry Username
string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer.

The username of the container registry.


RegistryPassword - Registry Password
string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer.

The password of the container registry.


ImageName - Image Name and Tag
string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Default value: hello-world:v1.

The container image tag.


ImageCommand - Image Command
string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer.

The command of the container image.


ImageArgs - Image Arguments
string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer.

The arguments of the container image.


ImageLanguageFramework - Language Framework
string. Optional. Use when Action = Deploy && DeploymentType = CustomContainer. Allowed values: springboot.


EnvironmentVariables - Environment Variables
string. Optional. Use when Action = Deploy.

The environment variables to be entered using the syntax -key value (for example: -CUSTOMER_NAME Contoso -WEBSITE_TIME_ZONE). Values containing spaces should be enclosed in double quotes (for example: "Eastern Standard Time").


JvmOptions - JVM Options
string. Optional. Use when Action = Deploy && DeploymentType = Artifacts.

Edits the app's JVM options. A string containing JVM options, such as -Xms1024m -Xmx2048m.


JvmOptions - JVM Options
string. Optional. Use when Action = Deploy.

Edits the app's JVM options. A string containing JVM options, such as -Xms1024m -Xmx2048m.


RuntimeVersion - Runtime Version
string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Allowed values: Java_8 (Java 8), Java_11 (Java 11), Java_17 (Java 17), Java_21 (Java 21), NetCore_31 (.Net Core 3.1). Default value: Java_11.

The runtime version on which the app will run.


RuntimeVersion - Runtime Version
string. Optional. Use when Action = Deploy && DeploymentType = Artifacts. Allowed values: Java_8 (Java 8), Java_11 (Java 11), NetCore_31 (.Net Core 3.1). Default value: Java_11.

The runtime version on which the app will run.


RuntimeVersion - Runtime Version
string. Optional. Use when Action = Deploy. Allowed values: Java_8 (Java 8), Java_11 (Java 11), NetCore_31 (.Net Core 3.1). Default value: Java_11.

The runtime version on which the app will run.


DotNetCoreMainEntryPath - Main Entry Path
string. Optional. Use when RuntimeVersion = NetCore_31.

The path to the .NET executable relative to the zip root.


Version - Version
string. Optional. Use when Action = Deploy.

The deployment version. If not set, the version is left unchanged.


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

This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.

testEndpoint
After the 'Deploy' action only. Contains private URL for accessing the updated deployment.

Remarks

Use this task to deploy applications to Azure Spring Apps and to manage Azure Spring Cloud deployments.

Examples

The following examples demonstrate common usage scenarios. For more information, see Automate application deployments to Azure Spring Apps.

Deleting a staging deployment

The "Delete Staging Deployment" action allows you to delete the deployment not receiving production traffic. This frees up resources used by that deployment and makes room for a new staging deployment:

variables:
  azureSubscription: Contoso

steps:
- task: AzureSpringCloud@0
  continueOnError: true # Don't fail the pipeline if a staging deployment doesn't already exist.
  inputs:
    continueOnError: true
    inputs:
    azureSubscription: $(azureSubscription)
    Action: 'Delete Staging Deployment'
    AppName: customer-api
    AzureSpringCloud: contoso-dev-az-spr-cld

Deploying

To production

The following example deploys to the default production deployment in Azure Spring Apps. This is the only possible deployment scenario when using the Basic SKU:

Note

The package search pattern should only return exactly one package. If the build task produces multiple JAR packages such as sources.jar and javadoc.jar, you need to refine the search pattern so that it only matches the application binary artifact.

variables:
  azureSubscription: Contoso

steps:
- task: AzureSpringCloud@0
    inputs:
    azureSubscription: $(azureSubscription)
    Action: 'Deploy'
    AzureSpringCloud: contoso-dev-az-spr-cld
    AppName: customer-api
    UseStagingDeployment: false
    DeploymentName: default
    Package: '$(System.DefaultWorkingDirectory)/**/*customer-api*.jar'

Blue-green

The following example deploys to a pre-existing staging deployment. This deployment will not receive production traffic until it is set as a production deployment.

variables:
  azureSubscription: Contoso

steps:
- task: AzureSpringCloud@0
    inputs:
    azureSubscription: $(azureSubscription)
    Action: 'Deploy'
    AzureSpringCloud: contoso-dev-az-spr-cld
    AppName: customer-api
    UseStagingDeployment: true
    Package: '$(System.DefaultWorkingDirectory)/**/*customer-api*.jar'

For more on blue-green deployments, including an alternative approach, see Blue-green deployment strategies.

Setting production deployment

The following example sets the current staging deployment as production, effectively swapping which deployment receives production traffic.

variables:
  azureSubscription: Contoso

steps:
- task: AzureSpringCloud@0
    inputs:
    azureSubscription: $(azureSubscription)
    Action: 'Set Production'
    AzureSpringCloud: contoso-dev-az-spr-cld
    AppName: customer-api
    UseStagingDeployment: true

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.104.1 or greater
Task category Deploy