jobs.deployment.environment definition

Słowo environment kluczowe określa środowisko lub zasób, który jest przeznaczony przez zadanie wdrożenia potoku.

Definicje odwołujące się do tej definicji: jobs.deployment

Implementacje

Implementacja Opis
środowisko: ciąg Zadanie wdrożenia o nazwie środowiska.
environment: name, resourceName, resourceId, resourceType, tags Pełna składnia pełnej kontrolki.

Uwagi

Środowisko zawiera również informacje o strategii wdrażania na potrzeby uruchamiania kroków zdefiniowanych wewnątrz zadania.

Zakres celu wdrożenia można zmniejszyć do określonego zasobu w środowisku, jak pokazano poniżej:

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

środowisko: ciąg

Aby określić środowisko według nazwy bez użycia żadnych dodatkowych właściwości, użyj następującej składni.

environment: string # Deployment job with environment name.

environment Ciąg.

Zadanie wdrożenia o nazwie środowiska.

Przykłady

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

environment: name, resourceName, resourceId, resourceType, tags

Aby skonfigurować właściwości środowiska oprócz nazwy, użyj pełnej składni.

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.

Właściwości

name Ciąg.
Nazwa środowiska.

resourceName Ciąg.
Nazwa zasobu.

resourceId Ciąg.
Identyfikator zasobu.

resourceType Ciąg.
Typ zasobu środowiska.

tags Ciąg.
Lista filtrów tagów.

Przykłady

Pełna składnia to:

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

Jeśli określisz środowisko lub jeden z jego zasobów, ale nie musisz określać innych właściwości, możesz skrócić składnię do:

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

Zakres celu wdrożenia można zmniejszyć do określonego zasobu w środowisku, jak pokazano poniżej:

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

Zobacz też