Implementing .gitlab-ci.yml

We wrote about why we're replacing GitLab CI jobs with a .gitlab-ci.yml file. As we've started on implementing this large change, we wanted to share the details of that process with you and would love to hear what you think.

To recap the previous article: currently you are required to write out your CI jobs in GitLab CI's interface. We're replacing this with a single file .gitlab-ci.yml, that you place in the root of your repository.

Schema change

Currently, on a push to GitLab, GitLab sends a web-hook to the CI Coordinator. The coordinator creates a build based on the jobs that are defined in its UI, which can then be executed by the connected Runners.

In the new schema, GitLab sends the web-hook and the .gitlab-ci.yml contents to the CI Coordinator, which creates builds based on the yml file. In turn, these builds are executed by the Runners as before.

Migrating to new style

Keeping two different ways of doing things would be a strain on development and support, not to mention confusing. So we're not just deprecating the old style of defining jobs, we're removing it entirely and will migrate existing jobs.

Upon upgrading your existing jobs defined in the GitLab CI Coordinator will be converted into a YAML file with the new syntax. You can download this file at any time from the project settings.

When the GitLab webhook triggers and doesn't transmit the content from .gitlab-ci.yml, the coordinator will use the converted YAML file instead.

This makes migrating to the new style very easy. You can start by simply copy-pasting the contents of the converted YAML file to the root of your repository. Existing projects will continue to build successfully, yet new projects do not have the option to use anything else.

An example .gitlab-ci.yml

To get an idea of how the .gitlab-ci.yml will look, we've prepared an example for a Ruby on Rails project (such as GitLab itself). Of course, this is due to change as we're still working on this.