Message Image  

Best practices: Branching projects

 View Only

Best practices: Branching projects 

Fri July 08, 2016 04:21 PM

◆ Applies to: TBM Studio 12.1 and later

 

Branching is an advanced feature added to the platform for Apptio TBM Studio v.12.1. Branching is a core feature found in most modern version control systems. Branching allows users to create a copy of a complete project, make changes on the project copy in parallel, and then promote to production those changes with the original project. Branching is an extremely powerful addition to the TBM Studio experience, and it is important to understand its intended uses.

Branches and workspaces

A workspace is a user-specific environment where changes to checked-out documents live until they are checked back in. When you check out a document in a workspace, you have an exclusive lock on that document—no one can check out that document until it is checked in.

 

A branch is a complete copy of the current project at the time when the branch was created. When you check out a document from a branch, that document goes into a workspace on that branch. Changes made to documents in branch workspaces appear on the branch only after those documents are checked in. To see the changes on the trunk, the branch must be merged back into the mainline project.

 

Why would you use branching?

Branches are intended to support one of two key use cases:

  • Long-running configuration: There is a set of changes to be made that will take a long time before they are ready to be promoted to Production. Meanwhile, changes, such as monthly data loads, need to be made and pushed to Production. You can create a branch and make the changes to the branch while your operational data loads continue on the trunk.
  • Hotfix prod: There is a problem with something in Production, but development has taken place that is not ready to promote to Production. You can create a branch, fix the specific issue, and then merge the branch into Production.
  • Audit prior state or archived state: There is a business need to look at a past state of a project. For example, a prior fiscal year might be closed and changes are made to the model, but you need to look at numbers from that past state. Using branches, you can look at the exact state of the system at a previous point in time.

 

Branch concepts:

  • Each branch is a complete copy of the trunk project. This has performance implications as discussed in the following Best practices and performance considerations section.
  • The number of branches for an environment is limited to five (5).
  • To open and close branches, you must be assigned to a role that has the Create and close branches permission.
  • Closing a branch removes the branch project along with any build projects, workspaces, and so on. A branch cannot be closed if it has a build used in Production. Once a Staging build from the trunk is promoted to Production, the branch may be closed.
    TIP: See also Troubleshoot a branched project that cannot be closed.
  • When you merge changes to a branch, you can:
    • Select the documents that you want to merge.
    • See a list of conflicts, if any exist (a conflict occurs when changes are made to the same document in two different branches).
  • You cannot merge a document if it is checked out by another user working in trunk.
  • All documents in a branch must be checked in before you can merge the branch.
  • Tags exist for all builds, and custom tags can be created to identify specific builds.
  • For hotfix branches, when the branch is promoted to production, it overrides the trunk branch.

Best practices and performance considerations

Branches use the same amount of resources (for example, memory, CPU, and so on) as the project from which they are branched. Therefore, when you create a branch, you are adding a load to your Apptio environment equal to the load of any activity you might engage in with your main project.

TIP: When creating a branch, consider the impact on both stage calculations and workspace load. For more information on branch impacts to workspace performance, see Managing performance in your development environment.

Additionally, except for hotfix branches, calculations for branches will be queued with calculations for the project from which they are branched. If you create a branch from a version of the project that took three hours to calculate, then the moment the branch is created, dev and stage calculations will start. If someone checks in a change on the trunk after you have branched, then the resulting dev and stage calculations for the trunk will be queued behind your branch calculation.

 

The following image shows the AdminDB project view of the calculations for all the projects branch calculations. Note the two sets of branch calculations in yellow and orange, and the trunk calculation for the project on which those branches are based in green:

 

TBMAs wanting to navigate to this view should navigate to Frontdoor, select the TBM Studio tile, and then open the Calculation Queue.

Create a branch based on the most recent completed build

When in the Stage environment, create a branch using the Create branch command on the Project tab, Manage group.

