definisi steps.checkout

Gunakan checkout untuk mengonfigurasi cara alur memeriksa kode sumber.

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.

Definisi yang mereferensikan definisi ini: langkah-langkah

Properti

checkout String. Diperlukan sebagai properti pertama.
Mengonfigurasi checkout untuk repositori yang ditentukan. Tentukan self, none, nama repositori, atau sumber daya repositori. Untuk informasi selengkapnya, lihat Memeriksa beberapa repositori di alur Anda.

Catatan

Jika tidak ada checkout langkah, itu default ke untuk selfjobs.job.step.checkout dan none untuk jobs.deployment.steps.checkout.

checkout String. Diperlukan sebagai properti pertama.
Apakah akan memeriksa repositori yang berisi definisi alur ini atau tidak. Tentukan self atau none.

clean String.
Jika true, jalankan git clean -ffdx diikuti oleh git reset --hard HEAD sebelum mengambil. benar | Palsu.

fetchDepth String.
Kedalaman grafik Git untuk diambil.

fetchTags String.
Atur ke 'true' untuk menyinkronkan tag saat mengambil repositori, atau 'false' untuk tidak menyinkronkan tag. Lihat keterangan untuk perilaku default.

lfs String.
Atur ke 'true' untuk mengunduh file Git-LFS. Defaultnya adalah tidak mengunduhnya.

persistCredentials String.
Atur ke 'true' untuk meninggalkan token OAuth di konfigurasi Git setelah pengambilan awal. Defaultnya adalah tidak membiarkannya.

submodules String.
Atur ke 'true' untuk satu tingkat submodul atau 'rekursif' untuk mendapatkan submodul submodul. Defaultnya adalah tidak mengambil submodul.

path String.
Di mana menempatkan repositori. Direktori akar adalah $(Pipeline.Workspace).

condition String.
Evaluasi ekspresi kondisi ini untuk menentukan apakah akan menjalankan tugas ini.

continueOnErrorboolean.
Terus berjalan bahkan pada kegagalan?

displayName String.
Nama yang dapat dibaca manusia untuk tugas tersebut.

targettarget.
Lingkungan untuk menjalankan tugas ini.

enabledboolean.
Jalankan tugas ini saat pekerjaan berjalan?

env kamus string.
Variabel untuk dipetakan ke lingkungan proses.

name String.
ID langkah. Nilai yang dapat diterima: [-_A-Za-z0-9]*.

timeoutInMinutes String.
Waktu untuk menunggu tugas ini selesai sebelum server mematikannya.

Catatan

Alur dapat dikonfigurasi dengan batas waktu tingkat pekerjaan. Jika interval batas waktu tingkat pekerjaan berlalu sebelum langkah Anda selesai, pekerjaan yang sedang berjalan (termasuk langkah Anda) dihentikan, bahkan jika langkah dikonfigurasi dengan interval yang lebih lama timeoutInMinutes . Untuk informasi selengkapnya, lihat Batas Waktu.

retryCountOnTaskFailure String.
Jumlah percobaan ulang jika tugas gagal.

Keterangan

Pengambilan dangkal

Penting

Alur baru yang dibuat setelah pembaruan Azure DevOps sprint 209 September 2022 mengaktifkan pengambilan Dangkal secara default dan dikonfigurasi dengan kedalaman 1. Sebelumnya defaultnya bukan untuk mengambil dangkal. Untuk memeriksa alur Anda, lihat pengaturan Pengambilan dangkal di antarmuka pengguna pengaturan alur.

Untuk menonaktifkan pengambilan dangkal, Anda dapat melakukan salah satu dari dua opsi berikut.

Untuk mengonfigurasi kedalaman pengambilan untuk alur, Anda dapat mengatur fetchDepth properti dalam checkout langkah, atau mengonfigurasi pengaturan pengambilan Dangkal di antarmuka pengguna pengaturan alur.

Catatan

Jika Anda secara eksplisit mengatur fetchDepth langkah Anda checkout , pengaturan tersebut lebih diprioritaskan daripada pengaturan yang dikonfigurasi di antarmuka pengguna pengaturan alur. Pengaturan fetchDepth: 0 mengambil semua riwayat dan mengambil alih pengaturan pengambilan Dangkal .

Bersihkan properti

clean Jika properti tidak diatur, maka nilai defaultnya dikonfigurasi oleh pengaturan bersih di pengaturan UI untuk alur YAML, yang diatur ke true secara default. Selain opsi pembersihan yang tersedia menggunakan checkout, Anda juga dapat mengonfigurasi pembersihan di ruang kerja. Untuk informasi selengkapnya tentang ruang kerja dan opsi bersih, lihat topik ruang kerja di Pekerjaan.

Sinkronkan tag

Langkah checkout menggunakan --tags opsi saat mengambil konten repositori Git. Ini menyebabkan server mengambil semua tag serta semua objek yang ditujukkan oleh tag tersebut. Ini meningkatkan waktu untuk menjalankan tugas dalam alur, terutama jika Anda memiliki repositori besar dengan sejumlah tag. Selain itu, langkah checkout menyinkronkan tag bahkan ketika Anda mengaktifkan opsi pengambilan dangkal, sehingga mungkin mengalahkan tujuannya. Untuk mengurangi jumlah data yang diambil atau ditarik dari repositori Git, Microsoft telah menambahkan opsi baru untuk checkout guna mengontrol perilaku sinkronisasi tag. Opsi ini tersedia baik dalam alur klasik maupun YAML.

Apakah akan menyinkronkan tag saat memeriksa repositori dapat dikonfigurasi di YAML dengan mengatur fetchTags properti , dan di UI dengan mengonfigurasi pengaturan Sinkronkan tag .

Untuk mengonfigurasi pengaturan di YAML, atur fetchTags properti .

steps:
- checkout: self
  fetchTags: true

Untuk mengonfigurasi pengaturan di UI alur, edit alur YAML Anda, dan pilih Tindakan lainnya, Pemicu, YAML, Dapatkan sumber, dan centang atau hapus centang pada kotak centang Sinkronkan tag . Untuk informasi selengkapnya, lihat Menyinkronkan tag.

Perilaku default

  • Untuk alur yang sudah ada yang dibuat sebelum rilis Azure DevOps sprint 209, dirilis pada Bulan September 2022, default untuk menyinkronkan tag tetap sama dengan perilaku yang ada sebelum opsi Sinkronkan tag ditambahkan, yaitu true.
  • Untuk alur baru yang dibuat setelah rilis sprint Azure DevOps 209, default untuk menyinkronkan tag adalah false.

Penting

Pengaturan Tag sinkronisasi true di UI lebih diutamakan daripada fetchTags: false pernyataan di YAML. Jika Tag sinkronisasi diatur ke true di UI, tag disinkronkan meskipun fetchTags diatur ke false di YAML.

Contoh

Untuk menghindari sinkronisasi sumber sekalipun:

steps:
- checkout: none

Catatan

Jika Anda menjalankan agen di akun Layanan Lokal dan ingin memodifikasi repositori saat ini dengan menggunakan operasi git atau memuat submodul git, berikan izin yang tepat kepada pengguna Akun Layanan Build Koleksi Proyek.

- checkout: self
  submodules: true
  persistCredentials: true

Untuk memeriksa beberapa repositori di alur Anda, gunakan beberapa checkout langkah:

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

Untuk informasi selengkapnya, lihat Memeriksa beberapa repositori di alur Anda.

Lihat juga