Share via


resources.repositories.repository 정의

repository 키워드(keyword) 외부 리포지토리를 지정할 수 있습니다. 리포지토리 리소스를 사용하여 파이프라인의 추가 리포지토리를 참조합니다.

repositories:
- repository: string # Required as first property. Alias for the repository.
  endpoint: string # ID of the service endpoint connecting to this repository.
  trigger: none | trigger | [ string ] # CI trigger for this repository, no CI trigger if skipped (only works for Azure Repos).
  name: string # repository name (format depends on 'type'; does not accept variables).
  ref: string # ref name to checkout; defaults to 'refs/heads/main'. The branch checked out by default whenever the resource trigger fires.
  type: string # Type of repository: git, github, githubenterprise, and bitbucket.
repositories:
- repository: string # Required as first property. Alias for the repository.
  endpoint: string # ID of the service endpoint connecting to this repository.
  trigger: none | trigger | [ string ] # CI trigger for this repository, no CI trigger if skipped (only works for Azure Repos).
  name: string # repository name (format depends on 'type'; does not accept variables).
  type: string # Type of repository: git, github, githubenterprise, and bitbucket.
  ref: string # ref name to checkout; defaults to 'refs/heads/main'. The branch checked out by default whenever the resource trigger fires. Does not accept variables.
repositories:
- repository: string # Required as first property. Alias for the repository.
  endpoint: string # ID of the service endpoint connecting to this repository.
  name: string # repository name (format depends on 'type'; does not accept variables).
  type: string # Type of repository: git, github, githubenterprise, and bitbucket.
  ref: string # ref name to checkout; defaults to 'refs/heads/main'. The branch checked out by default whenever the resource trigger fires. Does not accept variables.

이 정의를 참조하는 정의: resources.repositories

속성

repository 문자열. 첫 번째 속성으로 필요합니다.
지정된 리포지토리의 별칭입니다. 허용되는 값: [-_A-Za-z0-9]*.

endpoint 문자열.
이 리포지토리에 연결하는 서비스 엔드포인트의 ID입니다.

trigger트리거합니다.
이 리포지토리에 대한 CI 트리거이며 생략하면 CI 트리거가 없습니다.

중요

  • 리포지토리 리소스 트리거는 Azure Repos Git 리포지토리에 대해서만 지원됩니다.
  • 리포지토리 리소스 트리거는 를 지원하지 batch않습니다.

name 문자열.
리포지토리 이름입니다. 형식은 'type'에 따라 달라집니다. 는 변수를 허용하지 않습니다.

ref 문자열.
ref name to checkout; 기본값은 'refs/heads/기본'입니다. 분기는 리소스 트리거가 발생할 때마다 기본적으로 체크 아웃됩니다. 템플릿 식이 지원됩니다.

ref 문자열.
ref name to checkout; 기본값은 'refs/heads/기본'입니다. 분기는 리소스 트리거가 발생할 때마다 기본적으로 체크 아웃됩니다. 변수를 허용하지 않습니다.

type 문자열.
리포지토리 유형: git, github, githubenterprise 및 bitbucket.

설명

중요

리포지토리 리소스는 및 refname 파이프라인 변수를 허용하지 않습니다. 와일드카드는 트리거에서 지원됩니다.

템플릿 식은 속성에 ref 대해 지원되지만 속성은 name 지원되지 않습니다. 와일드카드는 트리거에서 지원됩니다.

중요

리포지토리 리소스 트리거는 Azure Repos Git 리포지토리에 대해서만 지원됩니다. 분기태그에 대한 와일드카드 지원을 비롯한 구문에 trigger 대한 자세한 내용은 트리거 정의Git 또는 TFS Git 리포지토리 Azure Repos 빌드를 참조하세요.

중요

batch 는 리포지토리 리소스 트리거에서 지원되지 않습니다.

파이프라인 에 다른 리포지토리에 템플릿이 있는 경우 해당 리포지토리에 대해 시스템에 알려야 합니다.

파이프라인 에 다른 리포지토리에 템플릿이 있거나 서비스 연결이 필요한 리포지토리에서 다중 리포지토리 체크 아웃 을 사용하려는 경우 해당 리포지토리에 대해 시스템에 알려야 합니다.

