Skip to content

Instantly share code, notes, and snippets.

@avtar
Created May 10, 2017 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avtar/82ef906687d1fabba58821b208fec327 to your computer and use it in GitHub Desktop.
Save avtar/82ef906687d1fabba58821b208fec327 to your computer and use it in GitHub Desktop.
# The standard configuration file to run our Vagrant tests in QI.
#
# See https://github.com/avtar/qi-development-environments
---
# Cache directories such as 'node_modules' in between stages.
cache:
key: "$CI_COMMIT_SHA"
untracked: true
paths:
- node_modules/
# Run the following stages sequentially.
stages:
- vagrant_up
- vagrant_tests
- vagrant_destroy
# Move the '.vagrant' directory to a location so that it won't be removed by the CI runner when it
# cleans the workspace.
before_script:
- "mkdir -p ../.vagrant-$CI_COMMIT_SHA"
- rm -fr .vagrant
- "ln -sf ../.vagrant-$CI_COMMIT_SHA .vagrant"
# "when: always" ensures the 'vagrant up' (and later 'vagrant destroy -f') command is run always,
# so failures in other stages won't interfere with the execution of these critical stages.
vagrant_up:
stage: vagrant_up
script:
- vagrant up
when: always
vagrant_tests:
stage: vagrant_tests
script:
- vagrant ci test
vagrant_destroy:
stage: vagrant_destroy
script:
# Using separate vagrant halt and destroy commands as workarounds for a VirtualBox bug:
# https://www.virtualbox.org/ticket/12477
# https://github.com/mitchellh/vagrant/issues/8104
- vagrant halt
- vagrant destroy -f
- "rm -fr ../.vagrant-$CI_COMMIT_SHA"
when: always
concurrent = 1
check_interval = 0
log_level = "debug"
[[runners]]
name = "your-runners-name"
limit = 1
url = "https://gitlab.com/"
token = "secret-token-sssshhhhh"
executor = "shell"
[runners.cache]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment