steps.checkout definition
Usare checkout
per configurare il modo in cui la pipeline estrae il codice sorgente.
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.
steps:
- checkout: string # Required as first property. Whether or not to check out the repository containing this pipeline definition.
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.
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: 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.
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.
Definizioni che fanno riferimento a questa definizione: passaggi
Proprietà
checkout
stringa. Obbligatorio come prima proprietà.
Configura estrazione per il repository specificato. Specificare self
, none
, nome del repositoryo risorsa del repository. Per altre informazioni, vedere Controllare più repository nella pipeline.
Nota
Se non è presente alcun passaggio checkout
, per impostazione predefinita viene self
per jobs.job.step.checkout
e none
per jobs.deployment.steps.checkout
.
checkout
stringa. Obbligatorio come prima proprietà.
Indica se eseguire o meno il check-out del repository contenente questa definizione della pipeline. Specificare self
o none
.
clean
stringa.
Se true, eseguire git clean -ffdx seguito da git reset --hard HEAD prima del recupero. true | falso.
fetchDepth
stringa.
profondità del grafico Git da recuperare.
fetchFilter
stringa.
Usare fetchFilter
per filtrare la cronologia Git per la clonazione parziale. L'impostazione fetchFilter
supporta i recupero senza albero e senza BLOB. Per un recupero senza albero, specificare fetchFilter: tree:0
e per specificare un recupero senza BLOB, specificare fetchFilter: blob:none
. Il valore predefinito non è un filtro.
fetchTags
stringa.
Impostare su 'true' per sincronizzare i tag durante il recupero del repository o 'false' per non sincronizzare i tag. Per il comportamento predefinito, vedere le osservazioni.
lfs
stringa.
Impostare su "true" per scaricare Git-LFS file. Il valore predefinito non consiste nel scaricarli.
persistCredentials
stringa.
Impostare su "true" per lasciare il token OAuth nella configurazione Git dopo il recupero iniziale. Il valore predefinito non deve lasciarlo.
submodules
stringa.
Impostare su "true" per un singolo livello di moduli secondari o "ricorsivo" per ottenere sottomoduli di moduli secondari. Il valore predefinito non consiste nel recuperare i moduli secondari.
path
stringa.
Dove inserire il repository. La directory radice è $(Pipeline.Workspace). Per impostazione predefinita, questa cartella deve trovarsi nella struttura di directory di lavoro dell'agente. Per impostare un percorso all'esterno della directory di lavoro dell'agente, impostare una variabile della pipeline denominata AZP_AGENT_ALLOW_WORK_DIRECTORY_REPOSITORIES
su true e usare il prefisso ../
all'inizio del percorso di estrazione. Supportato nella versione dell'agente 3.230.0 e successive.
sparseCheckoutDirectories
stringa.
Specificare una directory per abilitare l'estrazione di tipo sparse in modalità cono usando la corrispondenza della directory. Separare più directory usando uno spazio.
- checkout: repo
sparseCheckoutDirectories: src
Se vengono impostati sia sparseCheckoutDirectories
che sparseCheckoutPatterns
, sparseCheckoutDirectories
viene usata e l'impostazione per sparseCheckoutPatterns
viene ignorata.
Per altre informazioni sull'estrazione di tipo sparse, vedere Portare il monorepo fino alle dimensioni condi estrazione di tipo sparse.
sparseCheckoutPatterns
stringa.
Specificare un modello per abilitare il checkout di tipo sparse in modalità non coni usando criteri di ricerca. Separare più modelli usando uno spazio.
- checkout: repo
sparseCheckoutPatterns: /* !/img
Se vengono impostati sia sparseCheckoutDirectories
che sparseCheckoutPatterns
, sparseCheckoutDirectories
viene usata e l'impostazione per sparseCheckoutPatterns
viene ignorata.
Per altre informazioni sull'estrazione di tipo sparse, vedere Portare il monorepo fino alle dimensioni condi estrazione di tipo sparse.
workspaceRepo
stringa.
Se true, usare la directory radice del repository come directory di lavoro predefinita per la pipeline. Il valore predefinito è false.
condition
stringa.
Valutare questa espressione di condizione per determinare se eseguire questa attività.
displayName
stringa.
nome leggibile per l'attività.
target
destinazione.
Ambiente in cui eseguire questa attività.
env
dizionario di stringhe.
Variabili di cui eseguire il mapping nell'ambiente del processo.
name
stringa.
ID del passaggio. Valori accettabili: [-_A-Za-z0-9]*.
timeoutInMinutes
stringa.
Tempo di attesa per il completamento dell'attività prima che il server lo uccida.
Nota
Le pipeline possono essere configurate con un timeout a livello di processo. Se l'intervallo di timeout a livello di processo è trascorso prima del completamento del passaggio, il processo in esecuzione (incluso il passaggio) viene terminato, anche se il passaggio è configurato con un intervallo di timeoutInMinutes
più lungo. Per altre informazioni, vedere timeout.
retryCountOnTaskFailure
stringa.
Numero di tentativi in caso di errore dell'attività.
Osservazioni
- di recupero superficiale
- proprietà Clean
- sincronizza tag
- di recupero superficiale
- proprietà Clean
Recupero superficiale
Nota
In alcune organizzazioni, le nuove pipeline create dopo l'aggiornamento settembre 2022 di Azure DevOps sprint 209 hanno recupero superficiale abilitato per impostazione predefinita e configurato con una profondità pari a 1. In precedenza il valore predefinito non era quello di recuperare poco.
Per controllare la pipeline, visualizzare l'impostazione recupero superficiale nell'interfaccia utente delle impostazioni della pipeline .
Per disabilitare il recupero superficiale, è possibile eseguire una delle due opzioni seguenti.
- Disabilitare l'opzione di recupero superficiale nell'interfaccia utente delle impostazioni della pipeline .
- Impostare in modo esplicito
fetchDepth: 0
nel passaggiocheckout
.
Per configurare la profondità di recupero per una pipeline, è possibile impostare la proprietà fetchDepth
nel passaggio checkout
oppure configurare l'impostazione recupero superficiale nell'interfaccia utente delle impostazioni della pipeline di .
Nota
Se si imposta in modo esplicito fetchDepth
nel passaggio checkout
, tale impostazione assume la priorità rispetto all'impostazione configurata nell'interfaccia utente delle impostazioni della pipeline. L'impostazione fetchDepth: 0
recupera tutta la cronologia ed esegue l'override dell'impostazione di recupero superficiale.
Proprietà Clean
Se la proprietà clean
non è impostata, il valore predefinito viene configurato dall'impostazione pulita nelle impostazioni dell'interfaccia utente per le pipeline YAML, che è impostata su true per impostazione predefinita. Oltre all'opzione di pulizia disponibile tramite checkout
, è anche possibile configurare la pulizia in un'area di lavoro. Per altre informazioni sulle aree di lavoro e sulle opzioni pulite, vedere l'argomento dell'area di lavoro in Processi.
Tag di sincronizzazione
Il passaggio di estrazione usa l'opzione --tags
durante il recupero del contenuto di un repository Git. In questo modo il server recupera tutti i tag e tutti gli oggetti a cui puntano tali tag. Ciò aumenta il tempo necessario per eseguire l'attività in una pipeline, in particolare se si dispone di un repository di grandi dimensioni con un numero di tag. Inoltre, il passaggio di estrazione sincronizza i tag anche quando si abilita l'opzione di recupero superficiale, eventualmente sconfiggendone lo scopo. Per ridurre la quantità di dati recuperati o estratti da un repository Git, Microsoft ha aggiunto una nuova opzione per controllare il comportamento dei tag di sincronizzazione. Questa opzione è disponibile sia nelle pipeline classiche che nelle pipeline YAML.
Se sincronizzare i tag quando si estrae un repository può essere configurato in YAML impostando la proprietà fetchTags
e nell'interfaccia utente configurando l'impostazione tag di sincronizzazione.
Per configurare l'impostazione in YAML, impostare la proprietà fetchTags
.
steps:
- checkout: self
fetchTags: true
Per configurare l'impostazione nell'interfaccia utente della pipeline, modificare la pipeline YAML e scegliere Altre azioni, trigger , YAML, Recupera originie selezionare o deselezionare la casella di controllo Tag di sincronizzazione. Per altre informazioni, vedere tag di sincronizzazione .
Comportamento predefinito
- Per le pipeline esistenti create prima del rilascio di azure DevOps sprint 209, rilasciate nel mese di settembre 2022, l'impostazione predefinita per la sincronizzazione dei tag rimane identica al comportamento esistente prima dell'aggiunta delle opzioni tag di sincronizzazione, ovvero
true
. - Per le nuove pipeline create dopo la versione 209 dello sprint di Azure DevOps, l'impostazione predefinita per la sincronizzazione dei tag è
false
.
Importante
Un'impostazione tag di sincronizzazione di true nell'interfaccia utente ha la precedenza su un'istruzione fetchTags: false
in YAML. Se i tag di sincronizzazione è impostato su true nell'interfaccia utente, i tag vengono sincronizzati anche se fetchTags
è impostato su false in YAML.
Esempi
Sono disponibili tre opzioni per checkout
. Per impostazione predefinita, Azure DevOps estrae il repository corrente con self
per i processi. Quando si imposta none
, non viene estratto alcun repository. Se si specifica un altro repository, tale repository viene estratto. Per eseguire il check-out di un repository diverso, configurarlo come risorsa del repository prima.
# 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
Per evitare la sincronizzazione delle origini:
steps:
- checkout: none
Nota
Se si esegue l'agente nell'account del servizio locale e si vuole modificare il repository corrente usando le operazioni Git o il caricamento di sottomoduli Git, concedere le autorizzazioni appropriate all'utente project Collection Build Service Accounts.
- checkout: self
submodules: true
persistCredentials: true
Per eseguire il check-out di più repository nella pipeline, usare più passaggi checkout
:
- checkout: self
- checkout: git://MyProject/MyRepo
- checkout: MyGitHubRepo # Repo declared in a repository resource
Per altre informazioni, vedere Controllare più repository nella pipeline.