Automating the builddeploy process for Web applications managed with UCM.docx
- 文档编号:13612707
- 上传时间:2023-06-15
- 格式:DOCX
- 页数:7
- 大小:19.56KB
Automating the builddeploy process for Web applications managed with UCM.docx
《Automating the builddeploy process for Web applications managed with UCM.docx》由会员分享,可在线阅读,更多相关《Automating the builddeploy process for Web applications managed with UCM.docx(7页珍藏版)》请在冰点文库上搜索。
AutomatingthebuilddeployprocessforWebapplicationsmanagedwithUCM
Automatingthebuild/deployprocessforWebapplicationsmanagedwithUCM
fromTheRationalEdge:
LearnhowtoautomateaUCM-drivenbuild/deployprocessforWebapplicationsfortheWebSphereplatformusingarelativelysimpleutilitybasedontheApacheAntJava-basedbuildtool.
SoftwareengineersoftenfindthedeploymentofWebapplicationstobetime-consuminganderror-prone.Normally,engineersneedtomakeadeployablepackageofWebapplicationsandthendeployitononeapplicationservermanually.ThisisoftenthecaseinstructureddevelopmentenvironmentsliketheoneIworkinattheIBMChinaGlobalizationLaboratory.Wemanagethesoftwareconfigurationsforourproduct,calledtheTranslationCommunicationTool(TCL),withaunifiedchangemanagement(UCM)infrastructurethatutilizesbothIBMRationalClearCaseandIBMRationalClearQuest.WedeployeachnewversionofthisWeb-basedapplicationtoanIBMWebSphereApplicationServer(WAS).
WhileUCMhasmanyimportantbenefits,suchasversionmanagementanddefectmanagement,wehavefoundWebapplicationdeploymentstobeinefficient.Lackingasingle,uniformmechanismondeploymentmanagementwithintheUCMinfrastructure,ourapplicationintegratorshavehadtomanuallyextractsourcecode(e.g.,JavaandJSPfiles)andcontentresources(e.g.,CSSandimagefiles),thenmanuallybuildadeployablepackageusingtheWASdeploymenttool,andfinallydeploytheapplicationmanuallytotheWebSphereplatform.AlthoughtheUCMinfrastructureprovidesrevocableAPIstoenablethedeploymentautomation,thoseAPIsareverydifficulttounderstandatabasiclevel.
Inthisarticle,IdescribeawaytoautomatethisUCM-drivenbuild/deployprocessusingarelativelysimpleutilitybasedontheApacheAntJava-basedbuildtool.Thankstothisutility,wecannowdeploybuildstotheWebSphereplatform,manageautomatedtestingruns,andevenreportfailuresandbacktracktothelaststablerelease,allwithone-clickease.
Needed:
Morefrequentreleases,moreautomateddeployment
Manualdeploymentdoesmorethanjustintroduceerrorsandtakeextratimefortheteammember(s)whocreateanddeployeachbuild.Italsoaltersthebuild/deploylifecycleinwaysthatreduceoverallteamefficiency.
BecausemanualdeploymentofWebapplicationsistime-consuming,developersendup"batching"releasessothatfewerdeploymentsarerequired.Wegraduallyaccumulateabatchofcodefixesornewfeaturesoverthecourseofseveralweeksormoreandthendeploythemallatonce.Duringthattime,sometestersareidle,waitingfordeveloperstogetabatchofworkablecodechangesorfixesdone.Thisisnotthemostefficientuseofskilledresources.
Whentheteamismakingenhancements,fixingdefects,andtestingnewcodecontinuously,it'sadvantageoustoreleasenewversionsmorefrequently.Morefrequentreleaseswithfewerchangesmeanthatlesstimeisrequiredperbuildforregressiontesting,usersgetthebenefitofnewfeaturessooner,andthedevelopmentteamgetsthebenefitofmorefrequent,granular,andfasterfeedbackonitswork.
Afurtherbenefitofmorefrequentreleasesislessdowntimefortesters.Wefinditisnotfeasibletotestallthefeaturesofourproductautomatically.Instead,weperformautomatedtestingonlyonkey"black-box"components(usingJUnit)andlesstimerunningfunctiontestsuites(HttpUnit).Developersalsoperformautomatedunittestingbeforewepackageanddeployanewrelease.However,inordertoadequatelytestimportantfunctionality,mosttestingisunavoidablymanualandisperformedbyQAengineersonthestagingserver.(Sometestingisalsoconductedby"real"usersontheproductionserver.)Morefrequent,moreefficientdeploymentsthereforemeanthattesterscankeeptestingonamorecontinuousbasis.
Anautomatedsolution
Tosolvethesestubbornproblems,ourteamcreatedanautomaticbuild/deploymentutilityforourTCTproduct,whichhasimprovedouroverallproductivityandefficiencybyenablingustoreleasenewbuildsmorefrequently,inlesstime,andwithfewererrors.
Withthehelpofthisutility,wecannowdeployWebapplicationsautomaticallyontoourIBMWebSphereproductionserver,aswellastoourstagingserverorotherplatforms,withliterallyone-clickease.Ifanautomatictestingrunreturnsorfailsonastagingserver,thisutilitycanreportittodevelopersbye-mailandnotifytheapplicationintegratortorollbacktothelaststablereleaseonthestagingserver.
Wecanevenselectwhichcomponentsoftheapplicationwewanttodeployorspecifywhichpriorreleasewewanttorollbackto,andonwhichdeploymentsites.Inthesimplestcase,wesimplyconfiguredefaultsettings(suchasincludingallcomponents)andrunthebuildanddeploymentscriptautomaticallyandperiodicallyusingacronscript(Linux/AIX),asdescribedbelow.
Howtheautomationworks
Normally,wesetupthebuild/deployscripttoberunautomaticallyeachnighttoavoidputtingstressonthenetworkduringpeakhoursandatthesametimeincreasethecollaborationefficiencyofthewholeteam.Thisisespeciallyhelpfulforagloballydistributedteamacrossdifferentgeographicalareas.Forexample,adevelopmentteaminChinafinishesthecodinginthedaytime,andastheyleavefortheday,thechangecanbebuiltanddeployedonthestagingserverautomatically.Manytimezonesaway,ateaminGermanyperformsthetestingandproducesresultsforthenextday'scodechangeandfix.(Bycontrast,manualbuildanddeploymentmakesitdifficultfordevelopmentteamstobuildanddeployeverynight.Asaresult,thetestingteamoftenneedstowaitseveraldaystogetcodechangesandfixresults.)
Thefollowingsectionsexplainstep-by-stephowtheautomationworks,inmanycasesshowingthecodeinvolved.
Step1:
Initializingenvironmentvariables
First,weneedtoinitializeglobalenvironmentvariablesforbuild/deployautomationofaWebapplication.Forexample,weneedtoreadthe{web.dir},{src.dir},{lib.dir},{build.classes},etc.,variablesfromapropertyfileandmakesuretheseglobalvariablesareavailablewithinthewholeprocessofbuild/deployautomation.Also,wemustreadsomevariablesforspecifictasks,suchas{upload.path}and{deploy.server.name},fortheuploadanddeploytasks.
Hereisthecodetoaccomplishthis:
Step2:
UpdatingandsynchronizingcodefromClearCase
IBMRationalUCMcapabilitiesintegrateaproject'sactivitieswiththesoftwareartifactsbeingchangedthroughawell-defined,repeatableprocess.UCMhelpsdeveloperstrackthechangesmadetoartifactstofulfillachangerequest,becauseIBMRationalClearCasemanagestheartifactsthatchangewitheachnewversion.
ThefollowingscriptsynchronizesthelatestcodefromtheintegrationviewofClearCasewiththecopytaskintheApacheAnttool.
Step3:
CompilingallJavaclasses
Normally,foraWebapplication,allJavasourcesshouldbecompiledandputintothedirectory{build.class},which,bydefault,isWEB-INF/classes.Inthisbuildprocess,weuseJavaccommandinSun'sJDKtocompileallJavaclasses.
Step4:
E-mailingbuildresults
Auto-generatede-mailisoftenagoodwaytofacilitatecommunicationfromautomatedprocesses.Ourautomationsendsbuildresultstodevelopersandprojectmanagersviae-mailtoletthemknowthateachbuildcompletedsuccessfullyorhasfailed.Byincludingthebuildfailures,developerscaninvestigateandidentifyfaultsthatstemfromtheircode.
Step5:
Generatingbaselines
Thebaselineisveryimportantforusintheversionmanagementofourproducts.Thebestwaywe'vefoundtoautomaticallygeneratebuildbaselinesistouseApacheAnttoautomaticallygenerateandincrementthebuildversionnumber.Antdoesthisbycreatingandupdatingtheentriesinafilenamed tct_build_info.properties.
Thefollowingarethename-valuedetailsinthispropertyfile:
Oneofthemostimportantattributesofabaselineisitsquality.Developerscangenerateasmanybaselinesastheywant,buttheyshoulduseonlythe good baselinesforfurtherdevelopment."Good"heremeansabaselineforwhichthecodehasbeenfullycompiledandthatasetofunittestshasbeenrunsuccessfully.
Beforeunittestingisfinished,developerscanspecifya promotionlevel forthebuild,withREJECTEDobviouslybeingoneofthechoices.Oncetheunittestsuitehasfinishedsuccessfully,thebuildisupgradedtoBUILD,indicatingthatwenowhaveagoodbaselinethatcanserveasthebasisforfuturedevelopment.Figure1illustratesthisinternalproductbuildprocess.
Normally,weneedtoinvokethe ClearTool commanddirectlytofinishtaskssuchascheckout,update,checkin,create_baseline,etc.However,thesecommandsareveryhardtointegratewithautomaticbuild/deploytools.Fortunately,Antprovidesthird-partytasksthatmakeiteasytointegrateUCMconceptsintoourAnt-basedbuild/deployautomationutility.Figure1illustratesoneinternalbuildprocessinwhichAnttasks--CCCheckOut,CCCheckIn,CCMkbl,allmarkedinred--areused.
Figure1:
Internalbuildprocess. ApacheAntprovidesthird-partytasksthatmakeiteasytointegrateUCMconceptsintoourAnt-basedbuild/deployautomationutility.Figure1illustratesoneinternalbuildprocessinwhichAnttasks--CCCheckOut,CCCheckIn,CCMkbl,allmarkedinred--areused.
Step6:
Packagingfordifferentplatforms
Onmostprojects,thevariousdeploymentplatforms,suchasastagingsiteversusaproductionsite,requiredifferentdeploymentvariablestobespecifiedintheWebapplication'spropertyfiles.Forexample,whendeployingtoaproductionsite,thebuildmightneedtoinclude
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Automating the builddeploy process for Web applications managed with UCM
链接地址:https://www.bingdoc.com/p-13612707.html