When in the Development environment, you can use the Create branch command only if you have nothing checked out. This restriction is by design. The implication is that you may wish the changes in your workspace to be a part of the branch, but they will not be until all materials are checked in and calculated.

Apply a custom tag to a build

While all builds have default tags, as indicated in the How to create a branch from a past build that did not have a custom tag applied section, after you have locked stage, the Tag Project button becomes available.

 

Click Tag Project to apply a custom tag to a build, which can help to make finding a build much easier.

This tag will appear on the Builds page so that you can search for it easily and use it for branching.

 

NOTE: At the time of this writing, the Tag Project button will not be available after you promote a build.

Create a branch from a tag

To branch from a tag:

  1. Find the tag in the Check In History.
  2. Right-click the tag, and then select Create branch from this point.

Create a branch from a past build that did not have a custom tag applied

Sometimes, it may be useful to create a branch from a prior build that was not tagged (for example, if you discover that something has changed and you need to figure out when that change was introduced).

 

To create a branch from a prior, untagged build:

  1. Select the Home tab, then click View to see the drop-down menu.
  2. In the Check In History, select Verbose View:
  3. When you are in Verbose View, you can see all the default build tags:
  4. Right-click on the build tag and select Create branch from this point.

Navigate between branches and the trunk

When a branch for a project exists, you can navigate to the branch, or back to the trunk, using the drop-down menu on the menu bar:

Use a branch

  • Limit branch check ins to ~30 documents - When working in a branch, the current recommended best practice is to limit check ins to approximately thirty (30) documents.
    Example: You have 100 documents checked out on the branch. Check in approximately thirty documents, then check in another thirty documents, and so forth. This action provides a limit to the individual check in sizes. This practice is recommended to address a limitation when merging the check ins to the trunk.
  • Make changes - After a branch has been created, changes are made in the same way they are made to the trunk. Documents can be checked out, modified, and checked back in to the branch.
  • Branches and workspaces - Your workspace on the trunk is separate from your workspace on branches. If you check out a document on a branch, and then navigate to the trunk, you will not see the document checked out there because it is a separate workspace.
  • Check out considerations - It is possible to have the same document checked out on both the branch and the trunk at the same time. The implication is that one person could be working on the document and commit changes on the trunk that are not in the branch.

Merge a branch back into the trunk

Before you merge, there are some prerequisites:

  • None of the documents to be merged can be checked out in the trunk.
  • The user executing the merge cannot have any document checked out in the trunk.
  • Do not merge from the trunk to branches, or between branches.

 

While the UI supports merging between branches and from the trunk to branches, there are limitations which make this action outside of best practices currently.

Execute the merge

After changes have been checked in on a branch, the check ins as viewed in the Check In History can be selected to merge into the trunk:

  1. Select one or more check ins in the Check In History by using Ctrl+click or Shift+click.
  2. Right-click on the selected records and select Merge changes to branch. At this time, it is recommended to merge branch changes to the trunk.

Resolve conflicts

When you execute a merge, a merge dialog that indicates conflicts might appear:

Conflicts occur when the trunk has a document version that has been modified since the time the branch was created. Therefore, if you were to merge the document and check it in, then the branch document would overwrite the trunk document.

 

To resolve these conflicts, you must either manually integrate the changes present in the copy of the document in the trunk into the copy of the document in the branch, or you must be willing to let the changes be overwritten.

Check in after the merge

After you merge the changes, they will be checked out on the trunk. You must check them in on the trunk before the merge operation is complete. Also, note that there is a document with the name of the branch itself, which must also be checked in.

Close the branch

After you finish merging your changed documents to the trunk, close the branch. Closing the branch conserves resources.

Use a branch to hotfix prod

Occasionally, a change may be needed in prod quickly and changes in stage may not be ready for deployment. In this scenario, a hotfix may be appropriate.

 

