How does the GitLab CI yml file work?

I have now installed GitLab CI and a runner on Windows. It was a bit of try and error because the documentation is sparse but it worked. Now I need to create a yml file in my project to tell GitLab CI what to do. But that doesn’t work. I have absolutely no idea what to write in that file. The examples are already complicated and not explained well. Then there is Ruby everywhere. I have no idea how that works. I have a build script, build.cmd, that needs to be started. That’s all. How can I configure that?

I’ve tried with this:

rspec:
    script: "build.cmd"

Here’s what Lint said about it:

Status: syntax is incorrect
Error: Undefined error

Not helpful. At all. Can you tell me what I’ve done wrong, or even better, what I’m supposed to do at all?

Take for example what GitLab uses https://gitlab.com/gitlab-org/gitlab-ce/blob/62c8bc22ccd49dbf971d9ed271a9434e56d6d5f2/.gitlab-ci.yml

This is formatted in yaml so you could try:

cmd:
  script:
    - build.cmd

cmd is an arbitrary name you give the build, right below it indented by two spaces is the script and then under it you state multiple commands prefixed with - .

Also there is documentation here: http://doc.gitlab.com/ci/builds_configuration/README.html

I saw that documentation. But it’s full of tea spoons and spinach and I’m not so hungry right now. Are these names of internal GitLab components or just funny pet names?

Your example worked. It’s important to note though that there have to be exactly two (2) whitespaces to indent each level. Tabs don’t work and result in the yml parser dying without a sound. I never saw that yml language before, maybe it’s just picky about it. I know XML and JSON and using tabs would be fine there.

Thanks for your help. As a suggestion, a few very basic examples in the manual might be helpful, with an explanation of which names are arbitrary (along with other common suggested names) and which are fixed keywords. Then further adding features to the file like ‘before scripts’ and such. Putting the most complicated and complete sample at the beginning will overcharge those who have never seen it before.

I hear you. I will try and send an MR to improve the documentation. Glad you got it to work.

As for the teaspoons and spinaches ( :slight_smile: ), they are arbitrary names. The first line is the name the build is given and is shown in GitLab CI. Take this for example https://ci.gitlab.com/projects/1/refs/master/commits/27a9ff8264ff45a3753dd64ff4af62c121ff7f0b

Alright, thanks. Well, there’s a lot of Ruby all around, and that uses its own set of names for everything as well, so I wasn’t sure if it’s got something to do with that. I know nothing about Ruby except that it’s a scripting language like PHP is. This may be outdated though.