definition av jobs.deployment.strategy
Med en distributionsstrategi kan du konfigurera hur uppdateringen levereras.
Definitioner som refererar till den här definitionen: jobs.deployment
Implementeringar
Implementering | Description |
---|---|
strategi: runOnce | Kör en gång distributionsstrategi. |
strategi: rullande | Strategi för löpande distribution. |
strategi: kanariefågel | Strategi för kanariedistribution. |
Kommentarer
När du distribuerar programuppdateringar är det viktigt att den teknik du använder för att leverera uppdateringen gör följande:
- Aktivera initiering.
- Distribuera uppdateringen.
- Dirigera trafik till den uppdaterade versionen.
- Testa den uppdaterade versionen efter routning av trafik.
- I händelse av fel kör du steg för att återställa till den senast kända bra versionen.
Vi uppnår detta genom att använda livscykelkrokar som kan köra steg under distributionen. Var och en av livscykelkrokerna matchas till ett agentjobb eller ett serverjobb (eller ett container- eller valideringsjobb i framtiden), beroende på poolattributet. Som standard ärver livscykelkrokerna den pool som anges av distributionsjobbet.
Distributionsjobb använder $(Pipeline.Workspace) system variable.
Om du använder lokalt installerade agenter kan du använda alternativen för att rensa arbetsytan för arbetsytan för att rensa distributionsarbetsytan.
jobs:
- deployment: deploy
pool:
vmImage: ubuntu-latest
workspace:
clean: all
environment: staging
strategi: runOnce
Distributionsstrategin runOnce distribuerar ändringar genom att köra vart och ett av stegen en gång.
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.
Egenskaper
runOnce
jobs.deployment.strategy.runOnce.
RunOnce-distributionsstrategi.
Kommentarer
runOnce
är den enklaste distributionsstrategin där alla livscykelkrokar, nämligen preDeploy
deploy
, routeTraffic
och postRouteTraffic
, körs en gång. Sedan körs antingen on: success
eller on: failure
.
strategi: rullande
En löpande distribution ersätter instanser av den tidigare versionen av ett program med instanser av den nya versionen av programmet på en fast uppsättning virtuella datorer (rullande uppsättning) i varje iteration.
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.
Egenskaper
rolling
jobs.deployment.strategy.rolling.
Strategi för löpande distribution.
strategi: kanariefågel
Strategin för canary-distribution distribuerar ändringar till en liten delmängd servrar.
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.
Egenskaper
canary
jobs.deployment.strategy.canary.
Strategi för kanariedistribution.
Kommentarer
Strategi för canary-distribution är en avancerad distributionsstrategi som hjälper till att minska risken med att lansera nya versioner av program. Genom att använda den här strategin kan du distribuera ändringarna till en liten delmängd servrar först. När du får mer förtroende för den nya versionen kan du släppa den till fler servrar i infrastrukturen och dirigera mer trafik till den.