steps.checkout definition

Służy checkout do konfigurowania sposobu sprawdzania kodu źródłowego potoku.

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.

Definicje odwołujące się do tej definicji: kroki

Właściwości

checkout Ciąg. Wymagane jako pierwsza właściwość.
Konfiguruje wyewidencjonowania dla określonego repozytorium. Określ self, none, nazwę repozytorium lub zasób repozytorium. Aby uzyskać więcej informacji, zobacz Sprawdzanie wielu repozytoriów w potoku.

Uwaga

Jeśli żaden krok nie checkout istnieje, wartość domyślna self to dla jobs.job.step.checkout i none dla jobs.deployment.steps.checkout.

checkout Ciąg. Wymagane jako pierwsza właściwość.
Określa, czy należy wyewidencjonować repozytorium zawierające tę definicję potoku. Określ self wartość lub none.

clean Ciąg.
Jeśli to prawda, uruchom polecenie git clean -ffdx, a następnie polecenie git reset --hard HEAD przed pobraniem. true | False.

fetchDepth Ciąg.
Głębokość wykresu usługi Git do pobrania.

fetchTags Ciąg.
Ustaw wartość "true", aby synchronizować tagi podczas pobierania repozytorium lub "false", aby nie synchronizować tagów. Zobacz uwagi dotyczące domyślnego zachowania.

lfs Ciąg.
Ustaw wartość "true", aby pobrać pliki Git-LFS. Domyślnie nie należy ich pobierać.

persistCredentials Ciąg.
Ustaw wartość "true", aby pozostawić token OAuth w konfiguracji usługi Git po początkowym pobraniu. Wartością domyślną jest to, że nie należy go pozostawiać.

submodules Ciąg.
Ustaw wartość "true" dla pojedynczego poziomu modułów podrzędnych lub "rekursywnego", aby pobrać podmoduły podrzędne. Ustawieniem domyślnym nie jest pobieranie modułów podrzędnych.

path Ciąg.
Gdzie umieścić repozytorium. Katalog główny to $(Pipeline.Workspace).

condition Ciąg.
Oceń to wyrażenie warunku, aby określić, czy należy uruchomić to zadanie.

continueOnErrorwartość logiczna.
Czy kontynuować działanie nawet w przypadku awarii?

displayName Ciąg.
Czytelna dla człowieka nazwa zadania.

targetelement docelowy.
Środowisko, w którym ma zostać uruchomione to zadanie.

enabledwartość logiczna.
Czy uruchomić to zadanie, gdy zadanie zostanie uruchomione?

env słownik ciągów.
Zmienne do mapowania na środowisko procesu.

name Ciąg.
Identyfikator kroku. Dopuszczalne wartości: [-_A-Za-z0-9]*.

timeoutInMinutes Ciąg.
Czas oczekiwania na ukończenie tego zadania, zanim serwer go zabije.

Uwaga

Potoki można skonfigurować z limitem czasu na poziomie zadania. Jeśli interwał limitu czasu na poziomie zadania upłynie przed ukończeniem kroku, zadanie uruchomione (w tym krok) zostanie zakończone, nawet jeśli krok zostanie skonfigurowany z dłuższym timeoutInMinutes interwałem. Aby uzyskać więcej informacji, zobacz Limity czasu.

retryCountOnTaskFailure Ciąg.
Liczba ponownych prób w przypadku niepowodzenia zadania.

Uwagi

Płytkie pobieranie

Ważne

Nowe potoki utworzone po aktualizacji przebiegu usługi Azure DevOps z września 2022 r. mają włączoną domyślnie opcję Płytkie pobieranie i skonfigurowane z głębokością 1. Wcześniej ustawieniem domyślnym nie było płytkie pobieranie. Aby sprawdzić potok, wyświetl ustawienie Płytkie pobieranie w interfejsie użytkownika ustawień potoku.

Aby wyłączyć płytkie pobieranie, można wykonać jedną z następujących dwóch opcji.

  • Wyłącz opcję Płytkie pobieranie w interfejsie użytkownika ustawień potoku.
  • Jawnie ustaw fetchDepth: 0 w checkout kroku.

