Определение steps.checkout

Используйте для checkout настройки способа, как конвейер извлекает исходный код.

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.

Определения, ссылающиеся на это определение: шаги

Свойства

checkout Строка. Требуется в качестве первого свойства.
Настраивает извлечение для указанного репозитория. Укажите self, none, имя репозитория или ресурс репозитория. Дополнительные сведения см. в разделе Извлечение нескольких репозиториев в конвейере.

Примечание

Если шаг отсутствует checkout , по умолчанию используется self значение для jobs.job.step.checkout и none для jobs.deployment.steps.checkout.

checkout Строка. Требуется в качестве первого свойства.
Указывает, следует ли проверка из репозитория, содержащего это определение конвейера. Следует задать self или none.

clean Строка.
Если задано значение true, перед получением выполните команду git clean -ffdx, а затем выполните сброс git --hard HEAD. True | Ложных.

fetchDepth Строка.
Глубина извлекаемого графа Git.

fetchTags Строка.
Задайте значение true, чтобы синхронизировать теги при выборке репозитория, или false, чтобы не синхронизировать теги. См. примечания для поведения по умолчанию.

lfs Строка.
Установите значение true, чтобы скачать файлы Git-LFS. По умолчанию их не нужно скачивать.

persistCredentials Строка.
Задайте значение true, чтобы оставить маркер OAuth в конфигурации Git после начальной выборки. Значение по умолчанию — не покидать его.

submodules Строка.
Задайте значение "true" для одного уровня подмодулей или "рекурсивный", чтобы получить подмодулы подмодулей. По умолчанию не требуется получение подмодулей.

path Строка.
Место для хранения репозитория. Корневым каталогом является $(Pipeline.Workspace).

condition Строка.
Оцените это выражение условия, чтобы определить, следует ли выполнять эту задачу.

continueOnErrorлогическое значение.
Продолжить работу даже при сбое?

displayName Строка.
Понятное имя задачи.

targetцелевой объект.
Среда, в которой выполняется эта задача.

enabledлогическое значение.
Запускать эту задачу при выполнении задания?

env словарь строк.
Переменные для сопоставления со средой процесса.

name Строка.
Идентификатор шага. Допустимые значения: [-_A-Za-z0-9]*.

timeoutInMinutes Строка.
Время ожидания завершения этой задачи, прежде чем сервер завершит ее.

Примечание

Для конвейеров можно настроить время ожидания на уровне задания. Если интервал времени ожидания на уровне задания истекает до завершения шага, выполняемое задание (включая ваш шаг) завершается, даже если шаг настроен с более длительным timeoutInMinutes интервалом. Дополнительные сведения см. в разделе Время ожидания.

retryCountOnTaskFailure Строка.
Количество повторных попыток в случае сбоя задачи.

Комментарии

Неглубокая выборка

Важно!

Для новых конвейеров, созданных после обновления azure DevOps sprint 209 за сентябрь 2022 г., по умолчанию включена неполная выборка и настроена глубина 1. Ранее по умолчанию не было мелкой выборки. Чтобы проверка конвейере, просмотрите параметр Неглубокая выборка в пользовательском интерфейсе параметров конвейера.

Чтобы отключить неполную выборку, можно выполнить один из следующих двух вариантов.

Чтобы настроить глубину выборки для конвейера, можно задать fetchDepth свойство на checkout шаге или настроить параметр мелкой выборки в пользовательском интерфейсе параметров конвейера.

Примечание

Если вы явно задали fetchDepth на шаге checkout , этот параметр имеет приоритет над параметром, настроенным в пользовательском интерфейсе параметров конвейера. Параметр fetchDepth: 0 извлекает весь журнал и переопределяет параметр мелкой выборки .

Чистое свойство

clean Если свойство не задано, его значение по умолчанию настраивается с помощью параметра очистки в параметрах пользовательского интерфейса для конвейеров YAML, которое по умолчанию имеет значение true. Помимо параметра очистки, доступного с помощью checkout, можно также настроить очистку в рабочей области. Дополнительные сведения о рабочих областях и параметрах очистки см. в разделе о рабочих областяхв разделе Задания.

Синхронизация тегов

Шаг извлечения использует --tags параметр при выборке содержимого репозитория Git. Это приводит к тому, что сервер получает все теги, а также все объекты, на которые указывают эти теги. Это увеличивает время выполнения задачи в конвейере, особенно при наличии большого репозитория с несколькими тегами. Кроме того, шаг оформления заказа синхронизирует теги даже при включении параметра неглубокой выборки, что может помешать его назначению. Чтобы уменьшить объем данных, извлекаемых или извлекаемых из репозитория Git, корпорация Майкрософт добавила новый параметр извлечения для управления поведением синхронизации тегов. Этот параметр доступен как в классическом конвейере, так и в конвейере YAML.

Можно ли настроить синхронизацию тегов при извлечении репозитория в YAML, задав fetchTags свойство и в пользовательском интерфейсе, настроив параметр Синхронизация тегов .

Чтобы настроить параметр в YAML, задайте fetchTags свойство .

steps:
- checkout: self
  fetchTags: true

Чтобы настроить параметр в пользовательском интерфейсе конвейера, измените конвейер YAML и выберите Дополнительные действия, Триггеры, YAML, Получить источники и проверка или снимите флажок Синхронизировать теги. Дополнительные сведения см. в разделе Синхронизация тегов.

Поведение по умолчанию

  • Для существующих конвейеров, созданных до выпуска Azure DevOps sprint 209, выпущенного в сентябре 2022 г., значение по умолчанию для синхронизации тегов остается таким же, как и поведение, существующее до добавления параметров синхронизации тегов , то есть true.
  • Для новых конвейеров, созданных после выпуска 209 спринта Azure DevOps, по умолчанию для синхронизации тегов используется false.

Важно!

Параметр синхронизации тегов true в пользовательском интерфейсе имеет приоритет над инструкцией fetchTags: false в YAML. Если в пользовательском интерфейсе для тегов синхронизации задано значение true, теги синхронизируются, даже если fetchTags в YAML задано значение false.

Примеры

Чтобы избежать синхронизации источников, выполните приведенные далее действия.

steps:
- checkout: none

Примечание

Если вы запускаете агент в учетной записи локальной службы и хотите изменить текущий репозиторий с помощью операций Git или загрузки подмодулей Git, предоставьте соответствующие разрешения пользователю Учетные записи службы сборки коллекции проектов.

- checkout: self
  submodules: true
  persistCredentials: true

Чтобы проверка несколько репозиториев в конвейере, выполните несколько checkout действий:

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

Дополнительные сведения см. в разделе Извлечение нескольких репозиториев в конвейере.

См. также раздел