카테고리

asm (27) bootloader_x86_grub (1) C (92) compile (11) config (76) CPP (13) CSS (1) debugging (7) gimp (1) Go (1) html (1) Java (1) JavaScript (1) kernel (19) LibreOffice (3) Linux system progamming (21) MFC (1) opencv (4) OpenGL (1) PHP (1) Python (4) qemu (29) shell (3) socket (7) troubleshooting (2) ubuntu18.04 (2) windows (1)

2019/01/01

GitLab CI 속도 향상

GitLab CI 속도 향상

GNOME GitLab은 AWS rnuners를 가지고 있지만, 개인이 포크해 푸시할 때가 아니라, 업스트림(작업 단계) 저장소 코드를 푸시하는 경우에만 사용된다.
개인 포크의 경우, 공유 관련 문제로 몇 시간 기다릴 수 있음.

그래서 이 기다림 때문에 CI를 구축해 사용한다.

1. 도커 설치
apt install docker.io

2. gitlab-runner 설치
2.1 저장소 추가

프로젝트 사이트:
https://gitlab.com/gitlab-org/gitlab-runner/blob/master/docs/install/linux-repository.md#installing-the-runner

2.1 gitlab 공식 저장소 추가.
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash

추가
sudo cat > /etc/apt/preferences.d/pin-gitlab-runner.pref <<EOF
Explanation: Prefer GitLab provided packages over the Debian native ones
Package: gitlab-runner
Pin: origin packages.gitlab.com
Pin-Priority: 1001
EOF

참고: 우분투 18.04 패키지 동작안함.

2.2 저장소 최신 버전 설치
sudo apt-get update
sudo apt-get install gitlab-runner

2.3 특정 버전 설치
apt-cache madison gitlab-runner
sudo apt-get install gitlab-runner=10.0.0

---> 설치 했다면 4. gitlab-runner 서비스 시작부터 진행.
2.4 최신 버전 업데이트
sudo apt-get update && sudo apt-get install gitlab-runner

3. 저장소 업그레이드
GitLab Runner를 10.0 이전 버전에서 업그레이드

3.1 기존 저장소 삭제.
sudo rm /etc/apt/sources.list.d/runner_gitlab-ci-multi-runner.list
2.1 gitlab 공식 자장소 추가 부터 다시 진행.

4. gitlab-runner 서비시 시작
sudo gitlab-runner start

5. 등록
현 개발 서버 구축한 gitlab 프로젝트 패이지 이동.
settings -> CI/CD -> expand "runners"

6. 사용할 도코 기반 이미지 등록
sudo gitlab-runner register --non-interactive --url https://gitlab.gnome.org --executor docker --docker-image //운영체제버전fedora:27 --registration-token ****

7. .bashrc 등록
vi ~/.bashrc

function gitlab-register {
  host=$1
  token=$2

  case "$host" in
    gnome)
      host=https://gitlab.gnome.org
      ;;
    fdo)
      host=https://gitlab.freedesktop.org
      ;;
    collabora)
      host=https://gitlab.collabora.com
      ;;
    mylocal_service)
      host=https://local.gitlab.nautilus
      ;;
    *)
      host=https://gitlab.gnome.org
      token=$1
  esac

  cmd="sudo gitlab-runner register --non-interactive --url $host --executor docker --docker-image fedora:27 --registration-token $token"

  #$cmd

  ssh builder.local -t "$cmd"
}

댓글 없음:

댓글 쓰기