Improve jenkins build and potential to publish

This commit is contained in:
Zach Leslie 2018-01-06 13:41:25 -08:00
parent 23d7e2402f
commit 35b795632b
3 changed files with 28 additions and 9 deletions

6
.env.sh Normal file
View File

@ -0,0 +1,6 @@
#! /bin/bash
if [ -x ~/.rbenv/bin/rbenv ]; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(~/.rbenv/bin/rbenv init -)"
fi

29
Jenkinsfile vendored
View File

@ -1,20 +1,31 @@
pipeline {
agent any
triggers { pollSCM('*/15 * * * *') }
environment {
PATH = "$PATH:~/.rbenv/bin"
}
stages {
stage('bundle') {
stage('test') {
steps {
sh 'bundle'
sh '. .env.sh && printenv && bundle'
sh '. .env.sh && bundle exec rake test'
}
}
stage('rake test') {
steps {
sh 'bundle exec rake test'
stage('build') {
when {
branch 'master'
}
}
stage('module:build') {
steps {
sh 'bundle exec rake module:build'
sh '. .env.sh && bundle exec rake clean'
sh '. .env.sh && bundle exec rake build'
sh '[ "$(git rev-list -n 1 $(git tag | tail -n 1 ))" == "$(git rev-list -n 1 HEAD)" ] && bundle exec rake publish pkg/*.tar.gz'
}
}
}
}
}

View File

@ -52,6 +52,8 @@ module PuppetX
tls = Puppet[:ldaptls]
ca_file = "#{Puppet[:confdir]}/ldap_ca.pem"
# TODO if not exists ldap_ca.pem fail
conf = {
host: host,
port: port