To apply a hotfix to a document in prod, follow these steps:

  1. Navigate to the document in prod.
  2. Check out the document. When the dialog appears, you can select either Development or Hotfix:
  3. Select Hotfix.
    The system will generate a branch called Hotfix, where you can make your change:
  4. Wait until the hotfix branch calculates in stage. The system will calculate hotfix branches in parallel with other calculations, so normal build queuing does not apply.
  5. Click Lock to lock the hotfix branch in stage.
  6. Click Promote Now to promote the hotfix branch to production:

     

     

    If you were to attempt to close the hotfix branch at this point, you would receive an error:

    This is because the build in prod isn't based on the hotfix build, and therefore, the system will not allow the hotfix branch to be closed.

     

    To close out the hotfix process:

    1. Merge the changes into the trunk. See the Merge a branch back into the trunk section above for details.
    2. Promote the build with the hotfix changes to prod.
    3. Close the hotfix branch.

 

TIP: See also Troubleshoot a branched project that cannot be closed.

Archive time periods and access archives

Periodically, it is useful to archive past time periods. For example, when you want to turn off calculation for one or more past fiscal years to reduce calculation time.

To archive time periods:

  1. Before changing the time settings, apply a custom tag. Use a naming convention for the tag, such as adding a prefix to the tag name with the word "Archive" so that it is easy to find all builds that correspond to archived events.
  2. Adjust the time settings to make the project start date what you want it to be, and then check it in. This will close the old time periods.

 

If you want to access the archived time periods, search for the archive tags and generate a branch from the archive tag.

Branching FAQ

Why is Create Branch not available? - If the Create Branch button is not available, or if it doesn't appear in the context menu when you are right-clicking a build tag, you might have exceeded the number of branches allowed for your environment. The branch limit is five branches for the environment (inclusive of all projects).

Why can't I close a branched project? - If you click Close Branch on the Project tab and a warning message appears stating that the branched project cannot be closed, see Troubleshoot a branched project that cannot be closed.

         
Next Topic:Restore projects
You are here
Table of Contents > Studio project administration > Configure projects > Best practices: Branching projects





#CostingStandard(CT-Foundation)
#TBMStudio
#Costing
#configuration
#ApptioBI

Statistics
0 Favorited
17 Views
0 Files
0 Shares
0 Downloads

Comments

Wed May 27, 2020 07:58 AM

Hi,

Great article.  Have a question regarding monthly Datalink files in the Trunk.  We have a branch that was created in March to fix a Role Level Security issue.  The branch is still open and we're still making changes to it.  In the meantime, we have monthly Datalink tables being added to the trunk.  Is there a way of transferring over these tables to the branch without overwriting new configuration?  The new data tables are needed in the branch to finish configuration.

 

Any assistance is greatly appreciated!


#CostingStandard(CT-Foundation)

Thu January 02, 2020 04:38 PM

Tag process is very helpful.


#CostingStandard(CT-Foundation)

Thu December 19, 2019 01:29 PM

This is a great article! Thank you!


#CostingStandard(CT-Foundation)

Thu October 10, 2019 11:31 PM

Great article.  Just started to exposure to branches and its capabilities via our Managed Services Technical Consultant


#CostingStandard(CT-Foundation)

Thu July 25, 2019 09:59 AM

Taking your example of 5 check-ins, and you wish to just merge #2 and #5 you should be able to hold the Ctrl key down while clicking #2 and #5, then right click for the context menu and select merge.  That should result in only #2 and #5 being merged. 


#CostingStandard(CT-Foundation)

Thu July 25, 2019 02:46 AM

I have created an Additional Exercise for Backpack Courses to practice branching in the RTBMA certification process.

 

Branching Function - Additional Exercise for Backpack Courses


#CostingStandard(CT-Foundation)

Wed July 24, 2019 09:53 PM

Hi,

 

I have a question unclear given the above engaging document. If we create a Branch & then have for instance 5 check-ins. Is it possible to just select check in's #2 & #5 while ignoring check in's #1,#3 & #4 while merging to trunk?

 

