1. Gitlab runner 설치
$ getconf LONG_BIT # system 확인
$ sudo curl -L --output /usr/local/bin/gitlab-runner "https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64"
$ sudo chmod +x /usr/local/bin/gitlab-runner
$ sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
$ sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
2. Gitlab runner 등록
Runner 만들 프로젝트의 URL과 registration token 확인
$ sudo gitlab-runner stop
$ sudo gitlab-runner register
Enter the GitLab instance URL (for example, https://gitlab.com/):
http://192.168.10.19:8888/
Enter the registration token:
kVkqE8xBYQUdcgSK1vEQ
Enter a description for the runner:
[gerrit]: whatmam-runner
Enter tags for the runner (comma-separated):
whatmam
Registering runner... succeeded runner=kVkqE8xB
Enter an executor: docker, shell, ssh, docker+machine, kubernetes, custom, docker-ssh, parallels, virtualbox, docker-ssh+machine:
docker
Enter the default Docker image (for example, ruby:2.6):
docker:latest
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
$ sudo gitlab-runner start
$ sudo vi /etc/gitlab-runner/config.toml # 생성 확인 및 수정가능
3. runner setting
> runner 생성 확인
> 먼저 태그 없이 동작하도록 설정
4. .gitlab-ci.yml 작성
stages:
- build
build-stage:
stage: build
image: ubuntu:bionic
only:
- master
artifacts:
paths:
- output
script:
- echo "Start ... !!!"
- apt-get update
- apt-get install -y build-essential curl bison flex bc rsync kmod cpio lsb-release libssl-dev lzop fakeroot
5. CI/CD 실행
'Gitlab' 카테고리의 다른 글
Gitlab 한국어 설정 (0) | 2022.01.14 |
---|---|
[Gitlab] ERROR: Uploading artifacts as "archive" to coordinator... too large archive (0) | 2022.01.14 |
Migrating from SVN to GitLab (0) | 2022.01.11 |
Gitlab 설치 (Ubuntu 18.04) (0) | 2021.11.28 |