Share via


definizione di jobs.deployment.environment

La environment parola chiave specifica l'ambiente o la relativa risorsa destinata a un processo di distribuzione della pipeline.

Definizioni che fanno riferimento a questa definizione: jobs.deployment

Implementazioni

Implementazione Descrizione
ambiente: stringa Processo di distribuzione con nome dell'ambiente.
environment: name, resourceName, resourceId, resourceType, tag Sintassi completa per il controllo completo.

Commenti

Un ambiente contiene anche informazioni sulla strategia di distribuzione per l'esecuzione dei passaggi definiti all'interno del processo.

È possibile ridurre l'ambito della destinazione di distribuzione a una determinata risorsa all'interno dell'ambiente, come illustrato di seguito:

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

ambiente: stringa

Per specificare un ambiente in base al nome senza usare altre proprietà, usare la sintassi seguente.

environment: string # Deployment job with environment name.

environment Stringa.

Processo di distribuzione con nome dell'ambiente.

Esempio

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

environment: name, resourceName, resourceId, resourceType, tag

Per configurare le proprietà dell'ambiente oltre al nome, usare la sintassi completa.

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.

Proprietà

name Stringa.
Nome dell'ambiente.

resourceName Stringa.
Nome della risorsa.

resourceId Stringa.
ID della risorsa.

resourceType Stringa.
Tipo di risorsa di ambiente.

tags Stringa.
Elenco dei filtri tag.

Esempio

La sintassi completa è:

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

Se si specifica un ambiente o una delle relative risorse, ma non è necessario specificare altre proprietà, è possibile ridurre la sintassi a:

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

È possibile ridurre l'ambito della destinazione di distribuzione a una determinata risorsa all'interno dell'ambiente, come illustrato di seguito:

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

Vedi anche