형식

파이프라인은 리포지토리 형식 git에 대해 , githubbitbucket값을 지원합니다. 형식은 git Azure Repos Git 리포지토리를 참조합니다.

  • 를 지정type: git하는 경우 값은 name Azure Repos Git 리포지토리의 이름을 나타냅니다.

    • 파이프라인이 리포지토리와 동일한 Azure DevOps 프로젝트에 있는 경우(예: 라는 tools리포지토리) 를 사용하여 name: tools참조합니다.
    • 파이프라인이 리포지토리와 동일한 Azure DevOps organization 있지만 다른 Azure DevOps 프로젝트(예: 라는 ToolsProject프로젝트)에 있는 경우 리포지토리 이름을 프로젝트 이름으로 name: ToolsProject/tools한정해야 합니다.
  • name 지정type: github하는 경우 값은 GitHub 리포지토리의 전체 이름이며 사용자 또는 organization 포함합니다. 예제는 name: Microsoft/vscode입니다. GitHub 리포지토리는 권한 부여를 위해 GitHub 서비스 연결 이 필요합니다.

  • name 지정type: bitbucket하는 경우 값은 Bitbucket Cloud 리포지토리의 전체 이름이며 사용자 또는 organization 포함합니다. 예제는 name: MyBitbucket/vscode입니다. Bitbucket Cloud 리포지토리에는 권한 부여를 위해 Bitbucket Cloud 서비스 연결 이 필요합니다.

이러한 형식에 대한 자세한 내용은 파이프라인에서 여러 리포지토리 체크 아웃 - 리포지토리 리소스 정의를 참조하세요.

변수

각 실행에서 리포지토리 리소스에 대한 메타데이터는 런타임 변수 형식의 모든 작업에 사용할 수 있습니다. 는 <Alias> 리포지토리 리소스에 대해 제공한 식별자입니다.

resources.repositories.<Alias>.name
resources.repositories.<Alias>.ref
resources.repositories.<Alias>.type
resources.repositories.<Alias>.id
resources.repositories.<Alias>.url
resources.repositories.<Alias>.version

다음 예제에는 별칭 common이 인 리포지토리 리소스가 있으며 리포지토리 리소스 변수는 를 사용하여 resources.repositories.common.*액세스합니다.

resources:
  repositories:
    - repository: common
      type: git
      ref: main
      name: Repo

variables:
  ref: $[ resources.repositories.common.ref ]
  name: $[ resources.repositories.common.name ]
  id: $[ resources.repositories.common.id ]
  type: $[ resources.repositories.common.type ]
  url: $[ resources.repositories.common.url ]
  version: $[ resources.repositories.common.version ]

steps:
- bash: |
    echo "name = $(name)"
    echo "ref = $(ref)"
    echo "id = $(id)"
    echo "type = $(type)"
    echo "url = $(url)"
    echo "version = $(version)"

변수

각 실행에서 리포지토리 리소스에 대한 메타데이터는 런타임 변수 형식의 모든 작업에 사용할 수 있습니다. 는 <Alias> 리포지토리 리소스에 대해 제공한 식별자입니다.

resources.repositories.<Alias>.name
resources.repositories.<Alias>.ref
resources.repositories.<Alias>.type
resources.repositories.<Alias>.id
resources.repositories.<Alias>.url

다음 예제에는 별칭 common이 인 리포지토리 리소스가 있으며 리포지토리 리소스 변수는 를 사용하여 resources.repositories.common.*액세스합니다.

resources:
  repositories:
    - repository: common
      type: git
      ref: main
      name: Repo

variables:
  ref: $[ resources.repositories.common.ref ]
  name: $[ resources.repositories.common.name ]
  id: $[ resources.repositories.common.id ]
  type: $[ resources.repositories.common.type ]
  url: $[ resources.repositories.common.url ]

steps:
- bash: |
    echo "name = $(name)"
    echo "ref = $(ref)"
    echo "id = $(id)"
    echo "type = $(type)"
    echo "url = $(url)"

resources:
  repositories:
  - repository: common
    type: github
    name: Contoso/CommonTools
    endpoint: MyContosoServiceConnection

참고 항목