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 文字列。
チェックアウトする ref 名を します。既定値は 'refs/heads/main' です。 リソース トリガーが起動するたびに、ブランチは既定でチェックアウトされました。
テンプレート式は、でサポートされています。
ref 文字列。
チェックアウトする ref 名を します。既定値は 'refs/heads/main' です。 リソース トリガーが起動するたびに、ブランチは既定でチェックアウトされました。 変数は受け入れません。
type 文字列。
リポジトリの種類: git、github、githubenterprise、bitbucket。
注釈
重要
リポジトリ リソースでは、name および refのパイプライン変数を使用できません。 トリガーではワイルドカードがサポートされています。
ref サポートされています (name プロパティはサポートされていません)。 トリガーではワイルドカードがサポートされています。
重要
リポジトリ リソース トリガーは、Azure Repos Git リポジトリでのみサポートされています。
trigger タグと タグのワイルドカード サポート など、 構文の詳細については、「トリガー定義の と Azure Repos Git または TFS Git リポジトリのビルド を参照してください。
重要
batch は、リポジトリ リソース トリガーではサポートされていません。
パイプラインに別のリポジトリ にテンプレートがある場合、またはサービス接続を必要とするリポジトリ 複数リポジトリ のチェックアウト を使用する場合は、そのリポジトリについてシステムに通知する必要があります。
種類
パイプラインでは、リポジトリの種類として、git、github、および bitbucketの値がサポートされます。
git の種類は、Azure Repos Git リポジトリを参照します。
type: gitを指定した場合、name値は Azure Repos Git リポジトリの名前を参照します。- パイプラインがリポジトリと同じ Azure DevOps プロジェクト (
toolsという名前のリポジトリなど) にある場合は、name: toolsを使用して参照します。 - パイプラインがリポジトリと同じ Azure DevOps 組織にあり、別の Azure DevOps プロジェクト (たとえば、
ToolsProjectという名前のプロジェクト) にある場合は、プロジェクト名 (name: ToolsProject/tools) でリポジトリ名を修飾する必要があります。
- パイプラインがリポジトリと同じ Azure DevOps プロジェクト (
type: githubを指定した場合、name値は GitHub リポジトリの完全な名前であり、ユーザーまたは組織が含まれます。 たとえばname: Microsoft/vscodeです。 GitHub リポジトリでは、承認のために GitHub サービス接続 が必要です。type: bitbucketを指定した場合、name値は Bitbucket Cloud リポジトリの完全な名前であり、ユーザーまたは組織が含まれます。 たとえばname: MyBitbucket/vscodeです。 Bitbucket Cloud リポジトリでは、承認のために Bitbucket クラウド サービス接続 が必要です。
これらの型の詳細については、「パイプライン内の複数のリポジトリをチェックアウトする - リポジトリ リソース定義」を参照してください。
変数
実行のたびに、リポジトリ リソースのメタデータは、ランタイム変数の形式ですべてのジョブで使用できます。
<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
こちらもご覧ください
- パイプライン にリソースを追加する