Setting up Drone CI with Gitlab

In previous article we made GitLab installation on Rancher. Now we need to create test project for the Drone CI.

On the main menu click Create a project.

gitlab welcome page
Write project name, and for the test purposes I will initialize it with README.
gitlab create project page

Click create project.

Now go to admin area (Settings icon on the top bar). Select Applications -> New application. Create new app for drone with URI being http://drone-host/login, and roles are: api and read_user.

gitlab new application page

You should see something like this:

gitlab application page

Go back to rancher and deploy drone. Expose port 80, set env variables and mount docker socket inside container

rancher deploy drone service

Go to the drone url, authorize GitLab. And you should now see your project.

drone list projects

Click activate, then Activate repository and save.

Now add .drone.yml file and the build will be running on commit. I used example drone yml from here.