Aby skonfigurować głębokość pobierania dla potoku, możesz ustawić fetchDepth właściwość w checkout kroku lub skonfigurować ustawienie Płytkie pobieranie w interfejsie użytkownika ustawień potoku.

Uwaga

Jeśli jawnie ustawisz fetchDepth w checkout kroku, to ustawienie ma priorytet nad ustawieniem skonfigurowanym w interfejsie użytkownika ustawień potoku. Ustawienie fetchDepth: 0 pobiera całą historię i zastępuje ustawienie Płytkie pobieranie .

Clean, właściwość

clean Jeśli właściwość nie jest ustawiona, jej wartość domyślna jest konfigurowana przez ustawienie czystego w ustawieniach interfejsu użytkownika dla potoków YAML, które jest domyślnie ustawione na wartość true. Oprócz opcji czyszczenia dostępnej przy użyciu checkoutprogramu można również skonfigurować czyszczenie w obszarze roboczym. Aby uzyskać więcej informacji na temat obszarów roboczych i opcji czyszczenia, zobacz temat obszar roboczy w obszarze Zadania.

Tagi synchronizacji

Krok wyewidencjonowania używa --tags opcji podczas pobierania zawartości repozytorium Git. Powoduje to pobranie wszystkich tagów przez serwer, a także wszystkich obiektów wskazywanych przez te tagi. Zwiększa to czas uruchamiania zadania w potoku, szczególnie w przypadku dużego repozytorium z wieloma tagami. Ponadto krok wyewidencjonowania synchronizuje tagi nawet wtedy, gdy włączysz opcję płytkiego pobierania, co może oznaczać pokonanie jego celu. Aby zmniejszyć ilość danych pobranych lub ściągniętych z repozytorium Git, firma Microsoft dodała nową opcję wyewidencjonowania w celu kontrolowania zachowania synchronizacji tagów. Ta opcja jest dostępna zarówno w potokach klasycznych, jak i YAML.

Czy synchronizować tagi podczas wyewidencjonowania repozytorium można skonfigurować w języku YAML, ustawiając fetchTags właściwość i w interfejsie użytkownika przez skonfigurowanie ustawienia Tagi synchronizacji .

Aby skonfigurować ustawienie w języku YAML, ustaw fetchTags właściwość .

steps:
- checkout: self
  fetchTags: true

Aby skonfigurować ustawienie w interfejsie użytkownika potoku, edytuj potok YAML, a następnie wybierz pozycję Więcej akcji, wyzwalaczy, YAML, Pobierz źródła i zaznacz lub usuń zaznaczenie pola wyboru Tagi synchronizacji . Aby uzyskać więcej informacji, zobacz Synchronizowanie tagów.

Zachowanie domyślne

  • W przypadku istniejących potoków utworzonych przed wydaniem przebiegu usługi Azure DevOps 209, wydanego we wrześniu 2022 r., wartość domyślna synchronizacji tagów pozostaje taka sama jak w przypadku istniejącego zachowania przed dodaniu opcji tagów synchronizacji , czyli true.
  • W przypadku nowych potoków utworzonych po przebiegu usługi Azure DevOps w wersji 209 domyślną wartością dla tagów synchronizacji jest false.

Ważne

Ustawienie Tagów synchronizacji true w interfejsie użytkownika ma pierwszeństwo przed instrukcją fetchTags: false w języku YAML. Jeśli tagi synchronizacji są ustawione na wartość true w interfejsie użytkownika, tagi są synchronizowane, nawet jeśli fetchTags w języku YAML ustawiono wartość false.

Przykłady

Aby uniknąć synchronizowania źródeł w ogóle:

steps:
- checkout: none

Uwaga

Jeśli używasz agenta na koncie usługi lokalnej i chcesz zmodyfikować bieżące repozytorium przy użyciu operacji git lub ładowania modułów podrzędnych git, nadaj odpowiednie uprawnienia użytkownikowi kont usługi Kompilacja kolekcji projektów.

- checkout: self
  submodules: true
  persistCredentials: true

Aby wyewidencjonować wiele repozytoriów w potoku, wykonaj wiele checkout kroków:

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

Aby uzyskać więcej informacji, zobacz Sprawdzanie wielu repozytoriów w potoku.

Zobacz też