definizione jobs.deployment.strategy

Una strategia di distribuzione consente di configurare la modalità di distribuzione dell'aggiornamento.

Definizioni che fanno riferimento a questa definizione: jobs.deployment

Implementazioni

Implementazione Descrizione
strategia: runOnce Eseguire una sola volta la strategia di distribuzione.
strategia: in sequenza Strategia di distribuzione in sequenza.
strategia: canary Strategia di distribuzione Canary.

Commenti

Quando si distribuiscono gli aggiornamenti dell'applicazione, è importante che la tecnica usata per recapitare l'aggiornamento:

  • Abilitare l'inizializzazione.
  • Distribuire l'aggiornamento.
  • Instradare il traffico alla versione aggiornata.
  • Testare la versione aggiornata dopo il routing del traffico.
  • In caso di errore, eseguire i passaggi per ripristinare l'ultima versione valida nota.

A questo scopo, si usano hook del ciclo di vita che possono eseguire passaggi durante la distribuzione. Ogni hook del ciclo di vita viene risolto in un processo dell'agente o in un processo del server (o in futuro un processo di convalida o contenitore), a seconda dell'attributo del pool. Per impostazione predefinita, gli hook del ciclo di vita erediteranno il pool specificato dal processo di distribuzione.

I processi di distribuzione usano $(Pipeline.Workspace) system variable.

Se si usano agenti self-hosted, è possibile usare le opzioni di pulizia dell'area di lavoro per pulire l'area di lavoro di distribuzione.

  jobs:
  - deployment: deploy
    pool:
      vmImage: ubuntu-latest
      workspace:
        clean: all
    environment: staging

strategia: runOnce

La strategia di distribuzione runOnce implementa le modifiche eseguendo ogni passaggio una volta.

strategy:
  runOnce: # RunOnce Deployment strategy.
    preDeploy: # Pre deploy hook for runOnce deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where pre deploy steps will run.
    deploy: # Deploy hook for runOnce deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where deploy steps will run.
    routeTraffic: # Route traffic hook for runOnce deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where route traffic steps will run.
    postRouteTraffic: # Post route traffic hook for runOnce deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where post route traffic steps will run.
    on: # On success or failure hook for runOnce deployment strategy.
      failure: # Runs on failure of any step.
        steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
        pool: string | pool # Pool where post on failure steps will run.
      success: # Runs on success of all of the steps.
        steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
        pool: string | pool # Pool where on success steps will run.

Proprietà

runOncejobs.deployment.strategy.runOnce.
Strategia di distribuzione RunOnce.

Commenti

runOnce è la strategia di distribuzione più semplice in cui tutti gli hook del ciclo di vita, ovvero preDeploydeploy, routeTraffice postRouteTraffic, vengono eseguiti una sola volta. on: success Viene quindi eseguito o on: failure .

strategia: in sequenza

Una distribuzione in sequenza sostituisce le istanze della versione precedente di un'applicazione con istanze della nuova versione dell'applicazione in un set fisso di macchine virtuali (set in sequenza) in ogni iterazione.

strategy:
  rolling: # Rolling Deployment strategy.
    maxParallel: string # Maximum number of jobs running in parallel.
    preDeploy: # Pre deploy hook for rolling deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where pre deploy steps will run.
    deploy: # Deploy hook for rolling deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where deploy steps will run.
    routeTraffic: # Route traffic hook for rolling deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where route traffic steps will run.
    postRouteTraffic: # Post route traffic hook for rolling deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where post route traffic steps will run.
    on: # On success or failure hook for rolling deployment strategy.
      failure: # Runs on failure of any step.
        steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
        pool: string | pool # Pool where post on failure steps will run.
      success: # Runs on success of all of the steps.
        steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
        pool: string | pool # Pool where on success steps will run.

Proprietà

rollingjobs.deployment.strategy.rolling.
Strategia di distribuzione in sequenza.

strategia: canary

La strategia di distribuzione Canary implementa le modifiche a un piccolo subset di server.

strategy:
  canary: # Canary Deployment strategy.
    increments: [ string ] # Maximum batch size for deployment.
    preDeploy: # Pre deploy hook for canary deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where pre deploy steps will run.
    deploy: # Deploy hook for canary deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where deploy steps will run.
    routeTraffic: # Route traffic hook for canary deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where route traffic steps will run.
    postRouteTraffic: # Post route traffic hook for canary deployment strategy.
      steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
      pool: string | pool # Pool where post route traffic steps will run.
    on: # On success or failure hook for canary deployment strategy.
      failure: # Runs on failure of any step.
        steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
        pool: string | pool # Pool where post on failure steps will run.
      success: # Runs on success of all of the steps.
        steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] # A list of steps to run.
        pool: string | pool # Pool where on success steps will run.

Proprietà

canaryjobs.deployment.strategy.canary.
Strategia di distribuzione Canary.

Commenti

La strategia di distribuzione Canary è una strategia di distribuzione avanzata che consente di ridurre il rischio di implementazione di nuove versioni delle applicazioni. Usando questa strategia, è possibile implementare prima le modifiche in un piccolo sottoinsieme di server. Man mano che si acquisisce maggiore familiarità con la nuova versione, è possibile rilasciarla in più server dell'infrastruttura e instradarvi più traffico.

Vedi anche