Merge pull request #49823 from dubb-b/timeout_addition

Adding timeout to all pipelines so that the build aborts
This commit is contained in:
Nicole Thomas 2018-09-30 07:17:27 -04:00 committed by GitHub
commit fd46d35a55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 407 additions and 373 deletions

View File

@ -1,8 +1,11 @@
pipeline { pipeline {
agent { label 'docs' } agent {
label 'docs'
}
options { options {
timestamps() timestamps()
ansiColor('xterm') ansiColor('xterm')
timeout(time: 2, unit: 'HOURS')
} }
environment { environment {
PYENV_ROOT = "/usr/local/pyenv" PYENV_ROOT = "/usr/local/pyenv"

View File

@ -1,71 +1,76 @@
node('kitchen-slave') { timeout(time: 6, unit: 'HOURS') {
timestamps { node('kitchen-slave') {
ansiColor('xterm') { timestamps {
withEnv([ ansiColor('xterm') {
'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml', withEnv([
'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml', 'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml',
'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin', 'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml',
'RBENV_VERSION=2.4.2', 'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
'TEST_SUITE=py2', 'RBENV_VERSION=2.4.2',
'TEST_PLATFORM=centos-7', 'TEST_SUITE=py2',
'PY_COLORS=1',]) 'TEST_PLATFORM=centos-7',
{ 'PY_COLORS=1',
stage('checkout-scm') { ]) {
cleanWs notFailBuild: true stage('checkout-scm') {
checkout scm cleanWs notFailBuild: true
} checkout scm
try {
stage('github-pending') {
githubNotify credentialsId: 'test-jenkins-credentials',
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
status: 'PENDING',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
}
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
} }
try { try {
stage('run kitchen') { stage('github-pending') {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { githubNotify credentialsId: 'test-jenkins-credentials',
sshagent(credentials: ['jenkins-testing-ssh-key']) { description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
sh 'ssh-add ~/.ssh/jenkins-testing.pem' status: 'PENDING',
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM' context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM' }
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
}
try {
stage('run kitchen') {
withCredentials([
[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
]) {
sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
}
} }
} }
} } finally {
} stage('cleanup kitchen') {
finally { script {
stage('cleanup kitchen') { withCredentials([
script { withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
sshagent(credentials: ['jenkins-testing-ssh-key']) { ]) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem' sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM' sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM'
}
}
} }
}} archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml'
archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml' archiveArtifacts artifacts: 'artifacts/logs/minion'
archiveArtifacts artifacts: 'artifacts/logs/minion' archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log'
archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log' }
} }
} } finally {
} try {
finally { junit 'artifacts/xml-unittests-output/*.xml'
try { } finally {
junit 'artifacts/xml-unittests-output/*.xml' cleanWs notFailBuild: true
} def currentResult = currentBuild.result ?: 'SUCCESS'
finally { if (currentResult == 'SUCCESS') {
cleanWs notFailBuild: true githubNotify credentialsId: 'test-jenkins-credentials',
if (currentBuild.result == 'SUCCESS') { description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
githubNotify credentialsId: 'test-jenkins-credentials', status: 'SUCCESS',
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed", context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
status: 'SUCCESS', } else {
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}" githubNotify credentialsId: 'test-jenkins-credentials',
} description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
else { status: 'FAILURE',
githubNotify credentialsId: 'test-jenkins-credentials', context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed", }
status: 'FAILURE',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
} }
} }
} }

View File

@ -1,71 +1,76 @@
node('kitchen-slave') { timeout(time: 6, unit: 'HOURS') {
timestamps { node('kitchen-slave') {
ansiColor('xterm') { timestamps {
withEnv([ ansiColor('xterm') {
'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml', withEnv([
'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml', 'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml',
'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin', 'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml',
'RBENV_VERSION=2.4.2', 'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
'TEST_SUITE=py3', 'RBENV_VERSION=2.4.2',
'TEST_PLATFORM=centos-7', 'TEST_SUITE=py3',
'PY_COLORS=1',]) 'TEST_PLATFORM=centos-7',
{ 'PY_COLORS=1',
stage('checkout-scm') { ]) {
cleanWs notFailBuild: true stage('checkout-scm') {
checkout scm cleanWs notFailBuild: true
} checkout scm
try {
stage('github-pending') {
githubNotify credentialsId: 'test-jenkins-credentials',
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
status: 'PENDING',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
}
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
} }
try { try {
stage('run kitchen') { stage('github-pending') {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { githubNotify credentialsId: 'test-jenkins-credentials',
sshagent(credentials: ['jenkins-testing-ssh-key']) { description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
sh 'ssh-add ~/.ssh/jenkins-testing.pem' status: 'PENDING',
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM' context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM' }
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
}
try {
stage('run kitchen') {
withCredentials([
[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
]) {
sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
}
} }
} }
} } finally {
} stage('cleanup kitchen') {
finally { script {
stage('cleanup kitchen') { withCredentials([
script { withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
sshagent(credentials: ['jenkins-testing-ssh-key']) { ]) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem' sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM' sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM'
}
}
} }
}} archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml'
archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml' archiveArtifacts artifacts: 'artifacts/logs/minion'
archiveArtifacts artifacts: 'artifacts/logs/minion' archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log'
archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log' }
} }
} } finally {
} try {
finally { junit 'artifacts/xml-unittests-output/*.xml'
try { } finally {
junit 'artifacts/xml-unittests-output/*.xml' cleanWs notFailBuild: true
} def currentResult = currentBuild.result ?: 'SUCCESS'
finally { if (currentResult == 'SUCCESS') {
cleanWs notFailBuild: true githubNotify credentialsId: 'test-jenkins-credentials',
if (currentBuild.result == 'SUCCESS') { description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
githubNotify credentialsId: 'test-jenkins-credentials', status: 'SUCCESS',
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed", context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
status: 'SUCCESS', } else {
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}" githubNotify credentialsId: 'test-jenkins-credentials',
} description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
else { status: 'FAILURE',
githubNotify credentialsId: 'test-jenkins-credentials', context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed", }
status: 'FAILURE',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
} }
} }
} }

View File

@ -1,71 +1,76 @@
node('kitchen-slave') { timeout(time: 6, unit: 'HOURS') {
timestamps { node('kitchen-slave') {
ansiColor('xterm') { timestamps {
withEnv([ ansiColor('xterm') {
'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml', withEnv([
'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml', 'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml',
'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin', 'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml',
'RBENV_VERSION=2.4.2', 'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
'TEST_SUITE=py2', 'RBENV_VERSION=2.4.2',
'TEST_PLATFORM=ubuntu-1604', 'TEST_SUITE=py2',
'PY_COLORS=1',]) 'TEST_PLATFORM=ubuntu-1604',
{ 'PY_COLORS=1',
stage('checkout-scm') { ]) {
cleanWs notFailBuild: true stage('checkout-scm') {
checkout scm cleanWs notFailBuild: true
} checkout scm
try {
stage('github-pending') {
githubNotify credentialsId: 'test-jenkins-credentials',
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
status: 'PENDING',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
}
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
} }
try { try {
stage('run kitchen') { stage('github-pending') {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { githubNotify credentialsId: 'test-jenkins-credentials',
sshagent(credentials: ['jenkins-testing-ssh-key']) { description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
sh 'ssh-add ~/.ssh/jenkins-testing.pem' status: 'PENDING',
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM' context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM' }
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
}
try {
stage('run kitchen') {
withCredentials([
[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
]) {
sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
}
} }
} }
} } finally {
} stage('cleanup kitchen') {
finally { script {
stage('cleanup kitchen') { withCredentials([
script { withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
sshagent(credentials: ['jenkins-testing-ssh-key']) { ]) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem' sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM' sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM'
}
}
} }
}} archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml'
archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml' archiveArtifacts artifacts: 'artifacts/logs/minion'
archiveArtifacts artifacts: 'artifacts/logs/minion' archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log'
archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log' }
} }
} } finally {
} try {
finally { junit 'artifacts/xml-unittests-output/*.xml'
try { } finally {
junit 'artifacts/xml-unittests-output/*.xml' cleanWs notFailBuild: true
} def currentResult = currentBuild.result ?: 'SUCCESS'
finally { if ( currentResult == 'SUCCESS') {
cleanWs notFailBuild: true githubNotify credentialsId: 'test-jenkins-credentials',
if (currentBuild.result == 'SUCCESS') { description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
githubNotify credentialsId: 'test-jenkins-credentials', status: 'SUCCESS',
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed", context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
status: 'SUCCESS', } else {
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}" githubNotify credentialsId: 'test-jenkins-credentials',
} description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
else { status: 'FAILURE',
githubNotify credentialsId: 'test-jenkins-credentials', context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed", }
status: 'FAILURE',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
} }
} }
} }

View File

@ -1,71 +1,76 @@
node('kitchen-slave') { timeout(time: 6, unit: 'HOURS') {
timestamps { node('kitchen-slave') {
ansiColor('xterm') { timestamps {
withEnv([ ansiColor('xterm') {
'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml', withEnv([
'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml', 'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml',
'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin', 'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml',
'RBENV_VERSION=2.4.2', 'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
'TEST_SUITE=py3', 'RBENV_VERSION=2.4.2',
'TEST_PLATFORM=ubuntu-1604', 'TEST_SUITE=py3',
'PY_COLORS=1',]) 'TEST_PLATFORM=ubuntu-1604',
{ 'PY_COLORS=1',
stage('checkout-scm') { ]) {
cleanWs notFailBuild: true stage('checkout-scm') {
checkout scm cleanWs notFailBuild: true
} checkout scm
try {
stage('github-pending') {
githubNotify credentialsId: 'test-jenkins-credentials',
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
status: 'PENDING',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
}
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
} }
try { try {
stage('run kitchen') { stage('github-pending') {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { githubNotify credentialsId: 'test-jenkins-credentials',
sshagent(credentials: ['jenkins-testing-ssh-key']) { description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
sh 'ssh-add ~/.ssh/jenkins-testing.pem' status: 'PENDING',
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM' context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM' }
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
}
try {
stage('run kitchen') {
withCredentials([
[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
]) {
sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
}
} }
} }
} } finally {
} stage('cleanup kitchen') {
finally { script {
stage('cleanup kitchen') { withCredentials([
script { withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
sshagent(credentials: ['jenkins-testing-ssh-key']) { ]) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem' sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM' sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM'
}
}
} }
}} archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml'
archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml' archiveArtifacts artifacts: 'artifacts/logs/minion'
archiveArtifacts artifacts: 'artifacts/logs/minion' archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log'
archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log' }
} }
} } finally {
} try {
finally { junit 'artifacts/xml-unittests-output/*.xml'
try { } finally {
junit 'artifacts/xml-unittests-output/*.xml' cleanWs notFailBuild: true
} def currentResult = currentBuild.result ?: 'SUCCESS'
finally { if (currentResult == 'SUCCESS') {
cleanWs notFailBuild: true githubNotify credentialsId: 'test-jenkins-credentials',
if (currentBuild.result == 'SUCCESS') { description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
githubNotify credentialsId: 'test-jenkins-credentials', status: 'SUCCESS',
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed", context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
status: 'SUCCESS', } else {
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}" githubNotify credentialsId: 'test-jenkins-credentials',
} description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
else { status: 'FAILURE',
githubNotify credentialsId: 'test-jenkins-credentials', context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed", }
status: 'FAILURE',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
} }
} }
} }

View File

@ -1,71 +1,76 @@
node('kitchen-slave') { timeout(time: 6, unit: 'HOURS') {
timestamps { node('kitchen-slave') {
ansiColor('xterm') { timestamps {
withEnv([ ansiColor('xterm') {
'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml', withEnv([
'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml', 'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml',
'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin', 'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml',
'RBENV_VERSION=2.4.2', 'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
'TEST_SUITE=py2', 'RBENV_VERSION=2.4.2',
'TEST_PLATFORM=windows-2016', 'TEST_SUITE=py2',
'PY_COLORS=1',]) 'TEST_PLATFORM=windows-2016',
{ 'PY_COLORS=1',
stage('checkout-scm') { ]) {
cleanWs notFailBuild: true stage('checkout-scm') {
checkout scm cleanWs notFailBuild: true
} checkout scm
try {
stage('github-pending') {
githubNotify credentialsId: 'test-jenkins-credentials',
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
status: 'PENDING',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
}
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
} }
try { try {
stage('run kitchen') { stage('github-pending') {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { githubNotify credentialsId: 'test-jenkins-credentials',
sshagent(credentials: ['jenkins-testing-ssh-key']) { description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
sh 'ssh-add ~/.ssh/jenkins-testing.pem' status: 'PENDING',
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM' context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM' }
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
}
try {
stage('run kitchen') {
withCredentials([
[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
]) {
sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
}
} }
} }
} } finally {
} stage('cleanup kitchen') {
finally { script {
stage('cleanup kitchen') { withCredentials([
script { withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
sshagent(credentials: ['jenkins-testing-ssh-key']) { ]) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem' sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM' sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM'
}
}
} }
}} archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml'
archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml' archiveArtifacts artifacts: 'artifacts/logs/minion'
archiveArtifacts artifacts: 'artifacts/logs/minion' archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log'
archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log' }
} }
} } finally {
} try {
finally { junit 'artifacts/xml-unittests-output/*.xml'
try { } finally {
junit 'artifacts/xml-unittests-output/*.xml' cleanWs notFailBuild: true
} def currentResult = currentBuild.result ?: 'SUCCESS'
finally { if (currentResult == 'SUCCESS') {
cleanWs notFailBuild: true githubNotify credentialsId: 'test-jenkins-credentials',
if (currentBuild.result == 'SUCCESS') { description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
githubNotify credentialsId: 'test-jenkins-credentials', status: 'SUCCESS',
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed", context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
status: 'SUCCESS', } else {
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}" githubNotify credentialsId: 'test-jenkins-credentials',
} description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
else { status: 'FAILURE',
githubNotify credentialsId: 'test-jenkins-credentials', context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed", }
status: 'FAILURE',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
} }
} }
} }

View File

@ -1,71 +1,76 @@
node('kitchen-slave') { timeout(time: 6, unit: 'HOURS') {
timestamps { node('kitchen-slave') {
ansiColor('xterm') { timestamps {
withEnv([ ansiColor('xterm') {
'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml', withEnv([
'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml', 'SALT_KITCHEN_PLATFORMS=/var/jenkins/workspace/platforms.yml',
'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin', 'SALT_KITCHEN_DRIVER=/var/jenkins/workspace/driver.yml',
'RBENV_VERSION=2.4.2', 'PATH=/usr/local/rbenv/shims/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
'TEST_SUITE=py3', 'RBENV_VERSION=2.4.2',
'TEST_PLATFORM=windows-2016', 'TEST_SUITE=py3',
'PY_COLORS=1',]) 'TEST_PLATFORM=windows-2016',
{ 'PY_COLORS=1',
stage('checkout-scm') { ]) {
cleanWs notFailBuild: true stage('checkout-scm') {
checkout scm cleanWs notFailBuild: true
} checkout scm
try {
stage('github-pending') {
githubNotify credentialsId: 'test-jenkins-credentials',
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
status: 'PENDING',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
}
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
} }
try { try {
stage('run kitchen') { stage('github-pending') {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { githubNotify credentialsId: 'test-jenkins-credentials',
sshagent(credentials: ['jenkins-testing-ssh-key']) { description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
sh 'ssh-add ~/.ssh/jenkins-testing.pem' status: 'PENDING',
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM' context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM' }
stage('setup-bundle') {
sh 'bundle install --with ec2 windows --without opennebula docker'
}
try {
stage('run kitchen') {
withCredentials([
[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
]) {
sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM || bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
}
} }
} }
} } finally {
} stage('cleanup kitchen') {
finally { script {
stage('cleanup kitchen') { withCredentials([
script { withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) { [$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']
sshagent(credentials: ['jenkins-testing-ssh-key']) { ]) {
sh 'ssh-add ~/.ssh/jenkins-testing.pem' sshagent(credentials: ['jenkins-testing-ssh-key']) {
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM' sh 'ssh-add ~/.ssh/jenkins-testing.pem'
sh 'bundle exec kitchen destroy $TEST_SUITE-$TEST_PLATFORM'
}
}
} }
}} archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml'
archiveArtifacts artifacts: 'artifacts/xml-unittests-output/*.xml' archiveArtifacts artifacts: 'artifacts/logs/minion'
archiveArtifacts artifacts: 'artifacts/logs/minion' archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log'
archiveArtifacts artifacts: 'artifacts/logs/salt-runtests.log' }
} }
} } finally {
} try {
finally { junit 'artifacts/xml-unittests-output/*.xml'
try { } finally {
junit 'artifacts/xml-unittests-output/*.xml' cleanWs notFailBuild: true
} def currentResult = currentBuild.result ?: 'SUCCESS'
finally { if (currentResult == 'SUCCESS') {
cleanWs notFailBuild: true githubNotify credentialsId: 'test-jenkins-credentials',
if (currentBuild.result == 'SUCCESS') { description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
githubNotify credentialsId: 'test-jenkins-credentials', status: 'SUCCESS',
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed", context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
status: 'SUCCESS', } else {
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}" githubNotify credentialsId: 'test-jenkins-credentials',
} description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
else { status: 'FAILURE',
githubNotify credentialsId: 'test-jenkins-credentials', context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed", }
status: 'FAILURE',
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
} }
} }
} }

View File

@ -3,6 +3,7 @@ pipeline {
options { options {
timestamps() timestamps()
ansiColor('xterm') ansiColor('xterm')
timeout(time: 1, unit: 'HOURS')
} }
environment { environment {
PYENV_ROOT = "/usr/local/pyenv" PYENV_ROOT = "/usr/local/pyenv"