레파지토리 추가
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash
gitlab-runner 설치
dnf install gitlab-runner -y
gitlab-runner 시작
gitlab-runner start
토큰 생성
깃랩 등록
gitlab-runner register
Runtime platform arch=amd64 os=linux pid=2792636 revision=66269445 version=17.3.1
Running in system-mode.
Enter the GitLab instance URL (for example, https://gitlab.com/):
http://172.0.0.1:80/
Enter the registration token:
발급 받은 토큰
Verifying runner... is valid runner=G_z2z7siA
Enter a name for the runner. This is stored only in the local config.toml file:
[서버명]: test-runner
깃랩 러너 시작
gitlab-runner start
Runtime platform arch=amd64 os=linux pid=2795502 revision=66269445 version=17.3.1
config 파일 수정
위 부분 추가
builds_dir = "지정할 위치"
[runners.custom_build_dir]
enabled = true
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "test-runner"
url = "http://깃랩 주소/"
id = 3
token = "토큰"
token_obtained_at = 2024-08-26T06:02:03Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "shell"
builds_dir = "/home/deploy"
[runners.custom_build_dir]
enabled = true
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
배포할 파일 위치에 소유 권한을 gitlab-runner로 이전
chown -R gitlab-runner /home/deploy
.gitlab-ci.yml
stages:
- deploy
variables:
GIT_CLONE_PATH: $CI_BUILDS_DIR
deploy:
stage: deploy
only:
- sihyun
script:
echo "Deploy at $(date)" >> deploy.log
tags:
- Test-Runner
테스트 결과 잘 나오게 됩니다.
[root@yellownyou]# dir
deploy.log test.txt
'인프라' 카테고리의 다른 글
OpenSSH를 이용하여 윈도우 11 커널 접속 (0) | 2023.09.01 |
---|---|
Certbot을 활용한 let's Encrypt 인증서 만들기 (0) | 2023.07.09 |
iptime 공유기 ddns를 활용한 집에서 웹 서버 띄우기 (0) | 2023.07.09 |