Skip to content

Instantly share code, notes, and snippets.

@lomocc
Last active December 7, 2018 02:55
Show Gist options
  • Save lomocc/af69d5362166e946ab7cc42f13509c12 to your computer and use it in GitHub Desktop.
Save lomocc/af69d5362166e946ab7cc42f13509c12 to your computer and use it in GitHub Desktop.

gitlab-runner

参考地址:https://docs.gitlab.com/runner/install/linux-repository.html

安装

curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash

# 安装
yum install gitlab-runner

# 安装指定版本
yum list gitlab-runner --showduplicates | sort -r
yum install gitlab-runner-10.0.0-1
gitlab-runner register

注册

gitlab-runner register -n \
  --url http://10.82.12.180/ \
  --registration-token bGmQzGtum2KqLzLtjbez \
  --executor docker \
  --description "docker" \
  --docker-image "modules/kubectl" \
  --docker-volumes /var/run/docker.sock:/var/run/docker.sock

配置

volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock", "/home/gitlab-runner/maven-repo"]

Gitlab

cache

before_script:
  - PATH=$PATH:node_modules/.bin
prepare:
  script:
    - yarn
  cache:
    policy: push
    paths:
      - node_modules/
prebuild:
  script:
    - yarn run build
  cache:
    policy: pull
    paths:
      - node_modules/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment