jobs.deployment.environment tanımı

anahtar sözcüğü, environment işlem hattının dağıtım işi tarafından hedeflenen ortamı veya kaynağını belirtir.

Bu tanıma başvuran tanımlar: jobs.deployment

Uygulamalar

Uygulama Açıklama
environment: string Ortam adıyla dağıtım işi.
environment: name, resourceName, resourceId, resourceType, tags Tam denetim için tam söz dizimi.

Açıklamalar

Ortam, işin içinde tanımlanan adımları çalıştırmaya yönelik dağıtım stratejisi hakkında da bilgi içerir.

Dağıtım hedefinin kapsamını, burada gösterildiği gibi ortamdaki belirli bir kaynakla azaltabilirsiniz:

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

Ek özellik kullanmadan bir ortamı ada göre belirtmek için aşağıdaki söz dizimini kullanın.

environment: string # Deployment job with environment name.

environment Dize.

Ortam adıyla dağıtım işi.

Örnekler

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

environment: name, resourceName, resourceId, resourceType, tags

Ada ek olarak ortam özelliklerini yapılandırmak için tam söz dizimini kullanın.

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.

Özellikler

name Dize.
Ortamın adı.

resourceName Dize.
Kaynağın adı.

resourceId Dize.
Kaynağın kimliği.

resourceType Dize.
Ortam kaynağının türü.

tags Dize.
Etiket filtreleri listesi.

Örnekler

Söz diziminin tamamı:

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

Bir ortamı veya kaynaklarından birini belirtirseniz ancak diğer özellikleri belirtmeniz gerekmiyorsa, söz dizimini şu şekilde kısaltabilirsiniz:

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

Dağıtım hedefinin kapsamını, burada gösterildiği gibi ortamdaki belirli bir kaynakla azaltabilirsiniz:

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

Ayrıca bkz.