Skip to content

Instantly share code, notes, and snippets.

@trlinkin
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save trlinkin/e62af95ea19ee8d401f8 to your computer and use it in GitHub Desktop.

Select an option

Save trlinkin/e62af95ea19ee8d401f8 to your computer and use it in GitHub Desktop.
Jenkins Pipeline Scripts
#!/bin/bash
set -e
# The Git plugin should be told to clone the module repository to a directory
# by the same name as the module. We will do most of our work from within the
# the module's working directory.
cd ntp
# Select Ruby version using RVM
. /usr/local/rvm/scripts/rvm; rvm use ruby-1.9.3-p484
echo
echo Ruby Version Selected:
ruby -v
# Install project dependencies using Bundler
#
# We will instruct Bundler to keep the gems installed in a directory under the
# module root. This way, when we create our archive, the gems will be shipped
# with it.
echo
echo Installing Dependencies
bundle install --path ./.bundle
# If your Puppet module has dependencies on other modules, you will also want
# to prepare the "fixtures" for the 'puppetlabs_spec_helper'. Uncomment the
# following line if you use spec fixtures.
#bundle exec rake spec_prep
# Creating archive
#
# Assuming everything went well, this archive will be saved and used during
# other build stages. Other builds will bring in this archive by using the
# "Copy Artifact Plugin" plugin (plugin-id: copyartifact).
echo
echo "Creating Artifact"
tar -czf ../archive.tgz .
#!/bin/bash
mkdir ntp
mv archive.tgz ntp
cd ntp
tar -zxf archive.tgz
. /usr/local/rvm/scripts/rvm; rvm use ruby-1.9.3-p484
echo
echo Running Lint Testing
bundle exec rake lint
#!/bin/bash
. /usr/local/rvm/scripts/rvm; rvm use 1.9.3-p484
echo
echo Extracting the build artifact
tar -zxf archive.tgz
echo
echo Running the rspec-puppet unit tests
echo
echo "Running tests"
bundle exec rake spec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment