Microsoft's - SCGMIS

Transcription

Microsoft’sTeam Foundation Server(TFS)Canute MagalhaesRichland County (IT)SYSTEMS ANALYST / PROJECT LEAD1

Topics for this Presentation Why Richland County IT - Business Systems Division uses Team Foundation Server (TFS) What is Team Foundation Server Version Control with TFS Automating Builds with TFS Programmatically Interfacing with TFS Demo a triggered build Questions2

Why Richland County IT - Business Systems Division uses TFS- Challenges Possibility of more than one user working on a file simultaneously. Need file / code synchronization, repository, history, authorization, etc. Need developers working as a group, doing building, code trails, System Integrationand Functionality testing. Nice to have an Early Notification of bad checked-In code. Cannot have a Single Point Of Failure, with work-in-process files sitting on localmachine. Need designated teams managing their respective builds without developerinvolvement. Did not have consolidated environment for version control, repository, build processetc. Need to run builds under an authorized account3

Multiple solutions under one UmbrellaTFS We are a Microsoft shop. We have TFS in our MSDN subscription. Multi-User Check-outs File / code synchronization, repository, history, authorization, etc. Developers can doing development builds for System integration and functionalitytesting with version control. ShelveSet lets you save work-in-process files on to the TFS server. Analysts now determine and manage QA builds without developer involvement. Builds are kicked off and pushed to Staging and Production under an authorizedaccount by the concerned groups. One consolidated environment for version control, repository, build process etc. Rununder an authorized account.4

What is Team Foundation Server (TFS)Team Foundation Server is thecollaboration platform at the core ofMicrosoft's Application LifecycleManagement (ALM) solution.Source spx5

