jobs.deployment.environment definition

The environment keyword specifies the environment or its resource that is targeted by a deployment job of the pipeline.

Properties that use this definition: jobs.deployment.environment

Properties that use this definition: jobs.deployment.environment

Properties that use this definition: jobs.deployment.environment

Overloads

Overload Description
environment: string Deployment job with environment name.
environment: name, resourceName, resourceId, resourceType, tags Full syntax for complete control.
Overload Description
environment: string Deployment job with environment name.
environment: name, resourceName, resourceId, resourceType, tags Full syntax for complete control.
Overload Description
environment: string Deployment job with environment name.
environment: name, resourceName, resourceId, resourceType, tags Full syntax for complete control.

Remarks

An environment also holds information about the deployment strategy for running the steps defined inside the job.

You can reduce the deployment target's scope to a particular resource within the environment as shown here:

environment: 'smarthotel-dev.bookings'
strategy:
  runOnce:
    deploy:
      steps:
      - task: KubernetesManifest@0
        displayName: Deploy to Kubernetes cluster
        inputs:
          action: deploy
          namespace: $(k8sNamespace)
          manifests: $(System.ArtifactsDirectory)/manifests/*
          imagePullSecrets: $(imagePullSecret)
          containers: $(containerRegistry)/$(imageRepository):$(tag)
          # value for kubernetesServiceConnection input automatically passed down to task by environment.resource input

environment: string

To specify an environment by name without using any additional properties, use the following syntax.

environment: string # Target environment name and optionally a resource name to record the deployment history; format: environment-name.resource-name.

Properties

deploymentEnvironment

string


environment: string # Target environment name and optionally a resource name to record the deployment history; format: environment-name.resource-name.

Properties

deploymentEnvironment

string


environment: string # Target environment name and optionally a resource name to record the deployment history; format: environment-name.resource-name.

Properties

deploymentEnvironment

string


Examples

environment: environmentName.resourceName
strategy:                 # deployment strategy
  runOnce:              # default strategy
    deploy:
      steps:
      - script: echo Hello world

environment: name, resourceName, resourceId, resourceType, tags

To configure other properties in addition to the name, use the full syntax.

environment:
  name: string # Name of environment. 
  resourceName: string # Name of resource. 
  resourceId: string # Id of resource. 
  resourceType: string # Type of environment resource. 
  tags: string # List of tag filters. 

Properties

name

string

Name of environment.

resourceName

string

Name of resource.

resourceId

string

Id of resource.

resourceType

string

Type of environment resource.

tags

string

List of tag filters.

environment:
  name: string # Name of environment. 
  resourceName: string # Name of resource. 
  resourceId: string # Id of resource. 
  resourceType: string # Type of environment resource. 
  tags: string # List of tag filters. 

Properties

name

string

Name of environment.

resourceName

string

Name of resource.

resourceId

string

Id of resource.

resourceType

string

Type of environment resource.

tags

string

List of tag filters.

environment:
  name: string # Name of environment. 
  resourceName: string # Name of resource. 
  resourceId: string # Id of resource. 
  resourceType: string # Type of environment resource. 
  tags: string # List of tag filters. 

Properties

name

string

Name of environment.

resourceName

string

Name of resource.

resourceId

string

Id of resource.

resourceType

string

Type of environment resource.

tags

string

List of tag filters.

Examples

The full syntax is:

environment:            # create environment and/or record deployments
  name: string          # name of the environment to run this job on.
  resourceName: string  # name of the resource in the environment to record the deployments against
  resourceId: number    # resource identifier
  resourceType: string  # type of the resource you want to target. Supported types - virtualMachine, Kubernetes
  tags: string          # comma separated tag names to filter the resources in the environment
strategy:               # deployment strategy
  runOnce:              # default strategy
    deploy:
      steps:
      - script: echo Hello world

If you specify an environment or one of its resources but don't need to specify other properties, you can shorten the syntax to:

environment: environmentName.resourceName
strategy:         # deployment strategy
  runOnce:        # default strategy
    deploy:
      steps:
      - script: echo Hello world

You can reduce the deployment target's scope to a particular resource within the environment as shown here:

environment: 'smarthotel-dev.bookings'
strategy:
  runOnce:
    deploy:
      steps:
      - task: KubernetesManifest@0
        displayName: Deploy to Kubernetes cluster
        inputs:
          action: deploy
          namespace: $(k8sNamespace)
          manifests: $(System.ArtifactsDirectory)/manifests/*
          imagePullSecrets: $(imagePullSecret)
          containers: $(containerRegistry)/$(imageRepository):$(tag)
          # value for kubernetesServiceConnection input automatically passed down to task by environment.resource input

See also