Skip to content

Instantly share code, notes, and snippets.

@NSLog0
Last active May 5, 2018 16:47
Show Gist options
  • Select an option

  • Save NSLog0/1f64e3ed02a171c01154a86bd2581326 to your computer and use it in GitHub Desktop.

Select an option

Save NSLog0/1f64e3ed02a171c01154a86bd2581326 to your computer and use it in GitHub Desktop.
GitLab CI Service
stages:
- test
test_jpb:
stage: test
image: ruby:2.4.3
services:
- postgres:9.6.1
variables:
RAILS_ENV: test
POSTGRES_DB: blog_test
POSTGRES_USER: runner
POSTGRES_PASSWORD: ''
before_script:
- curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
- echo "deb http://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
- curl -sL http://deb.nodesource.com/setup_6.x | bash -
- apt-get install -y nodejs yarn
- RAILS_ENV=test bundle install --jobs $(nproc) "${FLAGS[@]}"
- cp config/database.yml.gitlab config/database.yml
- rails assets:precompile
- yarn
script:
- RAILS_ENV=test bundle exec rake db:create db:schema:load --trace
- rails db:test:prepare
- RAILS_ENV=test bundle exec rspec
# Download package
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh -o /tmp/gl-runner.deb.sh
# run pre-installation
sudo bash /tmp/gl-runner.deb.sh
# install
sudo apt-get install gitlab-runner
# show all runner that has been registed
sudo gitlab-runner list
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/) - ให้ใส่ URL server เราเข้าไป
Please enter the gitlab-ci token for this runner - ให้ก็อบ token แบบแชร์มาใส่
Please enter the gitlab-ci description for this runner - แค่ใส่คำอธิบายว่า Runner ตัวนี้ใช้ทำไร
Please enter the gitlab-ci tags for this runner (comma separated) - ไม่ต้องใส่ก็ได้
Whether to lock Runner to current project [true/false] - อันนี้มันจะถามว่าให้ Runner เป็นแบบ specific project ไหม ถ้าแชร์ Token ให้ตอบ "false"
Please enter the executor - อันนี้ให้ตอบ "docker" นะครับ หรือใครอยากใช้ Runner ตัวอื่นก็แล้วแต่สะดวก
Please enter the default Docker image - อันนี้ให้ใส่ค่าเริ่มต้นของ container image เวลาที่ CI หาคำสั่ง image: ไม่เจอในไฟล์ .gitlab-ci.yml ไฟล์ตั่งค่า CI
# register runner for init setting
sudo gitlab-runner register
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment