0 0

Automating Workflows in Your CI/CD Pipeline

Automating Workflows in Your CI/CD Pipeline

By working at VM and container granularity, Tintri makes it possible to automate common CI/CD workflows with just a few lines of code.

  • KEY TAKEAWAYS
  • Tintri all-flash storage works at VM and container granularity, simplifying CI/CD automation.
  • A library of tools including comprehensive REST APIs, a PowerShell Toolkit, and Python SDK facilitate integration in CI/CD environments.
  • Automating common workflows such as self-service recovery, copying a VM for debugging a test failure, and keeping dev/test environments up to date become simple and repeatable with Tintri.

In last week’s Tintri blog, Tomer Hagay talked about the advantages of Tintri all-flash storage for accelerating continuous integration and continuous delivery (CI/CD). Those advantages include:

  • All operations performed at VM and container granularity, simplifying CI/CD automation.
  • Fast and space-efficient snapshots, clones, and replication save time and storage capacity. Auto-QoS ensures that storage I/O is never a bottleneck.
  • Tintri SyncVM accelerates the process of updating dev/test environments.

In this blog, I’ll dig a little deeper on how Tintri enables automation of some important CI/CD processes.

Automating Workflows in Your CI/CD Pipeline

Tintri and Automation

Tintri provides REST APIs for all functions and services, making it possible to incorporate Tintri all-flash storage with existing CI/CD tools such as Jenkins. Specific integrations on top of our APIs make it easy to automate Tintri storage using scripts or as part of your code:

Tintri can also advise you on the best ways to use our tools to solve your CI/CD problems. But you may find you don’t need much help. Because Tintri storage operates at VM granularity, the automation process is far simpler than it would be with storage that only understands LUNs or volumes.

CI/CD Automation Use Cases

Here are a few automation examples that can accelerate common CI/CD bottlenecks. The code fragments below illustrate PowerShell cmdlets, but you can accomplish the same things using REST APIs or our Python SDK.

Self-Service Recovery

Even developers make mistakes. Who hasn’t accidentally misplaced, deleted, or destroyed a file after hours of work? Maybe someone just wants to go back in time an hour or two? But, assuming you even run backups that frequently, it takes too long to get the restore request satisfied by the help desk.

Tintri solves this problem. First, space-efficient snapshots make it possible to create recovery points every hour or at even shorter intervals if desired. Second, VM and container-granular operations make it simple to script the process and make it accessible to users via ChatOps or a self-service portal. The example below restores a snapshot of the user’s VDI vDisk as a second drive. The user can then use copy and paste to recover necessary files.

The core of this operation requires just four lines of code:

Connect-TintriServer –Server vms01.vmlevel.com

$src = Get-TintriVM –name 'user01-vm'

$snap = Get-TintriVMSnapshot –VM $src –GetLatestSnapshot

Sync-TintriVM -VM $src –Snapshot $snap –AttachDisks

Complete code would include comments and error handling, but fundamentally this requires just four VM-level operations: connect to storage, get the user VM, find the snapshot, and attach the snapshot. The vDisk is automatically detached after 48 hours.

Debugging Test Failures in CI Test Suite

If a test failure occurs during execution of a CI test suite, the affected VM may need to be quarantined until it’s triaged. That could mean that it’s potentially unavailable for days, gumming up the works.

Tintri makes it easy to solve this problem using automation. When a test failure occurs, CI suite automation can take a snapshot of the VM that was running the failed test. This allows the developer to use his or her favorite tools for root cause analysis, while ensuring that test resources are never quarantined.

Automating Workflows in Your CI/CD Pipeline

The core of this operation requires just six lines of code:

Connect-TintriServer –Server vms01.vmlevel.com

$src = Get-TintriVM –name 'test-vm01'

$snap = Get-TintriVMSnapshot –VM $src -GetLatestSnapshot

$disks = Get-TintriVDisk –Snapshot $snap 

$dst = Get-TintriVM –name 'dev-vm01'

Sync-TintriVDisk -VM $dst -SourceSnapshot $snap –VDiskMap

The code is again quite trivial because it calls VM-level APIs and makes use of game-changing SyncVM copy data management specific to Tintri.

Keeping Development Database Copies Up to Date

Keeping development and test environments up to date in a fast-moving CI/CD pipeline can be a challenge. This is especially true when the application includes a database. To ensure code quality, your team needs to work with and test against up to date copies of the database. Given the size of modern databases, it simply takes too much time and too much storage to make physical copies. Tintri solves this problem by giving every development environment a space-efficient clone, allowing you to have as many full database instances as you need and to create new environments almost instantaneously. Tintri SyncVM makes the whole process simple, efficient, and repeatable so development environments stay up to date.

Automating Workflows in Your CI/CD Pipeline

The code below shows the process for syncing a development database.

Connect-TintriServer –Server vms01.vmlevel.com

$src = Get-TintriVM –name 'prod-sql'

$snap = Get-TintriVMSnapshot –VM $src -UseLatestSnapshot

$dst = Get-TintriVM –name 'dev-sql'

Sync-TintriVDisk -VM $dst –SourceSnapshot $snap -AllButFirstVdisk

These five lines take less than 60 seconds to execute.

The Tintri Difference

I should emphasize that with any other storage vendor, scripting the functionality shown in the preceding automation examples might take hundreds of lines of code that take many minutes or even hours to execute—and add significant risk. Because LUN-based storage can’t snapshot individual VMs and vDisks directly, you’re forced to do complex manipulations on the LUN to accomplish operations on individual VMs.

Tintri makes automating storage-related CI/CD workflows fast and simple so they are easier to understand and maintain.

Matthew Geddes / Feb 13, 2018

Matt is responsible for Tintri’s place within Microsoft's ecosystem and Hyper-V specifically. He joined Tintri three years ago. Ever since, he has led Tintri’s multi-hypervisor efforts, advoc...more

Temporary_css