Tip: Using Sourcegraph code search to help teams migrate to CircleCI 2.0
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).