steps.checkout definition

Slouží checkout ke konfiguraci způsobu, jakým kanál kontroluje zdrojový kód.

steps:
- checkout: string # Required as first property. Configures checkout for the specified repository.
  clean: string # 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: string # 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: string # 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.
steps:
- checkout: string # Required as first property. Whether or not to check out the repository containing this pipeline definition.
  clean: string # 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.
  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.
steps:
- checkout: string # Required as first property. Whether or not to check out the repository containing this pipeline definition.
  clean: string # 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.
  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.
  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.

Definice, které odkazují na tuto definici: kroky

Vlastnosti

checkout Řetězec. Povinný argument jako první vlastnost.
Nakonfiguruje rezervaci pro zadané úložiště. Zadejte self, none, název úložiště nebo prostředek úložiště. Další informace najdete v tématu Rezervace více úložišť v kanálu.

Poznámka

Pokud není k dispozici žádný checkout krok, ve výchozím nastavení je self pro jobs.job.step.checkout a none pro jobs.deployment.steps.checkout.

checkout Řetězec. Povinný argument jako první vlastnost.
Jestli se má rezervovat úložiště obsahující tuto definici kanálu. Zadejte self nebo none.

clean Řetězec.
Pokud je true, spusťte před načtením příkaz git clean -ffdx a potom git reset --hard HEAD. true | False.

fetchDepth Řetězec.
Hloubka grafu Gitu, který chcete načíst.

fetchTags Řetězec.
Nastavte na true, aby se značky synchronizovaly při načítání úložiště, nebo false, aby se značky nesynchronizují. Výchozí chování najdete v poznámkách.

lfs Řetězec.
Pokud chcete stahovat soubory Git-LFS, nastavte na true. Ve výchozím nastavení se nestahují.

persistCredentials Řetězec.
Pokud chcete token OAuth ponechat v konfiguraci Gitu po počátečním načtení, nastavte na hodnotu true. Ve výchozím nastavení ho neopustíte.

submodules Řetězec.
Nastavte na true pro jednu úroveň dílčích modulů nebo "rekurzivní", abyste získali dílčímoduly dílčích modulů. Výchozí nastavení není načtení dílčích modulů.

path Řetězec.
Kam umístit úložiště. Kořenový adresář je $(Pipeline.Workspace).

condition Řetězec.
Vyhodnoťte tento výraz podmínky a určete, jestli se má tato úloha spustit.

continueOnErrorboolean.
Chcete pokračovat v provozu i při selhání?

displayName Řetězec.
Název úkolu čitelný pro člověka.

targetcíl.
Prostředí, ve kterém se má tato úloha spustit.

enabledboolean.
Spustit tuto úlohu při spuštění úlohy?

env řetězcový slovník.
Proměnné, které se mají mapovat na prostředí procesu.

name Řetězec.
ID kroku. Přijatelné hodnoty: [-_A-Za-z0-9]*.

timeoutInMinutes Řetězec.
Je čas počkat na dokončení této úlohy, než ho server ukončí.

Poznámka

Kanály mohou být nakonfigurované s vypršením časového limitu na úrovni úlohy. Pokud interval časového limitu na úrovni úlohy uplynou před dokončením kroku, spuštěná úloha (včetně vašeho kroku) se ukončí, a to i v případě, že je krok nakonfigurovaný s delším timeoutInMinutes intervalem. Další informace najdete v tématu Vypršení časových limitů.

retryCountOnTaskFailure Řetězec.
Počet opakování v případě selhání úkolu

Poznámky

Mělké načítání

Důležité

Nové kanály vytvořené po aktualizaci 209 sprintu Azure DevOps ze září 2022 mají ve výchozím nastavení povolené shallow fetch a nakonfigurované s hloubkou 1. Dříve bylo výchozí ne mělké načítání. Pokud chcete zkontrolovat kanál, podívejte se na nastavení Shallow fetch v uživatelském rozhraní nastavení kanálu.

