Automated Deployment Framework

conversebazaarΛογισμικό & κατασκευή λογ/κού

2 Νοε 2013 (πριν από 3 χρόνια και 11 μήνες)

70 εμφανίσεις

Automated Deployment
Framework

Using TFS and Custom PowerShell
cmdlets

to create an automated
deployment framework

Agenda


TFS Build/Deploy


Extending TFS Build/Deploy


Custom PowerShell
Cmdlets


Putting it all Together

TFS Build/Deploy


How it works


Workflow Activities


XAML


Build Definitions


Build Controllers/Agents

TFS Build/Deploy


Default Process


Trigger


Local Workspace/Drop Folder


Build


Test


MSBuild

TFS Build/Deploy


Restrictions


Build Packages


D
eploy
only through
the
msbuild

command


Rebuilds projects/solution every time

Extending TFS Build/Deploy


The Templates


XAML (Silverlight was actually worth something!)


Workflow Activities


Custom Activities and Editors


Build Controller Assemblies


Start with the default template and add/remove
as needed


Test Frequently!

Extending TFS Build/Deploy


PowerShell


Object based


Snapins
/modules for about every MS product


Remote server commands getting rolled into many
cmdlets


Excellent community support

Extending TFS Build/Deploy


PowerShell The
EEEvil

Stuff


Getting rolled into products by
separate

product
teams


Error Handling


Escaping


r
E
trieve

Behavior

Extending TFS Build/Deploy


WebDeploy


Package deployment


SetParameter

Files


Remote Execution of Scripts


Azure and Lab Deployments

Extending TFS Build/Deploy


Setting it up


Update the template to run a PowerShell
script
(copy scripts locally and execute it
)


Setup
a
PowerShell
script to do your deployment
by executing a
WebDeploy

command
line


Setup
your build definitions

Extending TFS Build/Deploy


Drawbacks to the straight PowerShell
approach


Whomever creates/maintains the
deployments
must know the ins and outs of
PowerShell and
each
PowerShell module
you use (
iis
,
adfs
, SQL,
server,
etc
)


With multiple deployments,
you end up with a lot
of duplication between
scripts


Complex deployments result in complex scripts

Custom PowerShell
Cmdlets


Expose .NET code through PowerShell


System.Management.Automation


Inherit from
Cmdlet

and override
BeginProcessing

and
ProcessRecord

methods


P
rovide help/examples through an xml file


Create a
cmdlet

for each type of deployment you
support and for any common deployment tasks



Can pass in parameters, a file path, use a
database,
etc

for deployment info depending on
the complexity of the deployment

Custom PowerShell
Cmdlets


Install the custom
cmdlets

on
each TFS
build
agent (using PowerShell of course)


Update the PowerShell deployment scripts to
call your custom
cmdlets

Resources


Customizing TFS Templates


http://www.ewaldhofman.nl/post/2010/04/20/Customize
-
Team
-
Build
-
2010
-
e28093
-
Part
-
1
-
Introduction.aspx


TFS/ALM


http://www.deliveron.com/blog/author/mikedouglas.aspx


Web Deploy


http://blogs.iis.net/harshmittal/archive/2012/07/26/announcing
-
web
-
deploy
-
3
-
0
-
rtw.aspx


PowerShell


http://technet.microsoft.com/en
-
us/library/bb978526.aspx


Custom PowerShell
Cmdlets


http://blogs.charteris.com/blogs/ivorb/archive/2011/11/01/create
-
a
-
custom
-
powershell
-
cmdlet
-
end
-
to
-
end.aspx


Andy Bayer

Deliveron

Consulting Services

andybayer@deliveron.com