Author: Amit Anan

  • Steps for Migrating Code Between Version Control Tools

    Steps for Migrating Code Between Version Control Tools

    Code migration can be tricky if you’re not prepared. Follow these steps for a worry-free migration.

    Almost all source code contains some format of delicate information, whether it be configuration-related information such as database credentials or information on how the web application functions, such as a web template.

    If such information is disclosed, this information potentially could be used by an attacker to discover logical flaws and escalate into a successive chain of attacks. These include attacks such as SQL injection, database takeovers, cross-site scripting, remote code execution and, sometimes distributed denial of service.

    To achieve solution for conducting a risk-free and systemic migration, we need to plan three stages for the code migration process: pre-migration, migration and post-migration.

    Key Considerations During Pre-Migration

    • License cost
    • Administration cost
    • Developer productivity
    • Security of data
    • Training of team
    • Total cost of ownership
    • Knowledge on all connected tools with application lifecycle management
    • Agile adoption policies and CI practices
    • Team structure – distributed or co-located?
    • File types – Do you have large binary files?
    • Need file locks?
    • Users have the appropriate permissions to fetch and push
    • Builds are successful, and all your tests are passing

    Key Considerations or Challenges During Migration

    • Test environment
    • Capacity planning
    • Compute capacity
    • Benchmark the current version control system
    • Network connectivity
    • Access between source and target servers
    • Load testing
    • Access control
    • Aim to migrate over a weekend when nobody needs to check-in

    Key Considerations During Post-Migration

    • Data integrity verification
    • Data size check
    • Automated acceptance testing and reporting
    • Dependencies are intact and build doesn’t break
    • Link between files and folders is not broken
    • Load testing
    • Backup and sync jobs

    Moving to Distributed Version Control from Centralized Version Control

    When migrating code from a centralized version control system such as Apache Subversion (SVN) to a distributed version control such as GIT, here are the steps to take:

    • Evaluate the tools and methods you’re planning to utilize
      • Build and test
      • Code reviews
      • Release management
    • Select a branching strategy for GIT
      • long-lived feature branch
      • Short-lived feature branch
      • Bug fix branch
      • Dev branch

    Reference: https://guides.github.com/introduction/flow/index.html

    https://nvie.com/posts/a-successful-git-branching-model/

    • Decide whether you want to migrate history; if yes, then determine how you will achieve this—you may need another third-party tool to resolve your task.
      • There are many tools available in market that can migrate a whole history of all branches from a centralized tool to GIT.
      • Almost all version control systems collect how files change between versions, including rename, merge and rollback. GIT version control tool stores versions as a snapshot of the entire repository.
    • Retain your old version control system for a set time after migration.
      • During and after a migration, developers sometimes need access to the history in the old version control system, so you can’t just shut the old system down once you’ve migrated.
      • There should be some text file committed in GIT which should explain how/when the GIT branches were migrated from the old system and what all branches are migrated.
    • Remove binaries and executables from source control.
      • You should avoid commit large binary files to a repository. Once they’ve been committed to a repository, they will remain in the repository history and in every upcoming clone.
      • Migrating to Git provides you the opportunity to remove these binaries from your codebase and instead use a package management system.
    • Give knowledge transfer to your team in the concepts and practice used in GIT.
      • It is mandatory for developers to understand how Git stores change and how commits form a history of development and how all things work in GIT.
      • Identify training materials.
    • Perform the actual migration to GIT.

    Suggestions:

    • Keep the following types of files: code files, versioned assets such as graphics and large configuration files.
    • Remove the following types of files: database dumps, log files.
    • Use a vulnerability checking tool.

    Conclusion

    By following the above key steps, you can have a systemic and risk-free migration. Planning, then acting, is critical in a successful code migration process.

    — Amit Anan

  • Should You Migrate to Git? Part 1

    Should You Migrate to Git? Part 1

    There are many factors to consider when making the decision whether to migrate your source code. Is it appropriate for the project? Will it work? How might it impact the quality and performance of the finished product?

    Git can help make the decision easier. Git is an open source version control system for tracking changes in computer files and coordinating work on those files among multiple people (Wikipedia’s definition, not mine).

    Git is gaining in popularity and many industries are now moving to it for a number of reasons. For one, Git’s design and performance are remarkably good among all distributed version control system (DVCS) tools. Also, Git can move work quickly between servers without losing history.

    Git has a wide variety of plug-ins for IDEs, and it also comes equipped with a wide variety of tools to help users navigate the history system. Each occurrence of the source contains the complete history tree, which can be useful when developing without an internet connection.

    Plus, Git was created by Linus Torvalds, who also created Linux, which gives it a certain caché.


    Related Content:

    5 Open Source SIEM Tools Worth Checking Out

    Configuration Files and DevOps


    Git’s popularity has been bolstered by killer apps and services such as GitHub, and some very popular projects used it, which further increased its visibility.

    Git nowadays is very popular, but it is recommended companies don’t migrate tools so frequently. Also, there are challenges in  pre-migration and post migration worth considering.

    Distributed revision control uses a peer-to-peer model rather than using a centralized server to store code updates. While a peer-to-peer model would work better for global, open source projects, it may not be ideal in other situations. The downside to a dedicated server approach is that when the server is down, no clients are able to access the code.

    Pros:

    • Great for those who hate centralized version control system (CVCS)
    • Dramatic increase in operation speed
    • Full history tree available offline
    • Distributed, peer-to-peer model
    • Cheap branch operations
    • Attracting lot to non-technical due its open source features (Git is GPLv2)

    Cons:

    • Learning curve for those used to SVN
    • Not optimal for single developers

    Companies That Have Migrated

    Many of today’s new enterprise technologies are centered around free, “open source” technology. As a result, many big companies, from financial giants to retailers to services firms, prefer open source platforms. With the introduction of GitHub many companies have migrated their code base to Git.

    The most popular open source project serves as a “version-control system” for tracking changes and coordinating work between software developers.

    Some very well-known names use Git, including:

      • AWS
      • Reddit
      • Twitter
      • PayPal
      • LinkedIn
      • Gnome
      • Adobe
      • HubSpot
      • Mozilla
      • DropBox

    Terminology

    Git has it own terminology that users, or those considering using it, should become familiar with. Here are some terms worth knowing:

    • Master – the repository’s main branch. Depending on the workflow, it is the one people work on or the one where the integration happens.
    • Clone – copies an existing Git repository, normally from some remote location to your local environment.
    • Commit – posting files to the repository (the local one); in other VCSes it is often referred to as “check-in.”
    • Fetch or pull – Also known as “update” or “get latest” in other VCSes. The variance between fetch and pull is that pull combines both fetching the latest code from a remote repo and performing the merging.
    • Push –  submitting the code to a remote repository.
    • Remote – these are “remote” locations of your repository, normally on some central server.
    • SHA – every commit or node in the Git tree is known by a unique SHA key. You can use them in various commands to manipulate a specific node.
    • head – a reference to the node to which our working space of the repository currently points.
    • branch – similar to other VCSes; however, a branch in Git is actually nothing more special than a particular label on a given node. It is not a physical copy of the files as in other popular VCSes.

    — Amit Anan