• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Automated release management with team city & octopusdeploy - NDC 2013
 

Automated release management with team city & octopusdeploy - NDC 2013

on

  • 2,156 views

 

Statistics

Views

Total Views
2,156
Views on SlideShare
2,155
Embed Views
1

Actions

Likes
1
Downloads
20
Comments
0

1 Embed 1

http://librosweb.es 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Automated release management with team city & octopusdeploy - NDC 2013 Automated release management with team city & octopusdeploy - NDC 2013 Presentation Transcript

    • AUTOMATED RELEASEMANAGEMENTWITH TEAMCITY & OCTOPUSDEPLOY
    • CONTINOUS DELIVERY14.06.2013 / 2
    • Continuous Integration14.06.2013 / 3
    • Continuous Deployment14.06.2013 / 4
    • Continuous Delivery14.06.2013 / 5
    • It’s all about frequent releases14.06.2013 / 6John Allspaw: “Ops metametrics” http://slidesha.re/dsSZIrIt’s all about failing fast
    • The deployment pipeline14.06.2013 / 7
    • Test coverage14.06.2013 / 8http://www.industrieit.com/blog/2012/02/a-practical-guide-to-extending-continuous-integration-to-continuous-delivery/http://jamescrisp.org/2011/05/30/automated-testing-and-the-test-pyramid/
    • Blue-green deployment14.06.2013 / 9Jez Humble: “Continous Delivery” http://www.slideshare.net/jezhumble/continuous-delivery-5359386
    • Blue-green deployment14.06.2013 / 10Jez Humble: “Continous Delivery” http://www.slideshare.net/jezhumble/continuous-delivery-5359386
    • Blue-green deployment14.06.2013 / 11Jez Humble: “Continous Delivery” http://www.slideshare.net/jezhumble/continuous-delivery-5359386
    • Blue-green deployment14.06.2013 / 12Jez Humble: “Continous Delivery” http://www.slideshare.net/jezhumble/continuous-delivery-5359386
    • Canary releasing14.06.2013 / 13Jez Humble: “Four principles or Low-Risk Software releases” http://www.informit.com/articles/article.aspx?p=1833567
    • The arguments14.06.2013 / 14
    • The arguments14.06.2013 / 15
    • 14.06.2013 / 16
    • DEPLOYING A WEBSITE14.06.2013 / 17
    • Basic asp.net mvc4 website<hgroup class="title"><h1>Welcome to ASP.NET Web API!</h1><br /><h2>@WebApiApplication.Environment -@WebApiApplication.Version</h2></hgroup>14.06.2013 / 18
    • Web.Development.config<?xml version="1.0"?><configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"><appSettings><add key="Environment" value="Development“xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/></appSettings></configuration>14.06.2013 / 19
    • Creating the Octopus NuGet package• Why NuGet?– Metadata– Lots of available tools– Feed-based– Developers know how to use them– Already used for other purposes (check out chocolatey.org)• Does NOT use the default NuGet conventions– Octopus deploys the exact structure of the package14.06.2013 / 20
    • mvc4webapi.nuspec<?xml version="1.0"?><packagexmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata><id>Itera.NDC2013.TCOD.Web</id><title>ASP.NET MVC 4 Web Api demo site</title><version>1.0.0</version><authors>Kristoffer Rolf Deinoff</authors><owners>Kristoffer Rolf Deinoff</owners><licenseUrl>http://itera.no</licenseUrl><projectUrl>http://itera.no</projectUrl><requireLicenseAcceptance>false</requireLicenseAcceptance><description>A sample project</description><releaseNotes>First release</releaseNotes></metadata></package>14.06.2013 / 21
    • Using OctoPack14.06.2013 / 22
    • Using TeamCity14.06.2013 / 23
    • Using NuGet.exenuget.exe pack $nuspecFileName-OutputDirectory $contentDir-Version $version14.06.2013 / 24
    • Configuring TeamCity14.06.2013 / 25
    • Configuring TeamCity – Commit build14.06.2013 / 26
    • Configuring TeamCity – VCS root14.06.2013 / 27
    • Configuring TeamCity – Patch AssemblyInfo14.06.2013 / 28
    • Configuring TeamCity - Compile14.06.2013 / 29
    • Configuring TeamCity – Commit tests14.06.2013 / 30
    • Configuring TeamCity – Trigger on check-in14.06.2013 / 31
    • Configuring TeamCity – Build artifacts14.06.2013 / 32
    • Configuring TeamCity – NuGet Server14.06.2013 / 33
    • Configuring TeamCity – NuGet Server14.06.2013 / 34
    • Configuring OctopusDeploy - Environments14.06.2013 / 35
    • Configuring OctopusDeploy – NuGet server14.06.2013 / 36
    • Configuring OctopusDeploy – Steps14.06.2013 / 37
    • Configuring OctopusDeploy – Publish website14.06.2013 / 38
    • Configuring OctopusDeploy – Publish website14.06.2013 / 39
    • Configuring OctopusDeploy – Smoke test14.06.2013 / 40$url = ("http://" + $hostname + ":" + $port + "/")Invoke-WebRequest $url -UseBasicParsing
    • Configuring OctopusDeploy – UAT Verification14.06.2013 / 41
    • Configuring OctopusDeploy – Variables14.06.2013 / 42
    • Configuring OctopusDeploy – Security14.06.2013 / 43
    • Configuring OctopusDeploy – Security14.06.2013 / 44
    • Configuring TeamCity – Integration build14.06.2013 / 45
    • Configuring TeamCity – Dependencies14.06.2013 / 46
    • Configuring TeamCity – Create release14.06.2013 / 47
    • Configuring TeamCity – Integration tests14.06.2013 / 48$url = ("http://tcod-build:8080/")$TeamCitySession = New-Object Microsoft.PowerShell.Commands.WebRequestSessionInvoke-WebRequest -Uri $url -WebSession $TeamCitySession -UseBasicParsing
    • DEPLOYING A SERVICE14.06.2013 / 49
    • Asp.net mvc webapi as a service14.06.2013 / 50<appSettings><add key="Environment" value="Local" /><add key="Hostname" value="localhost" /><add key="Port" value="8989" /></appSettings>
    • And then…14.06.2013 / 51
    • Differences - Steps14.06.2013 / 52
    • Differences - Publish service14.06.2013 / 53
    • Differences - Variables14.06.2013 / 54
    • Differences - Automated «Acceptance test»14.06.2013 / 55$url = ("http://tcod-build:8090/api/version")$TeamCitySession = New-Object Microsoft.PowerShell.Commands.WebRequestSession$response = Invoke-WebRequest -Uri $url -WebSession $TeamCitySession -UseBasicParsingif ($response.Content.Contains("Development")){Write-Host "Correct environment(Development)."}else{Write-Host Environment Development not found.Exit 1}$buildNumber = $env:build_numberif ($response.Content.Contains($buildNumber)){Write-Host "Correct build number($buildNumber)."}else{Write-Host Build number $buildNumber not found.Exit 1}
    • WRITING POWERSHELLS SCRIPTS14.06.2013 / 56
    • Deploy.config14.06.2013 / 57<?xml version="1.0"?><configuration><name>MyProject</name><nuGet><url>"http://www.myget.org/F/MyProject/"</url><apiKey>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</apiKey><username>myUser</username><password>myPassword</password></nuGet></configuration>
    • CreateOctopusPackage.ps114.06.2013 / 58param ([string]$contentDir, [string]$version)try{$configFile = New-Object XML$configFile.Load(Deploy.config)$config = $configFile.configuration$nuspecFileName = $config.name+.nuspec$targetNuspecFileName = Join-Path $contentDir $nuspecFileName.nuget.exe pack $targetNuspecFileName-OutputDirectory $contentDir-Version $version}catch {Write-Error $error[0]Exit 1}
    • PublishNuGet.ps114.06.2013 / 59param ([string]$contentDir, [string]$version)try{$configFile = New-Object XML$configFile.Load(Deploy.config)$config = $configFile.configuration$nugetFileName = $config.name+.+$version+.nupkgnuget sources Add -Name $config.name -Source $config.nuGet.url-Username $config.nuGet.username-Password $config.nuGet.passwordnuget push $nugetFileName $config.nuGet.apiKey -Source $config.namenuget sources Remove -Name $config.name}catch {Write-Error $error[0]Exit 1}
    • CreateMSDeployPackage.ps114.06.2013 / 60param ([string]$sourceDir, [string]$targetPackage)$BuildDir = (Split-Path $MyInvocation.MyCommand.Path -Parent)$msdeploy = $BuildDir + "msdeploy.exe"$parameterFile = $BuildDir + "parameters.xml"$msdeploy_params = " -verb:sync"$msdeploy_params += " -source:contentPath=" + $sourceDir$msdeploy_params += " -dest:package=" + $targetPackage$msdeploy_params += " -declareParamFile:" + $parameterFileWrite-Host "creating $targetPackage from $sourceDir."try {iex "$msdeploy $msdeploy_params"}catch {Write-Error $error[0]Exit 1}
    • Deploy.ps114.06.2013 / 61. .DeployUtil.ps1$ServiceName = "Itera.NDC2013.TCOD.Service"$ServiceExecutable = $ServiceName + ".exe"Install-WebApi-Service $ServiceName $ServiceExecutable
    • DeployUtil.ps114.06.2013 / 62function Install-WebApi-Service($name, $executable) {Write-Host "$name$executable"$service = Get-Service $name -ErrorAction SilentlyContinue$fullPath = Resolve-Path $executableif (! $service) {Write-Host "Installing service"$frameworkDir = Get-FrameworkDirectorySet-Alias install_util (Join-Path $frameworkDir "installutil.exe")install_util $fullPath} else {Write-Host "The service will be stopped and reconfigured"Stop-Service $name -Force& "sc.exe" config $service.Name binPath= $fullPath start= auto}$config = $executable + ".config"$port = Get-Port $configSet-User-Rights $port "NT AUTHORITYNETWORK SERVICE"Write-Host "Starting service"Start-Service $name | Write-Host}
    • DeployUtil.ps114.06.2013 / 63function Get-FrameworkDirectory {$([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())}function Set-User-Rights($port, $user) {$uri = "http://+:$port/"$acls = (netsh http show urlacl url=$uri | Select-String -SimpleMatch $user)if ($acls.count -eq 0 ) {Write-Host "Setting rights for $user on $uri"netsh http add urlacl url=$uri user=$user | Write-Host} else {Write-Host "Rights already set for $user on $uri."}}
    • DeployUtil.ps114.06.2013 / 64function Get-Port($config){Write-Host "Reading config file $config"$found = $FALSE$appConfig = [xml](cat .$config)$appConfig.configuration.appSettings.add | foreach {if ($_.key -eq Port) {$port = $_.value$found = $TRUE}}if (-not $found) {$port = "8080“}$($port)}
    • AUTOMATING YOUR PROCESS14.06.2013 / 65
    • Automating your process• Create environments and projects• Add all the automated build steps you can• Add manual steps for the rest• Automate manual steps one by one• You can have more than one tentacle on a server– Not as a service14.06.2013 / 66
    • CONNECTING THE ISSUE TRACKER14.06.2013 / 67
    • Connecting the issue tracker• Connect TeacmCity throught Settings – Issue Tracker• Connect your issue tracker to TeamCity• Use the Issue tracker’s web api to get issues pending user acceptance– Add them to releasenotes while deploying14.06.2013 / 68
    • Kristoffer Rolf DeinoffLead Technologist@gatepoetkristoffer.deinoff@itera.no