Tip: Using Sourcegraph code search to help teams migrate to CircleCI 2.0

Ryan Blunden

In this post, we'll explain how Sourcegraph code search can be used to report on the progress of upgrading CircleCI config files to the 2.0 format.

CircleCI 2.0 officially came out of beta in July 2017, introducing a versioned config file (.circleci/config.yml) to replace the previous circle.yml file. A likely scenario could be an Engineering Manager requesting all teams upgrade to CircleCI 2.0 and wanting to track progress without human intervention.

Using Sourcegraph.com and as an example, Segment's open source code on GitHub, let's search for repositories that contain the 1.0 circle.yml file:

CircleCi results

Typing this query every time would be inefficient, so let's save this query as a saved search.

CicleCi create saved search

Then we can access it with a single click.

CicleCi access saved search

Bonus queries

If we wanted to find which repositories have been upgraded.

CircleCi results

Using Sourcegraph's diff search (type: diff), we can find who made the commit that contained the upgrade.

CicleCi who upgraded

Find answers in code with Sourcegraph

Sourcegraph helps you find answers in code, supporting 10,000+ repositories and thousands of developers.

Although this example was specific to CircleCI config files, the concepts apply equally well for many other similar use cases, such as tracking the removal of a deprecated Node.js package.

Get Cody, the AI coding assistant

Cody makes it easy to write, fix, and maintain code.