Team Foundation Server ReleasesPre - 2013 releaseTeam Foundation Server2013 and forwardTeam Foundation Server / ServiceOn Premises&as aMicrosoft Hosted Service.(http://tfs.visualstudio.com)The Hosted Service is calledVisual Studio Online.6

Team Foundation Server ArchitectureTeam Foundation Server has three logical tiers Client tier Application tier Data tier7

Client TierThe client tier consists of Visual Studio Industry Partners (VSIP) components, MicrosoftOffice integration, command-line interfaces, etc.VSIPs: Applied Materials, App Dev, github, etc.8

Application TierServer-level services (also known as application-level services) provide the functionality foroperations for Team Foundation Server as a software application.The client tier communicates with the application tier through the server object model, anduses the same Web services that are listed for that tier. This is true whether you deploy TFSlocally, or if you use Visual Studio Online.9

Data TierThe data tier includes data, stored procedures, and other associated logic. When you useVisual Studio Online, the data tier is hosted for you using SQL Server Azure. In a localdeployment of TFS, the logical data tier consists of the operational stores within SQL Server. Configuration database (TFS Configuration) Application warehouse (TFS Warehouse) Analysis Services database (TFS Analysis) Databases for team project collections (TFS CollectionName)These stores might be located on one physical server or distributed across many servers.Source: spx10

Major Features Included In Team Foundation ServerVersion ControlBuilds (Automated / Manual )Requirements ManagementProject ManagementWork ItemRelease Management CapabilitiesTestingReporting.Lab management11

Connecting to Team Foundation ServerTeam Foundation Server Administration ConsoleVisual Studio IDETeam Web AccessTeam Explorer Everywhere12

Team Foundation Server Administration Console13

Via Visual Studio14

Team Explorer packaged with Visual Studio15

Team Web Access16

Check-In, Check-Out fromTeam Foundation Serverwithout an IDE ?Team Explorer EverywhereDownload ads#d-team-explorer-everywhere17

According to Microsoft: Your team can collaborate across platforms and improve thepredictability of your development processes by using Team Explorer Everywhere.How to get started with Team Explorer /gg413285.aspx18

Team Foundation Server Administration Console Details19

Team Projects In Collection20

Team Project Collection Security Groups21

Team Project Collection Administration Security (Global)22

Team Project Collection Database Repository23

TFS thru Visual Studio using Team ExplorerConnect to Team Project24

Collections and Projects on TFS25

Adding Team Project To CollectionUsing Visual Studio. Team ExplorerUsing the command line (TFPT.exe)TFPT ct name"/processtemplate:"template name"[/sourcecontrol:New None erbose]26

Version Control with TFSvia (Visual Studio IDE)27

Source Control Explorer28

Workspace29

Configuring workspace30

Buttons on Source Control ExplorerAdd Items to FolderCheck OutCheck InCompare FoldersHistoryNew FolderGet Latest Version (Recursive)31

Hierarchy & Relationship In Version ControlWheneverTFS generates aAaChangeset numberLabeldocumentordocumentsare checked-InWhich uniquelyidentifies the file/sand its/theircontents.is a collection of ChangesetsMore precisely, when a Label iscreated. The changeset number ofthe latest version, of each file in theTFS Project, at the time the label isbeing created, is taken and thatcollection of changesets, becomesthe metadata of that Label.32

Changesets (versions) of a file33

Files in a Changeset34

MergeUser 1Checks OutChecks OutUser 2Doc 1User 1 changes Doc 1andCheck-InWhen user 2 changes Doc 1and tries toCheck-In35

Pending Changes conflicts36

TFS Merge ToolServer VersionTrying to check-InMerged File37

Where do project files reside in TFS38

39

Automating Builds with TFSBuild ControllerBuild AgentBuild DefinitionWorkspaceXAML file (Build process template)40

Build ControllerEach Build Controller is dedicated to a single Team Project Collection.The Build Controller performs lightweight tasks, such as determining the name of thebuild, creating the label in version control, logging notes, and reporting status from thebuild.The Build Controller distribute the processor-intensive work of your build process to itspool of build agents.The Build Controller does not typically require significant processor time, in some casesyou can host it on the same computer as your Team Foundation Server.41

Build AgentEach build agent is dedicated to and controlled by a single build controller.Build agents can be hosted on the same build server that hosts their buildcontrollerThe build agent executes the steps of your build process that are contained in theAgentScope activity. Typically, these steps include getting files from version control,provisioning the workspace, compiling the code, running tests, and merging filesback into version control.AgentScope activity: In the XAML file there is an Activity called "Run on Agent". Youcan add custom created activities to the "Run on Agent" activity.All activities in the "Run on Agent" are in the AgentScope.42

Configuring Build Controller and Agents43

Properties of Build Controller44

Properties of Build Agent45

Recommendation By Microsoft On Setting Up Build AgentsIf you installed Team Foundation Build Service on the sameserver as Team Foundation Server or are using the hosted service, thedefault setting for Number of build agents to run on this build machineis 1 (recommended).Choose Scale out build services to run concurrent builds acrossmultiple machines. If you choose this option, you have to specify thenumber of build agents for this machine and then add them to a new orexisting build controller.If you installed Team Foundation Build Service on its own server,the default setting for Number of build agents to run on this buildmachine is equal to the number of processor cores on this server.Source: 259683(v vs.110).aspx46

Build Server Configuration47

Build Definition48

Creating a new Build Definition49

Build Definition TriggerTypically, for development builds50

Build Definition Workspace51

Build Definition Defaults52

Build Definition Process53

Build Definition Process (Specify Build Agent)54

Build Definition Process (Specify MSBuild Info)55

Build Definition Retention Policy56

Build Definition Retention Policy (Delete policy)57

Build Definition Retention Policy (Delete policy - Options)58

Manual Build Kick-Off59

Kick-Off Build60

61

The XAML (Workflow) file Templates62

Build Process XAML (Workflow)ActivitiesAgentScope activity63

XAML (Workflow) Activity Toolbox64

Create Custom Activity65

Adding Custom Activities to the XAML ToolboxThe DLL containing the custom activities needs to be registered in the GAC, usinggacutil.exe, on the machine that the XAML will be executed.Right click on the Toolbox and click on “Choose Items ”Add the custom activities DLL66

Programmatically Interfacing with TFS67

Web Page used by Analyst to Kick-Off QA Build68

TFS Objects to programmatically connect to TFS and dobuilds, uildServerteamProjectsBuildDetailsNames of the Build DefinitionsYou need the name of the Build Definition toget the Build Definition objectBuild definitionIBuildRequestUse the IQueue object to kick-off the build.IQueuedBuild69

Required Team Foundation referencesImports Microsoft.TeamFoundation.BuildImports Microsoft.TeamFoundation.Build.ClientImports Microsoft.TeamFoundation.ClientImports rts Microsoft.TeamFoundation.Framework.Client70

Code sampleDim tfsProjCollection ection(NewUri("http://Devittfs1:8080/tfs/cama"), New UICredentialsProvider())Dim tfsVersionControlServer tfsProjCollection.GetService(Of VersionControlServer)()Dim tfsBuildServer tfsProjCollection.GetService(Of IBuildServer)()Dim teamProjects m buildDetails tfsBuildServer.QueryBuilds(Project Name)Dim defNames (From a In buildDetailsSelect a.BuildDefinition.Name).DistinctDim buildDef As IBuildDefinition nitionName)Dim buildRequest As IBuildRequest buildDef.CreateBuildRequestbuildRequest.GetOption GetOption.CustombuildRequest.CustomGetVersion "L" & label'L’ indicates to TFS that the text passed is a label.buildRequest.RequestedFor Request.LogonUserIdentity.NameDim queue As IQueuedBuild TFSBuildServer.QueueBuild(buildRequest, QueueOptions.None)queue.WaitForBuildStart()71

Demo a triggered build72

Questions ?73

Thank YouCanute MagalhaesContact: MagalhaesC@rcgov.us74

TFS generates a Changeset number Which uniquely identifies the file/s and its/their contents. A Label is a collection of Changesets created. The changeset number of the latest version, of each file in the TFS Project, at the time the label is being created, is taken and that collection of changesets, becomes the metadata of that Label.