gitlabランナーの統合

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ランナーリスト

ducafecat_2018-08-17-15-16-23

3.2ランナー修正

ducafecat_2018-08-17-15-17-48

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実装

  • 次回統合タスクを行くコードを提出

ducafecat_2018-08-17-15-26-05

  • タスクのステージ

ducafecat_2018-08-17-15-27-32

  • ディテール

ducafecat_2018-08-17-15-29-48

ducafecat_2018-08-17-15-30-38

参照

:で再現https://segmentfault.com/a/1190000016069906

リリース8元の記事 ウォンの賞賛0 ビュー5857

おすすめ

転載: blog.csdn.net/connectu/article/details/103933324