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

No items found.
May 2, 2019

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:

Query: [`repo:/segmentio/ file:circle.yml`](https://sourcegraph.com/search?q=repo:/segmentio/+file:circle.yml).

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.

Query: [`repo:/segmentio/ file:\.circleci/config\.yml`](https://sourcegraph.com/search?q=repo:/segmentio/+file:%5C.circleci/config%5C.yml).

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

Query: [`repo:/segmentio/ file:\.circleci/config\.yml type:diff "version: 2"`](https://sourcegraph.com/search?q=repo:/segmentio/+file:%5C.circleci/config%5C.yml+type:diff+%22version:+2%22).

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.
Subscribe for the latest code AI news and product updates
By submitting, I agree to Sourcegraph's Terms of Service and Privacy Policy.

Get Cody, the AI coding assistant

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

Learn more