As GitLab and GitLab CI have been designed to work together, we have decided to package both in the same GitLab BitNami stack. By launching a recent BitNami GitLab cloud image, (later than version 5.1.0-3), you will have access to both GitLab and GitLab CI. GitLab will be accessible at "/gitlab" and GitLab CI at "/gitlabci"
You can find below a step by step guide on how to perform full integration between them for a sample project. This integration consists on the ability of running a task from GitLab CI when an user makes a commit in a GitLab repository. To achieve that, please perform the following steps:
1. Add a project on GitLab.
Commiting on GitLab |
sudo su gitlab_ci -c "ssh-keygen -t rsa"
4. On your personal machine start the repository as is described at GitLab. This step is not related to the integration with GitLab CI but the repository should be started to be able to perform the remaining steps.
5. Clone the repository with the gitlab_ci user on the GitLab server.
$ mkdir /opt/bitnami/apps/gitlabci/repositories
$ /opt/bitnami/git/bin/git config --global user.name 'Administrator'
$ /opt/bitnami/git/bin/git config --global user.email 'user@example.com'
$ cd /opt/bitnami/apps/gitlabci/repositories/
$ /opt/bitnami/git/bin/git clone git@<hostname_gitlab_server>:bitnami-sample-project.git"
Cloning into 'bitnami-sample-project'...
remote: Counting objects: 3, done.
Receiving objects: 100% (3/3), 201 bytes, done. remote: Total 3 (delta 0), reused 0 (delta 0)
6. Create the project on GitLab CI by selecting 'Add project' on the GitLab CI application with the following parameters and saving it.
- Name: bitnami-sample-project
- Token: (blank)
- Path: /opt/bitnami/apps/gitlabci/repositories/bitnami-sample-project
- Follow branches: master
- Scripts: ls
- Token: (blank)
- Path: /opt/bitnami/apps/gitlabci/repositories/bitnami-sample-project
- Follow branches: master
- Scripts: ls
Once created, press "Details" because the "Project URL" and "Project Token" are required for the next step.
7. Enable GitLab CI on the repository created on GitLab. To do so, go to GitLab -> Projects -> BitNami sample project -> Settings -> Services -> GitLab CI. Select "Active" and fill "Project URL" and "Project Token" with the values from the previous step and press Save.
8. GitLab integration with GitLab CI is complete! To test it is working, just commit a new file from your personal machine. Then on GitLab CI you should be able to see something similar to the following:
GitLab CI running tasks when commiting on GitLab |