Skip to content

Instantly share code, notes, and snippets.

View cdenneen's full-sized avatar

Chris Denneen cdenneen

  • New York
View GitHub Profile
@cdenneen
cdenneen / Jenkinsfile
Created May 8, 2017 16:17
Nested Pipeline Matrix
#!/usr/bin/groovy
@Library('github.com/cdenneen/jenkins-shared@master') _
node {
deleteDir()
stage 'Checkout'
git branch: 'production', url: 'https://github.com/cdenneen/control-repo.git'
def stashName = "${env.JOB_NAME}_${env.BUILD_NUMBER}"
stash stashName
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
// short SHA, possibly better for chat notifications, etc.
@cdenneen
cdenneen / Jenkinsfile
Last active May 5, 2017 13:38
Pipeline testing
node {
deleteDir()
stage 'Checkout'
git branch: 'production', url: 'https://github.com/cdenneen/control-repo.git'
// def stashName = "${env.JOB_NAME}_${env.BUILD_NUMBER}"
// stash stashName
// stage 'Test'
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
// short SHA, possibly better for chat notifications, etc.
shortCommit = gitCommit.take(6)
@cdenneen
cdenneen / Dockerfile
Last active April 24, 2017 21:18
Add RVM to jenkins image
FROM jenkinsci/jenkins
MAINTAINER Chris Denneen "cdenneen@gmail.com"
USER root
RUN apt-get update && apt-get install -y build-essential libyaml-dev ruby-dev
USER jenkins
RUN /bin/bash -l -c "curl -L https://get.rvm.io | bash -s stable"
RUN /bin/bash -l -c "source ~/.rvm/scripts/rvm"
#RUN /bin/bash -l -c "source ~/.bash_profile; rvm requirements"
RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
@cdenneen
cdenneen / docker.groovy
Last active April 19, 2017 20:25
Docker issues
node {
deleteDir()
stage 'Checkout'
git branch: 'production', url: 'https://github.com/cdenneen/control-repo.git'
stash "${env.JOB_NAME}"
stage 'Test'
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
// short SHA, possibly better for chat notifications, etc.
shortCommit = gitCommit.take(6)
sh "echo $shortCommit"
@cdenneen
cdenneen / Jenkinsfile
Last active July 23, 2018 00:55
Jenkins Pipeline with matrix testing
node {
stage 'Checkout'
git branch: 'production', url: 'https://github.com/cdenneen/control-repo.git'
stash "${env.JOB_NAME}"
stage: 'Test'
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
// short SHA, possibly better for chat notifications, etc.
shortCommit = gitCommit.take(6)
sh "echo $shortCommit"
def matrix = [:]
node {
stage 'Checkout'
git branch: 'logging5', credentialsId: 'XXX', url: 'YYY'
stage 'Test'
gitCommit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
// short SHA, possibly better for chat notifications, etc.
shortCommit = gitCommit.take(6)
def versions = [:]
def rubyVersion = ['2.1', '2.3']
for (int x = 0; x < rubyVersion.size(); x++) {
node {
stage('fetch code')
checkout scm
stash name: 'infra-stash'
stage('build')
dir('/var/jenkins_home/workspace/shared/jobs/build/puppet lint') {
deleteDir()
unstash 'infra-stash'
}
build job: 'shared/jobs/build/puppet lint'
@cdenneen
cdenneen / puppet_unit.groovy
Created March 13, 2017 21:06
Jenkins Multiconfiguration Job with Dynamic Axis
matrixJob('shared/jobs/build/puppet unit') {
logRotator(-1, 5, -1, -1)
parameters {
stringParam('RUBY_VERSIONS', '2.1.9 2.3.3', 'Ruby version to select')
stringParam('PUPPET_VERSIONS', '4.7.0 4.8.1', 'Puppet version to select')
}
axes {
label('puppet')
dynamicAxis('RUBY_VERSION','$RUBY_VERSIONS')
dynamicAxis('PUPPET_GEM_VERSION','$PUPPET_VERSIONS')
file {'test':
ensure => present,
require => Class['epel']
}
include ::epel
@cdenneen
cdenneen / common.yaml
Created June 6, 2016 14:58
Hiera Hash Lookup
---
publicbucket: 'myBucket'
profile::searchinfra::idx::esindexer:
app_source_bucket_dirkey: 'ESIndexer'
app_source_bucket: "http://s3.amazonaws.com/%{::publicbucket}/%{hiera('profile::searchinfra::idx::esindexer[app_source_bucket_dirkey]')}"