<commit_before>GitLab
******

.. note:: The script below will not install ``gitlab-ci-multi-runner`` on
          Elementary OS.  I am installing onto a cloud server running Ubuntu
          14.04.

CI
==

From `Install using official GitLab repositories`_

Install Docker, :doc:`../../linux/apps/docker/getting-started`

Install ``gitlab-ci-multi-runner``::

  curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash
  apt-get install gitlab-ci-multi-runner

Set-up::

  $ gitlab-ci-multi-runner register
  Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci):
  https://gitlab.com/ci
  Please enter the gitlab-ci token for this runner:
  <PASSWORD>
  Please enter the gitlab-ci description for this runner:
  [master-b]: ci.kbsoftware.co.uk
  Please enter the gitlab-ci tags for this runner (comma separated):
  INFO[0204] eabd2c42 Registering runner... succeeded
  Please enter the executor: shell, parallels, docker, docker-ssh, ssh:
  docker
  Please enter the Docker image (eg. ruby:2.1):
  pkimber/gitlab-pytest
  If you want to enable mysql please enter version (X.Y) or enter latest?
  If you want to enable postgres please enter version (X.Y) or enter latest?
  If you want to enable redis please enter version (X.Y) or enter latest?
  If you want to enable mongo please enter version (X.Y) or enter latest?
  INFO[0498] Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!


.. _`Install using official GitLab repositories`: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/linux-repository.md<commit_msg>gitlab<commit_after>GitLab
******

.. note:: The script below will not install ``gitlab-ci-multi-runner`` on
          Elementary OS.  I am installing onto a cloud server running Ubuntu
          14.04.

Continuous Integration
======================

From `Install using official GitLab repositories`_

Install Docker, :doc:`../../linux/apps/docker/getting-started`

Install ``gitlab-ci-multi-runner``::

  curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash
  apt-get install gitlab-ci-multi-runner

.. tip:: Register the runner using ``sudo`` because you cannot enable the
         service unless you are ``root``.

Set-up::

  sudo -i
  gitlab-ci-multi-runner register

Sample output::

  Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/ci):
  https://gitlab.com/ci
  Please enter the gitlab-ci token for this runner:
  <PASSWORD>
  Please enter the gitlab-ci description for this runner:
  [master-b]: ci.kbsoftware.co.uk
  Please enter the gitlab-ci tags for this runner (comma separated):
  INFO[0204] eabd2c42 Registering runner... succeeded
  Please enter the executor: shell, parallels, docker, docker-ssh, ssh:
  docker
  Please enter the Docker image (eg. ruby:2.1):
  pkimber/gitlab-pytest
  If you want to enable mysql please enter version (X.Y) or enter latest?
  If you want to enable postgres please enter version (X.Y) or enter latest?
  If you want to enable redis please enter version (X.Y) or enter latest?
  If you want to enable mongo please enter version (X.Y) or enter latest?
  INFO[0498] Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!

Run in debug mode::

  gitlab-runner --debug run

To start the service::

  gitlab-runner start

Create a ``.gitlab-ci.yml`` file in your project.  Here is an example:
https://gitlab.com/kb/checkout/blob/master/.gitlab-ci.yml

- Our standard is to create a ``requirements/ci.txt`` file.  Use the GIT
  ``https`` URL rather than a path to the folder.

Log into GitLab as an administrator, *Project Settings*, *Runners*, click
*Enable for this project*.

Migrate from GitHub
===================

Adapted from `How do I import an existing git project into GitLab?`_

e.g. to move ``<EMAIL>:pkimber/contact.git`` to
``<EMAIL>:kb/contact.git``

Create a new (empty) repository in GitLab:

- Log into https://gitlab.com/ using our company login details.
- Click on *New Project*.
- In the *Project path* section select the ``kb`` group.  Select the correct
  *Visibility Level* and click *Create Project* e.g.
  ``<EMAIL>:kb/contact.git``

In a **temporary** directory::

  git clone --mirror <EMAIL>:pkimber/contact.git
  cd contact.git
  git remote add gitlab <EMAIL>:kb/contact.git
  git push gitlab --mirror

Now if you have a locally cloned repository that you want to keep using with
the new remote, run the following commands there::

  git remote remove origin
  git remote add origin <EMAIL>:kb/contact.git
  git fetch --all

Go to the *Project Settings* for the GitLab project, click on
*Protected branches* and unprotect the master branch so developers can push to
it.


.. _`How do I import an existing git project into GitLab?`: http://stackoverflow.com/questions/20359936/how-do-i-import-an-existing-git-project-into-gitlab
.. _`Install using official GitLab repositories`: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/linux-repository.md
{'fraction_non_alphanumeric': 0.11098288132333141, 'fraction_numerical': 0.008078476630121177, 'mean_word_length': 3.814814814814815, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4515057', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1550, 'n_words': 597}