1 gitlabランナーが取り付けられました
- 1.1のダウンロード実行可能ファイル
-
#Linuxのx86-64で
のsudo wgetの-Oは/ usr / local / binに/ gitlabランナーhttps://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64#Linuxのx86の
はsudo wgetの-Oは/ usr / local / binに/ gitlabランナーhttps://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-386#Linuxは腕
にsudo wgetの-Oは/ usr / local / binに/ gitlabランナーhttps://gitlab-runner-downloads.s3.amazonaws.com/late
- 1.2設定は、実行権限を
sudo chmod +x /usr/local/bin/gitlab-runner
- GitLab CIユーザーの作成1.3
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に1を定義していないプロジェクトのために使用されるデフォルトのイメージのために求められます。
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実装
- 次回統合タスクを行くコードを提出
- タスクのステージ
- ディテール