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,19 +1,30 @@
pipeline { pipeline {
agent any agent any
triggers { pollSCM('*/15 * * * *') }
environment {
PATH = "$PATH:~/.rbenv/bin"
}
stages { stages {
stage('bundle') { stage('test') {
steps { steps {
sh 'bundle' sh '. .env.sh && printenv && bundle'
sh '. .env.sh && bundle exec rake test'
} }
} }
stage('rake test') {
stage('build') {
when {
branch 'master'
}
steps { steps {
sh 'bundle exec rake test' sh '. .env.sh && bundle exec rake clean'
} sh '. .env.sh && bundle exec rake build'
}
stage('module: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'
steps {
sh 'bundle exec rake module:build'
} }
} }
} }

View File

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