steps.checkout definition
Gebruik checkout
om te configureren hoe de pijplijn broncode uitcheckt.
steps:
- checkout: string # Required as first property. Configures checkout for the specified repository.
clean: true | false # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.
fetchDepth: string # Depth of Git graph to fetch.
fetchFilter: string # Filter Git history.
fetchTags: string # Set to 'true' to sync tags when fetching the repo, or 'false' to not sync tags. See remarks for the default behavior.
lfs: string # Set to 'true' to download Git-LFS files. Default is not to download them.
persistCredentials: string # Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
submodules: string # Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
path: string # Where to put the repository. The root directory is $(Pipeline.Workspace).
sparseCheckoutDirectories: string # Directories for sparse checkout in cone mode and prioritized over sparseCheckoutPatterns if both properties are provided.
sparseCheckoutPatterns: string # Patterns for sparse checkout in non-cone mode that are ignored if sparseCheckoutDirectories is provided.
workspaceRepo: true | false # When true, use the repository root directory as the default working directory for the pipeline. The default is false.
condition: string # Evaluate this condition expression to determine whether to run this task.
continueOnError: boolean # Continue running even on failure?
displayName: string # Human-readable name for the task.
target: string | target # Environment in which to run this task.
enabled: boolean # Run this task when the job runs?
env: # Variables to map into the process's environment.
string: string # Name/value pairs
name: string # ID of the step.
timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
retryCountOnTaskFailure: string # Number of retries if the task fails.
steps:
- checkout: string # Required as first property. Configures checkout for the specified repository.
clean: true | false # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.
fetchDepth: string # Depth of Git graph to fetch.
fetchTags: string # Set to 'true' to sync tags when fetching the repo, or 'false' to not sync tags. See remarks for the default behavior.
lfs: string # Set to 'true' to download Git-LFS files. Default is not to download them.
persistCredentials: string # Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
submodules: string # Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
path: string # Where to put the repository. The root directory is $(Pipeline.Workspace).
condition: string # Evaluate this condition expression to determine whether to run this task.
continueOnError: boolean # Continue running even on failure?
displayName: string # Human-readable name for the task.
target: string | target # Environment in which to run this task.
enabled: boolean # Run this task when the job runs?
env: # Variables to map into the process's environment.
string: string # Name/value pairs
name: string # ID of the step.
timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
retryCountOnTaskFailure: string # Number of retries if the task fails.
steps:
- checkout: string # Required as first property. Configures checkout for the specified repository.
clean: true | false # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.
fetchDepth: string # Depth of Git graph to fetch.
lfs: string # Set to 'true' to download Git-LFS files. Default is not to download them.
persistCredentials: string # Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
submodules: string # Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
path: string # Where to put the repository. The root directory is $(Pipeline.Workspace).
condition: string # Evaluate this condition expression to determine whether to run this task.
continueOnError: boolean # Continue running even on failure?
displayName: string # Human-readable name for the task.
target: string | target # Environment in which to run this task.
enabled: boolean # Run this task when the job runs?
env: # Variables to map into the process's environment.
string: string # Name/value pairs
name: string # ID of the step.
timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
retryCountOnTaskFailure: string # Number of retries if the task fails.
steps:
- checkout: string # Required as first property. Configures checkout for the specified repository.
clean: true | false # If true, run git clean -ffdx followed by git reset --hard HEAD before fetching.
fetchDepth: string # Depth of Git graph to fetch.
lfs: string # Set to 'true' to download Git-LFS files. Default is not to download them.
persistCredentials: string # Set to 'true' to leave the OAuth token in the Git config after the initial fetch. The default is not to leave it.
submodules: string # Set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules. Default is not to fetch submodules.
path: string # Where to put the repository. The root directory is $(Pipeline.Workspace).
condition: string # Evaluate this condition expression to determine whether to run this task.
continueOnError: boolean # Continue running even on failure?
displayName: string # Human-readable name for the task.
target: string | target # Environment in which to run this task.
enabled: boolean # Run this task when the job runs?
env: # Variables to map into the process's environment.
string: string # Name/value pairs
name: string # ID of the step.
timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
Definities die naar deze definitie verwijzen: stappen
Eigenschappen
checkout
tekenreeks. Vereist als eerste eigenschap.
Hiermee configureert u het uitchecken voor de opgegeven opslagplaats. Geef self
, none
, naam van opslagplaats opof opslagplaatsresource. Zie Bekijk meerdere opslagplaatsen in uw pijplijnvoor meer informatie.
Notitie
Als er geen checkout
stap aanwezig is, wordt deze standaard ingesteld op self
voor jobs.job.step.checkout
en none
voor jobs.deployment.steps.checkout
.
clean
tekenreeks.
Indien waar, voert u git clean -ffdx uit, gevolgd door git reset --hard HEAD voordat u het ophaalt. true | vals.
fetchDepth
tekenreeks.
Diepte van Git-grafiek om op te halen.
fetchFilter
tekenreeks.
Gebruik fetchFilter
om de Git-geschiedenis te filteren op gedeeltelijk klonen. De fetchFilter
-instelling biedt ondersteuning voor het ophalen van boomloze en blobloze blobs. Geef voor een boomloos ophalen fetchFilter: tree:0
op en geef fetchFilter: blob:none
op om een blobloze ophaalfunctie op te geven. De standaardwaarde is geen filter.
fetchTags
tekenreeks.
ingesteld op 'true' om tags te synchroniseren bij het ophalen van de opslagplaats of 'false' om tags niet te synchroniseren. Zie opmerkingen voor het standaardgedrag.
lfs
tekenreeks.
ingesteld op 'true' om Git-LFS bestanden te downloaden. De standaardinstelling is om ze niet te downloaden.
persistCredentials
tekenreeks.
ingesteld op 'true' om het OAuth-token in de Git-configuratie achter te laten na de eerste keer ophalen. De standaardwaarde is om deze niet te laten staan.
submodules
tekenreeks.
ingesteld op 'true' voor één niveau van submodules of 'recursief' om submodules van submodules op te halen. Standaard is het ophalen van submodules niet.
path
tekenreeks.
waar de opslagplaats moet worden geplaatst. De hoofdmap is $(Pipeline.Workspace). Deze map moet standaard onder de werkmapstructuur van de agent staan. Als u een pad buiten de werkmap van de agent wilt instellen, stelt u een pijplijnvariabele in met de naam AZP_AGENT_ALLOW_WORK_DIRECTORY_REPOSITORIES
waar en gebruikt u het voorvoegsel ../
aan het begin van het uitcheckpad. Ondersteund op agentversie 3.230.0 en hoger.
sparseCheckoutDirectories
tekenreeks.
Geef een map op om het parseren van betaling in de conemodus in te schakelen met behulp van adreslijstkoppeling. Scheid meerdere mappen met behulp van een spatie.
- checkout: repo
sparseCheckoutDirectories: src
Als zowel sparseCheckoutDirectories
als sparseCheckoutPatterns
zijn ingesteld, wordt sparseCheckoutDirectories
gebruikt en wordt de instelling voor sparseCheckoutPatterns
genegeerd.
Zie Uw monorepo omlaag brengen naar grootte met sparse-checkoutvoor meer informatie over het uitchecken van sparse.
sparseCheckoutPatterns
tekenreeks.
Geef een patroon op om het parseren van betaling in de niet-kegelmodus in te schakelen met behulp van patroonkoppeling. Scheid meerdere patronen met behulp van een spatie.
- checkout: repo
sparseCheckoutPatterns: /* !/img
Als zowel sparseCheckoutDirectories
als sparseCheckoutPatterns
zijn ingesteld, wordt sparseCheckoutDirectories
gebruikt en wordt de instelling voor sparseCheckoutPatterns
genegeerd.
Zie Uw monorepo omlaag brengen naar grootte met sparse-checkoutvoor meer informatie over het uitchecken van sparse.
workspaceRepo
tekenreeks.
Wanneer waar, gebruikt u de hoofdmap van de opslagplaats als de standaardwerkmap voor de pijplijn. De standaardwaarde is onwaar.
condition
tekenreeks.
Evalueer deze voorwaardeexpressie om te bepalen of deze taak moet worden uitgevoerd.
continueOnError
booleaanse.
Doorgaan met uitvoeren, zelfs bij een fout?
displayName
tekenreeks.
leesbare naam voor de taak.
target
doel.
Omgeving waarin deze taak moet worden uitgevoerd.
enabled
booleaanse.
Deze taak uitvoeren wanneer de taak wordt uitgevoerd?
env
tekenreekswoordenlijst.
variabelen die moeten worden toegewezen aan de omgeving van het proces.
name
tekenreeks.
id van de stap. Acceptabele waarden: [-_A-Za-z0-9]*.
timeoutInMinutes
tekenreeks.
Tijd om te wachten tot deze taak is voltooid voordat de server deze doodt.
Notitie
Pijplijnen kunnen worden geconfigureerd met een time-out op taakniveau. Als het time-outinterval op taakniveau is verstreken voordat de stap is voltooid, wordt de actieve taak (inclusief uw stap) beëindigd, zelfs als de stap is geconfigureerd met een langer timeoutInMinutes
interval. Zie Time-outsvoor meer informatie.
retryCountOnTaskFailure
tekenreeks.
aantal nieuwe pogingen als de taak mislukt.
Opmerkingen
Ondiep ophalen
Notitie
In sommige organisaties zijn nieuwe pijplijnen die zijn gemaakt na de update van september 2022 van Azure DevOps sprint 209 standaard Ondiep ophalen ingeschakeld en geconfigureerd met een diepte van 1. Voorheen was de standaardwaarde niet ondiep ophalen.
Als u de pijplijn wilt controleren, bekijkt u de ondiepe instelling in de gebruikersinterface van pijplijninstellingen.
Als u ondiep ophalen wilt uitschakelen, kunt u een van de volgende twee opties uitvoeren.
- Schakel de optie Ondiep ophalen uit in de gebruikersinterface van pijplijninstellingen.
- Stel
fetchDepth: 0
expliciet in uwcheckout
stap in.
Als u de diepte van ophalen voor een pijplijn wilt configureren, kunt u de eigenschap fetchDepth
instellen in de checkout
stap of de instelling Ondiep ophalen configureren in de gebruikersinterface van de pijplijninstellingen.
Notitie
Als u expliciet fetchDepth
instelt in uw checkout
stap, heeft deze instelling voorrang op de instelling die is geconfigureerd in de gebruikersinterface voor pijplijninstellingen. Als u fetchDepth: 0
alle geschiedenis ophaalt en de ondiepe instelling overschrijft.
Eigenschap opschonen
Als de eigenschap clean
niet is ingesteld, wordt de standaardwaarde geconfigureerd door de schone instelling in de ui-instellingen voor YAML-pijplijnen. Deze waarde is standaard ingesteld op true. Naast de beschikbare schoonmaakoptie met checkout
kunt u ook schoonmaak configureren in een werkruimte. Zie het onderwerp werkruimte in Jobsvoor meer informatie over werkruimten en opschoningsopties.
Tags synchroniseren
In de stap uitchecken wordt de optie --tags
gebruikt bij het ophalen van de inhoud van een Git-opslagplaats. Dit zorgt ervoor dat de server alle tags en alle objecten ophaalt waarnaar deze tags worden verwezen. Dit verhoogt de tijd voor het uitvoeren van de taak in een pijplijn, met name als u een grote opslagplaats met een aantal tags hebt. Bovendien synchroniseert de kassastap tags zelfs wanneer u de ondiepe ophaaloptie inschakelt, waardoor het doel mogelijk wordt verslagen. Om de hoeveelheid opgehaalde of opgehaalde gegevens uit een Git-opslagplaats te verminderen, heeft Microsoft een nieuwe optie toegevoegd om het gedrag van synchronisatietags te beheren. Deze optie is zowel beschikbaar in klassieke als YAML-pijplijnen.
Of tags moeten worden gesynchroniseerd bij het uitchecken van een opslagplaats, kan worden geconfigureerd in YAML door de eigenschap fetchTags
in te stellen en in de gebruikersinterface door de instelling Synchronisatietags te configureren.
Als u de instelling in YAML wilt configureren, stelt u de eigenschap fetchTags
in.
steps:
- checkout: self
fetchTags: true
Als u de instelling in de pijplijninterface wilt configureren, bewerkt u de YAML-pijplijn en kiest u Meer acties, Triggers, YAML-, Bronnen ophalenen schakelt u het selectievakje Synchronisatietags in of uit. Zie Tags synchroniserenvoor meer informatie.
Standaardgedrag
- Voor bestaande pijplijnen die zijn gemaakt vóór de release van Azure DevOps sprint 209, uitgebracht in september 2022, blijft de standaardwaarde voor het synchroniseren van tags hetzelfde als het bestaande gedrag voordat de Synchronisatietags opties zijn toegevoegd. Dit is
true
. - Voor nieuwe pijplijnen die zijn gemaakt na release 209 van Azure DevOps sprint, is de standaardinstelling voor het synchroniseren van tags
false
.
Belangrijk
Een -tags synchroniseren instelling waar in de gebruikersinterface heeft voorrang op een fetchTags: false
instructie in de YAML. Als tags synchroniseren is ingesteld op waar in de gebruikersinterface, worden tags gesynchroniseerd, zelfs als fetchTags
is ingesteld op onwaar in de YAML.
Voorbeelden
Er zijn drie opties voor checkout
. Azure DevOps controleert standaard de huidige opslagplaats met self
voor taken. Wanneer u none
instelt, wordt er geen opslagplaats uitgecheckt. Als u een andere opslagplaats opgeeft, wordt die opslagplaats uitgecheckt. Als u een andere opslagplaats wilt uitchecken, stelt u deze eerst in als een opslagplaatsresource.
# Checkout the current repository
steps:
- checkout: self
# Prevent checking out any source code
steps:
- checkout: none
# Checkout a different repository
steps:
- checkout: my-other-repo
Om te voorkomen dat bronnen worden gesynchroniseerd:
steps:
- checkout: none
Notitie
Als u de agent uitvoert in het lokale serviceaccount en u de huidige opslagplaats wilt wijzigen met behulp van Git-bewerkingen of git-submodules wilt laden, geeft u de juiste machtigingen aan de gebruiker van de buildserviceaccounts van Project Collection.
- checkout: self
submodules: true
persistCredentials: true
Als u meerdere opslagplaatsen in uw pijplijn wilt uitchecken, gebruikt u meerdere checkout
stappen:
- checkout: self
- checkout: git://MyProject/MyRepo
- checkout: MyGitHubRepo # Repo declared in a repository resource
Zie Bekijk meerdere opslagplaatsen in uw pijplijnvoor meer informatie.