다음을 통해 공유


jobs.deployment.environment 정의

environment 키워드는 환경 또는 파이프라인의 배포 작업의 대상이 되는 리소스를 지정합니다.

이 정의를 참조하는 정의: jobs.deployment

구현

이행 설명
환경: 문자열 환경 이름을 사용하는 배포 작업입니다.
환경: name, resourceName, resourceId, resourceType, 태그 완전한 제어를 위한 전체 구문입니다.

비고

환경에는 작업 내에 정의된 단계를 실행하기 위한 배포 전략에 대한 정보도 포함됩니다.

다음과 같이 배포 대상의 범위를 환경 내의 특정 리소스로 줄일 수 있습니다.

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

추가 속성을 사용하지 않고 이름으로 환경을 지정하려면 다음 구문을 사용합니다.

environment: string # Deployment job with environment name.

environment 문자열입니다.

환경 이름을 사용하는 배포 작업입니다.

예시

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

environment: name, resourceName, resourceId, resourceType, tags

이름 외에 환경 속성을 구성하려면 전체 구문을 사용합니다.

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.

속성

name 문자열입니다.
환경의 이름입니다.

resourceName 문자열입니다.
리소스의 이름입니다.

resourceId 문자열입니다.
리소스의 ID입니다.

resourceType 문자열입니다.
환경 리소스 유형입니다.

tags 문자열입니다.
태그 필터 목록입니다.

예시

전체 구문은 다음과 같습니다.

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

환경 또는 해당 리소스 중 하나를 지정하지만 다른 속성을 지정할 필요가 없는 경우 구문을 다음과 같이 줄일 수 있습니다.

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

다음과 같이 배포 대상의 범위를 환경 내의 특정 리소스로 줄일 수 있습니다.

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

참고하십시오

  • 환경 만들기 및 대상 지정