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: 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.
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 Lihat beberapa repositori di alur Anda.
Nota
Jika tidak ada langkah checkout
yang ada, langkah tersebut default ke self
untuk jobs.job.step.checkout
dan none
untuk jobs.deployment.steps.checkout
.
clean
string.
Jika true, jalankan git clean -ffdx diikuti dengan git reset --hard HEAD sebelum mengambil. benar | palsu.
fetchDepth
string.
Kedalaman grafik Git untuk diambil.
fetchFilter
string.
Gunakan fetchFilter
untuk memfilter riwayat Git untuk kloning parsial. Pengaturan fetchFilter
mendukung pengambilan tanpa pohon dan tanpa blob. Untuk pengambilan tanpa pohon, tentukan fetchFilter: tree:0
dan untuk menentukan pengambilan blobless, tentukan fetchFilter: blob:none
. Defaultnya adalah tidak ada pemfilteran.
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 bukan untuk 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.
Tempat meletakkan repositori. Direktori akar adalah $(Pipeline.Workspace). Secara default folder ini harus berada di bawah struktur direktori kerja agen. Untuk mengatur jalur di luar direktori kerja agen, atur variabel alur bernama AZP_AGENT_ALLOW_WORK_DIRECTORY_REPOSITORIES
ke true, dan gunakan awalan ../
di awal jalur checkout Anda. Didukung pada agen versi 3.230.0 dan yang lebih tinggi.
sparseCheckoutDirectories
string.
Tentukan direktori untuk mengaktifkan cek keluar jarang dalam mode kerucut menggunakan pencocokan direktori. Pisahkan beberapa direktori menggunakan spasi.
- checkout: repo
sparseCheckoutDirectories: src
Jika sparseCheckoutDirectories
dan sparseCheckoutPatterns
diatur, sparseCheckoutDirectories
digunakan dan pengaturan untuk sparseCheckoutPatterns
diamankan.
Untuk informasi selengkapnya tentang checkout jarang, lihat Menurunkan ukuran monorepo Anda dengan cek keluar jarang.
sparseCheckoutPatterns
string.
Tentukan pola untuk mengaktifkan checkout jarang dalam mode non-kerucut menggunakan pencocokan pola. Pisahkan beberapa pola menggunakan spasi.
- checkout: repo
sparseCheckoutPatterns: /* !/img
Jika sparseCheckoutDirectories
dan sparseCheckoutPatterns
diatur, sparseCheckoutDirectories
digunakan dan pengaturan untuk sparseCheckoutPatterns
diamankan.
Untuk informasi selengkapnya tentang checkout jarang, lihat Menurunkan ukuran monorepo Anda dengan cek keluar jarang.
workspaceRepo
string.
Jika benar, gunakan direktori akar repositori sebagai direktori kerja default untuk alur. Defaultnya adalah false.
condition
string.
Evaluasi ekspresi kondisi ini untuk menentukan apakah akan menjalankan tugas ini.
displayName
string.
Nama yang dapat dibaca manusia untuk tugas tersebut.
target
target.
Lingkungan tempat menjalankan tugas ini.
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.
Nota
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 timeoutInMinutes
yang lebih lama. Untuk informasi selengkapnya, lihat Batas Waktu.
retryCountOnTaskFailure
string.
Jumlah percobaan ulang jika tugas gagal.
Komentar
Pengambilan dangkal
Nota
Di beberapa organisasi, alur baru yang dibuat setelah pembaruan azure DevOps sprint 209 September 2022 memiliki pengambilan Shallow diaktifkan secara default dan dikonfigurasi dengan kedalaman 1. Sebelumnya defaultnya adalah tidak mengambil dangkal.
Untuk memeriksa alur Anda, lihat pengaturan pengambilan Shallow di pengaturan alur UI.
Untuk menonaktifkan pengambilan dangkal, Anda dapat melakukan salah satu dari dua opsi berikut.
- Nonaktifkan opsi pengambilan dangkal di antarmuka pengguna pengaturan alur .
- Atur
fetchDepth: 0
secara eksplisit di langkahcheckout
Anda.
Untuk mengonfigurasi kedalaman pengambilan untuk alur, Anda dapat mengatur properti fetchDepth
di langkah checkout
, atau mengonfigurasi pengaturan pengambilan Dangkal di antarmuka pengguna pengaturan alur .
Nota
Jika Anda secara eksplisit mengatur fetchDepth
dalam langkah checkout
Anda, pengaturan tersebut lebih diprioritaskan daripada pengaturan yang dikonfigurasi di antarmuka pengguna pengaturan alur. Pengaturan fetchDepth: 0
mengambil semua riwayat dan mengambil alih pengaturan pengambilan Shallow.
Bersihkan properti
Jika properti clean
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 opsi --tags
saat mengambil konten repositori Git. Hal 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 properti fetchTags
, dan di UI dengan mengonfigurasi pengaturan Sinkronkan tag.
Untuk mengonfigurasi pengaturan di YAML, atur properti fetchTags
.
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 Sinkronkan tag.
Perilaku default
- Untuk alur yang 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 tag Sinkronisasi opsi ditambahkan, yang
true
. - Untuk alur baru yang dibuat setelah rilis sprint Azure DevOps 209, default untuk menyinkronkan tag
false
.
Penting
Tag sinkronisasi pengaturan true di UI lebih diutamakan daripada pernyataan fetchTags: false
di YAML. Jika Sinkronkan tag diatur ke true di UI, tag disinkronkan meskipun fetchTags
diatur ke false di YAML.
Contoh
Ada tiga opsi untuk checkout
. Secara default, Azure DevOps memeriksa repositori saat ini dengan self
untuk pekerjaan. Saat Anda mengatur none
, tidak ada repositori yang dicek keluar. Jika Anda menentukan repositori lain, repositori tersebut akan dicek keluar. Untuk memeriksa repositori yang berbeda, siapkan sebagai sumber daya repositori terlebih dahulu.
# 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
Untuk menghindari sinkronisasi sumber sekalipun:
steps:
- checkout: none
Nota
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 langkah checkout
:
- checkout: self
- checkout: git://MyProject/MyRepo
- checkout: MyGitHubRepo # Repo declared in a repository resource
Untuk informasi selengkapnya, lihat Lihat beberapa repositori di alur Anda.