Installing Gitlab CI

Submitted by Tha-Fox on 2019-08-07

I've had self hosted Gitlab instance running for a long time along the gitlab.com service. After an upgrade I noticed Gitlab had CI enabled on repositories by default. This got me pondering on enabling the CI features on my own instance. I'm using Ubuntu 18.04, but on the official instructions there are other distributions like CentOS, Fedora and Debian, mentioned. So here is a brief guide to my future self.

  1. Add the repository for Gitlab runner
    curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
  2.  Install the runner
    sudo apt-get install gitlab-runner
  3. I know beforehand that I want to use Docker as my executor, so I install it before registering the runner.
    sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
  4. Add Docker's official GPOG  key
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  5. Check the key fingerprint
    sudo apt-key fingerprint 0EBFCD88
  6. Add the stable repository. It is also possible to use test or nightly repository.
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  7. Install Docker Engine - Community and containerd
    sudo apt-get install docker-ce docker-ce-cli containerd.io
  8. Test Docker by running the hello-world container
    sudo docker run hello-world
  9. Register the runner. If you want to install a shared runner, you have to have admin access to .Gitlab instance. While installing shared instance, you can find the URL and token from the Gitlab UI by going to admin/runners. The rest of the options are told here.
  10. I selected Docker as my executor, so I have to give the default Docker image, in case projects do not define one in .gitlab-ci.yml. I choose Alpine Linux as it is popular distribution with small footprint.
    alpine:latest

When the runner has been installed and registered, it is visible in Gitlab. Now all you need to do is add .gitlab-ci.yml to the root of your repository and start wondering what to do with it.

Tagit

Lisää uusi kommentti

Rajattu HTML

  • Sallitut HTML-tagit: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Rivit ja kappaleet päätetään automaattisesti.
  • Verkko- ja sähköpostiosoitteet muutetaan automaattisesti linkeiksi.