Is it also possible to not select the last state (check-in#5) while merging?

 

The excerpt below does allude to the above but the example sequentially selects both the check-ins.

@Dan Kelly, You were recommended by @Rachel Hagensen - so if you can shed some light on this, I would be obliged!

I don't have a sandbox at the moment configured - & would be working directly on the Client Instance so cannot test it out in dev as its a "shared dev" space at the moment.

Execute the merge

After changes have been checked in on a branch, the check-ins as viewed in the Check-In History can be selected to merge into the trunk:

  1. Select one or more check-ins in the Check-In History by using Ctrl+click or Shift+click.
  2. Right-click on the selected records and select "Merge changes to branch". At this time, it is recommended to merge branch changes to the trunk.


#CostingStandard(CT-Foundation)

Tue June 04, 2019 08:43 AM

A very helpful article, I would be keen to see best practice descriptions for using branches to install new components. Having recently used a branch to install and configure Vendor insights (foundation and PO) after I merged back to trunk and promoted I was left with a number of orphaned and duplicate instances of the VI application accessible from Top left navigation. 

Additionally during the config the new branch (non prod) instances became visible to production users, although they just lead to an error screen if clicked. This was removed (hidden) by editing the Application access for those roles and re-added when the merged trunk was promoted to production. Note Support are looking to replicate this behavior.

@Apptio UserAssistance


#CostingStandard(CT-Foundation)

Tue May 07, 2019 02:12 PM

@Sheila Masterson, @Vicki Reed, @Brian Brookshire

Is it true that a 'branch' cannot be a 'derived' project (used in R11) and is truly a snapshot in time?

 

This is a very good article regarding using Branches and how to manage in R12. 

 

Thanks @Apptio UserAssistance team!


#CostingStandard(CT-Foundation)

Mon April 01, 2019 05:54 PM

They would need access to tbm studio to view the branch


#CostingStandard(CT-Foundation)

Mon January 14, 2019 08:48 AM

Hi,

Not sure if it's clear in this great article, but note that when you create a branch, the branch will be a copy of the environment you are currently in (i.e. Production, Stage or Development). Meaning if you are in Production and create a branch, the branch will be based on the build for the Production environment.

So if your looking at doing configuration in a branch make sure that the branch is a copy of the latest build which most likely would be Stage 

 

Also the Build number is visible in the first check-in entry in "Check In history".


#CostingStandard(CT-Foundation)

Wed December 19, 2018 07:16 AM

Is there any way of giving users without access to the TBM studio the possibility to access branches aside from Trunk? 


#CostingStandard(CT-Foundation)

Thu October 11, 2018 08:54 AM

Great article. Must read for everyone who is working with Branches. 


#CostingStandard(CT-Foundation)

Thu May 31, 2018 09:44 PM

UNCLASSIFIED

Thanks very much Jaitabh. I will read it through and come back with any questions I may have.

 

Regards,

Vasanthi


#CostingStandard(CT-Foundation)

Thu May 31, 2018 09:37 PM

@Vasanthi Viswanathan ... here's an excellent article on Branching. Creating a Branch is a useful way to try new config (... such as for 'Bundled Service' config you are exploring), without changing anything on the main project (which we refer to as Trunk).  A branch can be subsequently merged with its Trunk or dropped altogether.


#CostingStandard(CT-Foundation)

Thu March 29, 2018 06:31 AM

Very excellent document on Branching and extremely useful.

@Babu Hussainsab Mehrunnesa @Pablo Santana


#CostingStandard(CT-Foundation)

Mon March 26, 2018 06:17 AM

@Phaneendra Sristi, for information.


#CostingStandard(CT-Foundation)

Tue March 13, 2018 06:36 AM

@Lia Scheffers and @Sandor Welfing this is a useful article to be able to facilitate the requirement of comparing periods.


#CostingStandard(CT-Foundation)