다음을 통해 공유


resources.repositories.repository 정의

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

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: git | github | githubenterprise | bitbucket # 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).
  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.

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

속성

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

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

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

중요합니다

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

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

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

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

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

비고

중요합니다

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

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

중요합니다

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

중요합니다

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

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

유형

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

  • type: git지정하는 경우 name 값은 Azure Repos Git 리포지토리의 이름을 참조합니다.

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

  • type: bitbucket지정하는 경우 name 값은 Bitbucket Cloud 리포지토리의 전체 이름이며 사용자 또는 조직을 포함합니다. 예제는 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

참고하십시오