1 gitlab 주자 마운트
- 1.1 다운로드 실행 파일
-
# 리눅스 x86-64에
sudo는 wget을 -O / usr / 지방 / 빈 / gitlab 주자 https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64# 리눅스 86
sudo는 wget을 -O / usr / 지방 / 빈 / gitlab 주자 https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-386# 리눅스는 팔
sudo는 wget을 -O / usr / 지방 / 빈 / gitlab 주자 https://gitlab-runner-downloads.s3.amazonaws.com/late
- 1.2 세트 실행 권한
sudo chmod +x /usr/local/bin/gitlab-runner
- 1.3 만들기 GitLab CI 사용자
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
- 1.4 실행 서비스
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
gitlab-runner start
2 gitlab 주자 등록
2.1 획득 Gitlab 注册令牌
열기 gitlab 프로젝트 -> 설정 -> CI / CD -> 주자 설정
2.2 LINUX 등록
- 실행 등록
sudo gitlab-runner register
- 당신의 GitLab URL을 입력
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://xxx.xxx
- 입력
注册令牌
러너를 등록
Please enter the gitlab-ci token for this runner
xxx
- 러너의 설명을 입력
Please enter the gitlab-ci description for this runner
[hostame] my-runner
- 태그를 입력 러너
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
- 러너 구현을 입력
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
shell
- 如果 是 在 도커 中 运行, 당신은 .gitlab - ci.yml 하나를 정의하지 프로젝트에 사용되는 기본 이미지를 묻는 메시지가 나타납니다 :
Please enter the Docker image (eg. ruby:2.1):
alpine:latest
3 성공적인 링크
3.1 러너 목록
3.2 변형 러너
4 쓰기 .gitlab-ci.yml
통합
image: java:8
stages:
- build
- build-pro
#测试环境
build:
stage: build
script:
- pwd
- cd project/my_app
- /usr/local/maven/bin/mvn clean package -P test
- sh /usr/local/project_deploy_script/app/app_test.sh
tags:
- deploy-app
only:
- develop
#正式环境
stage: build-pro
script:
- pwd
- cd project/my_app
- /usr/local/maven/bin/mvn clean package -P pro
- sh /usr/local/project_deploy_script/app/app.sh
tags:
- deploy-app
only:
- master
집적 5 실시
- 다음 번 통합 작업을 갈 것입니다 코드를 제출
- 작업 단계
- 세부 정보