Pokud chcete zakázat mělké načítání, můžete použít jednu z následujících dvou možností.

Pokud chcete nakonfigurovat hloubku načítání pro kanál, můžete buď nastavit fetchDepth vlastnost v checkout kroku, nebo nakonfigurovat nastavení Shallow fetch v uživatelském rozhraní nastavení kanálu.

Poznámka

Pokud explicitně nastavíte fetchDepth v checkout kroku, má toto nastavení přednost před nastavením nakonfigurovaným v uživatelském rozhraní nastavení kanálu. Nastavení fetchDepth: 0 načte celou historii a přepíše nastavení Shallow fetch .

Čisté ubytování

clean Pokud je vlastnost nenastavená, je její výchozí hodnota nakonfigurována nastavením čištění v nastavení uživatelského rozhraní pro kanály YAML, které je ve výchozím nastavení nastaveno na true. Kromě možnosti čištění dostupné pomocí checkoutnástroje můžete také nakonfigurovat čištění v pracovním prostoru. Další informace o pracovních prostorech a možnostech čištění najdete v tématu pracovní prostor v tématu Úlohy.

Synchronizovat značky

Krok rezervace používá --tags možnost při načítání obsahu úložiště Git. To způsobí, že server načte všechny značky a také všechny objekty, na které tyto značky odkazuje. Tím se prodlužuje doba spuštění úlohy v kanálu, zejména pokud máte velké úložiště s několika značkami. Krok pokladny navíc synchronizuje značky, i když povolíte možnost mělkého načítání, což může zmařit její účel. Abychom snížili množství dat načtených nebo načítaných z úložiště Git, přidala společnost Microsoft novou možnost rezervace, která řídí chování synchronizace značek. Tato možnost je k dispozici v klasických kanálech i kanálech YAML.

Jestli chcete synchronizovat značky při rezervaci úložiště, můžete nakonfigurovat v YAML nastavením fetchTags vlastnosti a v uživatelském rozhraní konfigurací nastavení Synchronizovat značky .

Pokud chcete nakonfigurovat nastavení v YAML, nastavte fetchTags vlastnost .

steps:
- checkout: self
  fetchTags: true

Pokud chcete nakonfigurovat nastavení v uživatelském rozhraní kanálu, upravte kanál YAML a zvolte Další akce, Triggery, YAML, Získat zdroje a zaškrtněte políčko Synchronizovat značky nebo jeho zaškrtnutí zrušte. Další informace najdete v tématu Synchronizace značek.

Výchozí chování

  • U existujících kanálů vytvořených před vydáním sprintu Azure DevOps 209 vydaného v září 2022 zůstává výchozí nastavení pro synchronizaci značek stejné jako stávající chování před přidání možností synchronizovat značky , což je true.
  • Pro nové kanály vytvořené po sprintu Azure DevOps verze 209 je falsevýchozí pro synchronizaci značek .

Důležité

Nastavení značek synchronizace true v uživatelském rozhraní má přednost před příkazem fetchTags: false v YAML. Pokud jsou značky synchronizace v uživatelském rozhraní nastaveny na hodnotu true, značky se synchronizují i v případě, že fetchTags je v YAML nastavená na false.

Příklady

Abyste se vůbec vyhnuli synchronizaci zdrojů:

steps:
- checkout: none

Poznámka

Pokud agenta spouštíte v účtu místní služby a chcete upravit aktuální úložiště pomocí operací Gitu nebo načtením dílčích modulů Git, udělte uživatelům účtů služby sestavení kolekce projektů správná oprávnění.

- checkout: self
  submodules: true
  persistCredentials: true

Pokud chcete v kanálu rezervovat více úložišť, použijte několik checkout kroků:

- checkout: self
- checkout: git://MyProject/MyRepo
- checkout: MyGitHubRepo # Repo declared in a repository resource

Další informace najdete v tématu Rezervace více úložišť v kanálu.

Viz také