Skip to content

Instantly share code, notes, and snippets.

@dhollinger
Created March 15, 2017 19:56
Show Gist options
  • Save dhollinger/767e70ed37148d4ca3a91633817f7c18 to your computer and use it in GitHub Desktop.
Save dhollinger/767e70ed37148d4ca3a91633817f7c18 to your computer and use it in GitHub Desktop.
Gitlab job config
stages:
- validate
- test
- deploy
code_validation:
stage: validate
image: ruby:2.2
before_script:
- bundle install
script:
- bundle exec rake syntax metadata_lint
tags:
- puppet-unit
unit_test:
stage: test
image: ruby:2.2
before_script:
- bundle install
script:
- bundle exec rake spec
tags:
- puppet-unit
acceptance:
stage: test
before_script:
- rvm use 2.4.0
- gem install bundler
- ruby -v
- bundle install
script:
- bundle exec rake acceptance
tags:
- puppet-acceptance
pages:
stage: deploy
image: ruby:2.2
before_script:
- bundle install
script:
- echo "Deploying Documentation"
- bundle exec rake strings:generate
artifacts:
paths:
- public
only:
- master
tags:
- puppet-acceptance
deploy_to_production:
stage: deploy
script:
- export DEPLOY_VERSION=$(cat metadata.json | grep \"version\" | awk {'print $2'} | sed 's/\"//g' | sed 's/,//g')
- export CURRENT_VERSION=$(git tag -l | tail -n1)
- |
if [ "$DEPLOY_VERSION" != "$CURRENT_VERSION" ]; then
git remote set-url origin git@gitlab-dev.example.com:puppet/pmaster.git
git tag "${DEPLOY_VERSION}"
git push origin --tags
fi
only:
- master
when: on_success
tags:
- puppet-acceptance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment