resources.repositories.repository definíció
A repository
kulcsszóval megadhat egy külső adattárat. Tárházerőforrás használatával hivatkozzon egy további adattárra a folyamatban.
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.
A definícióra hivatkozó definíciók: resources.repositories
Tulajdonságok
repository
Karakterlánc. Első tulajdonságként kötelező megadni.
A megadott adattár aliasa. Elfogadható értékek: [-_A-Za-z0-9]*.
endpoint
Karakterlánc.
Az adattárhoz csatlakozó szolgáltatásvégpont azonosítója.
trigger
eseményindítót.
CI-eseményindító ehhez az adattárhoz, nincs CI-eseményindító, ha nincs megadva.
Fontos
- Az adattárerőforrás-eseményindítók csak az Azure Repos Git-adattárak esetében támogatottak.
- Az adattár erőforrás-eseményindítói nem támogatják a parancsot
batch
.
name
Karakterlánc.
Adattár neve. A formátum a típustól függ; nem fogad el változókat.
ref
Karakterlánc.
a visszalépés neve a kivételhez; alapértelmezett értéke a "hivs/heads/main". Az ág alapértelmezés szerint ki van véve, amikor az erőforrás-eseményindító aktiválódik. A sablonkifejezések támogatottak.
ref
Karakterlánc.
a visszalépés neve a kivételhez; alapértelmezett értéke a "hivs/heads/main". Az ág alapértelmezés szerint ki van véve, amikor az erőforrás-eseményindító aktiválódik. Nem fogad el változókat.
type
Karakterlánc.
Az adattár típusa: git, github, githubenterprise és bitbucket.
Megjegyzések
Fontos
Az adattárerőforrás nem engedélyezi a és ref
a name
folyamatváltozóit. Az eseményindítók támogatják a helyettesítő karaktereket.
A sablonkifejezések a ref
tulajdonság esetében támogatottak (de a name
tulajdonsághoz nem). Az eseményindítók támogatják a helyettesítő karaktereket.
Fontos
Az adattárerőforrás-eseményindítók csak Az Azure Repos Git-adattárak esetében támogatottak. További információ a szintaxisróltrigger
, beleértve az ágak és címkékhelyettesítő karakteres támogatását is, lásd: triggerdefiníció és Azure-adattárak létrehozása Git- vagy TFS Git-adattárak.
Fontos
batch
nem támogatott az adattárbeli erőforrás-eseményindítókban.
Ha a folyamat sablonjai egy másik adattárban vannak, értesítenie kell a rendszert az adattárról.
Ha a folyamat sablonjai egy másik adattárban találhatók, vagy ha több adattárból álló kivételt szeretne használni egy szolgáltatáskapcsolatot igénylő adattárral, értesítenie kell a rendszert erről az adattárról.
Típusok
A folyamatok a következő értékeket támogatják az adattártípushoz: git
, github
és bitbucket
.
A git
típus az Azure Repos Git-adattárakra vonatkozik.
Ha a értéket adja meg
type: git
, azname
érték egy Azure Repos Git-adattár nevére hivatkozik.- Ha a folyamat ugyanabban az Azure DevOps-projektben található, mint az adattár, például egy nevű
tools
adattár, akkor a használatávalname: tools
hivatkozhat rá. - Ha a folyamat ugyanabban az Azure DevOps-szervezetben található, mint az adattár, de egy másik Azure DevOps-projektben, például egy nevű
ToolsProject
projektben, a következő projektnévvel kell minősítenie az adattár nevét:name: ToolsProject/tools
.
- Ha a folyamat ugyanabban az Azure DevOps-projektben található, mint az adattár, például egy nevű
Ha a értéket adja meg
type: github
, azname
érték a GitHub-adattár teljes neve, és tartalmazza a felhasználót vagy a szervezetet. Például:name: Microsoft/vscode
. A GitHub-adattárakhoz GitHub-szolgáltatáskapcsolat szükséges az engedélyezéshez.Ha a értéket adja meg
type: bitbucket
, azname
érték a Bitbucket Cloud-adattár teljes neve, és tartalmazza a felhasználót vagy a szervezetet. Például:name: MyBitbucket/vscode
. A Bitbucket Cloud-adattárakhoz bitbucket felhőszolgáltatás-kapcsolat szükséges az engedélyezéshez.
További információ ezekről a típusokról: Több adattár kivétele a folyamatban – Adattár erőforrás-definíciója.
Változók
Minden futtatásban az adattárerőforrás metaadatai minden feladat számára elérhetők futásidejű változók formájában. Az <Alias>
az azonosító, amelyet az adattár-erőforráshoz adott.
resources.repositories.<Alias>.name
resources.repositories.<Alias>.ref
resources.repositories.<Alias>.type
resources.repositories.<Alias>.id
resources.repositories.<Alias>.url
resources.repositories.<Alias>.version
Az alábbi példában van egy adattárerőforrás a aliasával common
, és az adattár erőforrásváltozói a használatával resources.repositories.common.*
érhetők el.
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)"
Változók
Minden futtatásban az adattárerőforrás metaadatai minden feladat számára elérhetők futásidejű változók formájában. Az <Alias>
az azonosító, amelyet az adattár-erőforráshoz adott.
resources.repositories.<Alias>.name
resources.repositories.<Alias>.ref
resources.repositories.<Alias>.type
resources.repositories.<Alias>.id
resources.repositories.<Alias>.url
Az alábbi példában van egy adattárerőforrás a aliasával common
, és az adattár erőforrásváltozói a használatával resources.repositories.common.*
érhetők el.
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)"
Példák
resources:
repositories:
- repository: common
type: github
name: Contoso/CommonTools
endpoint: MyContosoServiceConnection