Hudson配置说明.docx
《Hudson配置说明.docx》由会员分享,可在线阅读,更多相关《Hudson配置说明.docx(14页珍藏版)》请在冰豆网上搜索。
![Hudson配置说明.docx](https://file1.bdocx.com/fileroot1/2022-11/25/5b5ab28a-3ed9-4c32-a0d3-053877ddfede/5b5ab28a-3ed9-4c32-a0d3-053877ddfede1.gif)
Hudson配置说明
Hudson配置项说明
Description
Thisdescriptionisplacedontheprojecttoppagesothatvisitorscanknowwhatthisjobisabout.YoucanuseanyHTMLtagshere.
DiscardOldBuilds
ThiscontrolsthediskconsumptionofHudsonbymanaginghowlongyou'dliketokeeprecordsofthebuilds(suchasconsoleoutput,buildartifacts,andsoon.)Hudsonofferstwocriteria:
Drivenbyage.YoucanhaveHudsondeletearecordifitreachesacertainage(forexample,7daysold.)
Drivenbynumber.YoucanhaveHudsonmakesurethatitonlymaintainsuptoNbuildrecords.Ifanewbuildisstarted,theoldestrecordwillbesimplyremoved.
Hudsonalsoallowsyoutomarkanindividualbuildas'Keepthislogforever',toexcludecertainimportantbuildsfrombeingdiscardedautomatically.
Thisbuildisparameterized
WhenyouareusingHudsonforvariousautomations,it'ssometimesconvenienttobeableto"parameterize"abuild,byrequiringasetofuserinputstobemadeavailabletothebuildprocess.Forexample,youmightbesettingupanon-demandtestjob,wheretheusercansubmitazipfileofthebinariestobetested.
Thissectionconfigureswhatparametersyourbuildtakes.Parametersaredistinguishedbytheirnames,andsoyoucanhavemultipleparametersprovidedthattheyhavedifferentnames.
SeetheWikitopicformorediscussionsaboutthisfeature.
StringParameter
Definesasimpletextparameter,whereuserscanenterastringvalue,whichyoucanuseduringabuild,eitherasanenvironmentvariable,orthroughvariablesubstitutioninsomeotherpartsoftheconfiguration.
Notethatwhenthisfieldisexposedasanenvironmentvariable,itwillbealwaysintheuppercase(e.g.,theparameter"foo"wouldbeexposedas"FOO").InAntforexampleyouaccessitbytypingin${env.FOO}
DefaultValue
Specifiesthedefaultvalueofthefield,whichallowstheusertosavetypingtheactualvalue.
FileParameter
Acceptsafilesubmissionfromabrowserasabuildparameter.Theuploadedfilewillbeplacedatthespecifiedlocationintheworkspace,whichyourbuildcanthenaccessanduse.
Thisisusefulformanysituations,suchas:
1.Lettingpeopleruntestsontheartifactstheybuilt.
2.Automatingtheupload/release/deploymentprocessbyallowingtheusertoplacethefile.
3.Performdataprocessingbyuploadingadataset.
Filelocation
Specifiesthelocation,relativeintheworkspace,wheretheuploadedfilewillbeplaced(forexample,like"jaxb-ri/data.zip")
DisableBuild(Nonewbuildswillbeexecuteduntiltheprojectisre-enabled.)
Sometimes,you'dwanttotemporarilystopbuildingaproject.Forexample,maybeyouareinthemiddleofalargemigrationandyouknownewbuildsaregoingtofail.OrmaybeaprojectisbuilteveryhourbutyouknowthattheCVSserverwillbedownforthenext24hours.
Whenthisoptionisset,nonewbuildisperformedonthisproject.Thisallowsyoutodisablenewbuildswithoutchanginganyofthebuilddependencychainorchangingthenotificationsetup.
Tiethisprojecttoanode
Sometimesaprojectcanonlybesuccessfullybuiltonaparticularslave(ormaster).Ifso,thisoptionforcesHudsontoalwaysbuildthisprojectonaspecificcomputer.Otherwise,unchecktheboxsothatHudsoncanschedulebuildsonavailablenodes,whichresultsinfasterturn-aroundtime.
Thisoptionisalsousefulwhenyou'dliketomakesurethataprojectcanbebuiltonaparticularnode
AdvancedProjectOptions
Quietperiod
Ifset,anewlyscheduledbuildwaitsforthismanysecondsbeforeactuallybeingbuilt.Thisisusefulfor:
●CollapsingmultipleCVSchangenotificatione-mailsintoone(someCVSchangeloge-mailgenerationscriptsgeneratemultiplee-mailsinquicksuccessionwhenacommitspansacrossdirectories).
●Ifyourcodingstyleissuchthatyoucommitonelogicalchangeinafewcvs/svnoperations,thensettingalongerquietperiodwouldpreventHudsonfrombuildingitprematurely过早地andreportingafailure.
●Throttling分流builds.IfyourHudsoninstallationistoobusywithtoomanybuilds,settingalongerquietperiodcanreducethenumberofbuilds.
Ifnotexplicitlysetatproject-level,thesystem-widedefaultvalueisused.
Usecustomworkspace
ForeachjobonHudson,Hudsonallocatesaunique"workspacedirectory."Thisisthedirectorywherethecodeischeckedoutandbuildshappen.NormallyyoushouldletHudsonallocateandcleanupworkspacedirectories,butinseveralsituationsthisisproblematic,andinsuchcase,thisoptionletsyouspecifytheworkspacelocationmanually.
Oncesuchsituationiswherepathsarehard-codedandthecodeneedstobebuiltonaspecificlocation.(andyoucanfindonesuchdiscussionhere.)Whilethere'snodoubtthatsuchabuildisnotideal,thisoptionallowsyoutogetgoinginsuchasituation.
Anothersituationwherethisisusefuliswhenyouareusingthefree-styleprojecttypenottoperformasoftwarebuild,butexecutionofacertainbatchtask,perhapsasacron克隆replacement.Insuchcase,youcanusethisoptiontomaptherelevantdirectoryastheworkspace,sothatpeoplecanlookatfilesthroughtheHudsonwebUI,andyoucankickrelevantcommandsmoreeasily.
Ifyouareinadistributedbuildenvironment,unlessyoutieajobtoaspecificnode,Hudsonmaystillmovearound走来走去jobstodifferentslaves.Sometimesthisisdesirable,sometimesthisisnot.Also,youcanmapmultipleprojectstohavethesameworkspace,butifyoudoso,makesureconcurrentexecutionsofthosejobswon'thavenasty令人讨厌的interferancewitheachother.
SourceCodeManagement
CVSROOT
TheCVSconnectionstringHudsonusestoconnecttotheserver.Theformatisthesameas$CVSROOTenvironmentvariable(:
protocol:
user@host:
path)
Module(s)
TheCVSmodulename(s)inthegivenCVSROOTtocheckout.Multiplemodulescanbespecifiedbyseparatingthembyawhitespace.Ifyourmodulenamecontainswhitespace,youcanescapebywritingitas'\'.Forexample"foo\barzot"willspecifytwomodules"foobar"and"zot".
Branch
Thisisatag,notabranch
Ifset,HudsonwillrunCVSwith-rtobuildaparticularbranch.Ifleftempty,Hudsonwillbuildthetrunk.
Normally,Hudsonrunscvscheck-outandupdatewiththe-Ddateoptiontomakesureitgetsacoherentsnapshotoftherepositoryandbetterbuildreproducibility重复能力,butthisinterferes妨碍ifthebranchnamespecifiedhereisactuallyatagname.TellingHudsonthatthenameisatagwouldfixthisproblem.
高级选项
CVS_RSH
Ifset,HudsonwillrunCVSwiththeCVS_RSHenvironmentvariablesettothisvalue.Ifthisvalueisnotset,andthewebcontainerthatHudsonrunsinhasCVS_RSHsetinitsenvironmentvariable,thenCVSwillinherit继承it.
Legacy遗留问题mode(runCVSinawaycompatiblewitholderversionsofHudson<1.21)
Hudson1.20andearlierusedtocreateredundant多余的directoriesinsidetheworkspace.Forexample,iftheCVSmodulenameis"foo/bar",itfirstcreated"foo/bar"andthenputeverythingbelow.Withthisoptioncheckedoff,therewillbenomoresuchunnecessaryintermediatedirectories.
Thisaffectsotherpathspecifiers,suchasartifactarchivers---younowspecify"build/foo.jar"insteadof"foo/build/foo.jar".
Useupdate
Ifchecked,Hudsonwilluse'cvsupdate'wheneverpossibleforbuilds.Thismakesabuildfaster.Butthisalsocausestheartifactsfromthepreviousbuildtoremaininthefilesystemwhenanewbuildstarts,makingitnotatruecleanbuild.
BuildTriggers
Buildafterotherprojectsarebuilt
Setupatriggersothatwhensomeotherprojectsfinishbuilding,anewbuildisscheduledforthisproject.Thisisconvenientforrunninganextensivetestafterabuildiscomplete,forexample.
Thisconfigurationistheoppositeviewofthe"Buildotherprojects"sectioninthe"Post-buildActions".Updatingonewillchangetheotherautomatically.
PollSCM
ConfigureHudsontopollchangesinSCM.
NotethatthisisgoingtobeanexpensiveoperationforCVS,aseverypollingrequiresHudsontoscantheentireworkspaceandverifyitwiththeserver.Considersettingupa"push"triggertoavoidthisoverhead,asdescribedinthisdocument
Buildperiodically
Providesacron-likefeaturetoperiodicallyexecutethisproject.
ThisfeatureisprimarilyforusingHudsonasacronreplacement,anditisnotidealforcontinuouslybuildingsoftwareprojects.Whenpeoplefirststartcontinuousintegration,theyareoftensousedtotheideaofregularlyscheduledbuildslikenightly/weeklythattheyusethisfeature.However,thepointofcontinuousintegrationistostartabuildassoonasachangeismade,toprovideaquickfeedbacktothechange.TodothatyouneedtohookupSCMchangenotificationtoHudson..
So,beforeusingthisfeature,stopandaskyourselfifthisisreallywhatyouwant.
Build
Executeshell
Runsashellscript(defaultstosh,butthisisconfigurable)forbuildingtheproject.Thescriptwillberunwiththeworkspaceasthecurrentdirectory.Typeinthecontentsofyourshellscript.Ifyourshellscripthasnoheaderlinelike#!
/bin/sh—,thentheshellconfiguredsystem-widewillbeused,butyoucanalsousetheheaderlinetowritescriptinanotherlanguage(like#!
/bin/perl)orcontroltheoptionsthatshelluses.
Bydefault,theshellwillbeinvokedwiththe"-ex"option.Soallofthecommandsareprintedbeforebeingexecuted,andthebuildisconsideredafailureifanyofthecommandsexitswithanon-zeroexitcode.Again,addthe#!
/bin/...linetochangethisbehavior.
Asabestpractice,trynottoputalongshellscriptinhere.Instead,considerad