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

Written by 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:

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

Then we can access it with a single click.

Bonus queries

If we wanted to find which repositories have been upgraded.

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

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.