mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Update TCP pipelines
This commit is contained in:
parent
52f95568b1
commit
3daeb4f168
@ -7,23 +7,27 @@ def global_timeout = testrun_timeout + 1;
|
||||
def distro_name = 'centos'
|
||||
def distro_version = '7'
|
||||
def python_version = 'py2'
|
||||
def salt_target_branch = '2019.2.1'
|
||||
def golden_images_branch = '2019.2'
|
||||
|
||||
properties([
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')),
|
||||
[
|
||||
$class: 'ScannerJobProperty', doNotScan: false
|
||||
],
|
||||
[
|
||||
$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false
|
||||
],
|
||||
parameters([
|
||||
booleanParam(defaultValue: true, description: 'Run full test suite', name: 'runFull')
|
||||
])
|
||||
])
|
||||
|
||||
timeout(time: global_timeout, unit: 'HOURS') {
|
||||
// Be sure to cancel any previously running builds
|
||||
def buildNumber = env.BUILD_NUMBER as int
|
||||
if (buildNumber > 1) {
|
||||
// This will cancel the previous build which also defined a matching milestone
|
||||
milestone(buildNumber - 1)
|
||||
}
|
||||
// Define a milestone for this build so that, if another build starts, this one will be aborted
|
||||
milestone(buildNumber)
|
||||
|
||||
node('kitchen-slave') {
|
||||
timeout(time: global_timeout, unit: 'HOURS') {
|
||||
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding',
|
||||
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
|
||||
credentialsId: 'AWS_ACCESS_KEY_ID',
|
||||
@ -37,6 +41,7 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
'NOX_ENV_NAME=runtests-tcp',
|
||||
'NOX_ENABLE_FROM_FILENAMES=true',
|
||||
'NOX_PASSTHROUGH_OPTS=--ssh-tests',
|
||||
"SALT_TARGET_BRANCH=${salt_target_branch}",
|
||||
"GOLDEN_IMAGES_CI_BRANCH=${golden_images_branch}",
|
||||
"CODECOV_FLAGS=${distro_name}${distro_version},${python_version},tcp",
|
||||
'PATH=~/.rbenv/shims:/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
|
||||
@ -49,27 +54,27 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
stage('github-pending') {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "running ${TEST_SUITE}-${TEST_PLATFORM}-tcp...",
|
||||
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
|
||||
status: 'PENDING',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
}
|
||||
// Checkout the repo
|
||||
stage('checkout-scm') {
|
||||
cleanWs notFailBuild: true
|
||||
checkout scm
|
||||
sh 'git fetch --no-tags https://github.com/saltstack/salt.git +refs/heads/${SALT_TARGET_BRANCH}:refs/remotes/origin/${SALT_TARGET_BRANCH}'
|
||||
}
|
||||
|
||||
// Setup the kitchen required bundle
|
||||
stage('setup-bundle') {
|
||||
sh 'git fetch --no-tags https://github.com/saltstack/salt.git +refs/heads/${CHANGE_TARGET}:refs/remotes/origin/${CHANGE_TARGET}'
|
||||
sh 'bundle install --with ec2 windows --without docker macos opennebula vagrant'
|
||||
}
|
||||
|
||||
stage('Create VM') {
|
||||
retry(3) {
|
||||
sh '''
|
||||
t=$(shuf -i 1-15 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
t=$(shuf -i 30-120 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
bundle exec kitchen create $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"
|
||||
'''
|
||||
}
|
||||
@ -80,11 +85,11 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
try {
|
||||
timeout(time: testrun_timeout, unit: 'HOURS') {
|
||||
stage('Converge VM') {
|
||||
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
|
||||
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"'
|
||||
}
|
||||
stage('Run Tests') {
|
||||
withEnv(["DONT_DOWNLOAD_ARTEFACTS=1"]) {
|
||||
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
|
||||
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +102,7 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
'''
|
||||
}
|
||||
}
|
||||
archiveArtifacts artifacts: 'artifacts/*,artifacts/**/*'
|
||||
archiveArtifacts artifacts: 'artifacts/*,artifacts/**/*,.kitchen/logs/kitchen.log'
|
||||
junit 'artifacts/xml-unittests-output/*.xml'
|
||||
} finally {
|
||||
stage('Cleanup') {
|
||||
@ -126,21 +131,21 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM}-tcp job has passed",
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
|
||||
status: 'SUCCESS',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
} else {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM}-tcp job has failed",
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
|
||||
status: 'FAILURE',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
try {
|
||||
slackSend channel: "#jenkins-prod-pr",
|
||||
color: '#FF0000',
|
||||
message: "FAILED: PR-Job: '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
|
||||
message: "*${currentBuild.currentResult}*: ${currentBuild.getFullDisplayName()} (<${env.BUILD_URL}|open>)"
|
||||
} catch (Exception e) {
|
||||
sh 'echo Failed to send the Slack notification'
|
||||
}
|
||||
|
@ -7,23 +7,27 @@ def global_timeout = testrun_timeout + 1;
|
||||
def distro_name = 'centos'
|
||||
def distro_version = '7'
|
||||
def python_version = 'py3'
|
||||
def salt_target_branch = '2019.2.1'
|
||||
def golden_images_branch = '2019.2'
|
||||
|
||||
properties([
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')),
|
||||
[
|
||||
$class: 'ScannerJobProperty', doNotScan: false
|
||||
],
|
||||
[
|
||||
$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false
|
||||
],
|
||||
parameters([
|
||||
booleanParam(defaultValue: true, description: 'Run full test suite', name: 'runFull')
|
||||
])
|
||||
])
|
||||
|
||||
timeout(time: global_timeout, unit: 'HOURS') {
|
||||
// Be sure to cancel any previously running builds
|
||||
def buildNumber = env.BUILD_NUMBER as int
|
||||
if (buildNumber > 1) {
|
||||
// This will cancel the previous build which also defined a matching milestone
|
||||
milestone(buildNumber - 1)
|
||||
}
|
||||
// Define a milestone for this build so that, if another build starts, this one will be aborted
|
||||
milestone(buildNumber)
|
||||
|
||||
node('kitchen-slave') {
|
||||
timeout(time: global_timeout, unit: 'HOURS') {
|
||||
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding',
|
||||
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
|
||||
credentialsId: 'AWS_ACCESS_KEY_ID',
|
||||
@ -37,6 +41,7 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
'NOX_ENV_NAME=runtests-tcp',
|
||||
'NOX_ENABLE_FROM_FILENAMES=true',
|
||||
'NOX_PASSTHROUGH_OPTS=--ssh-tests',
|
||||
"SALT_TARGET_BRANCH=${salt_target_branch}",
|
||||
"GOLDEN_IMAGES_CI_BRANCH=${golden_images_branch}",
|
||||
"CODECOV_FLAGS=${distro_name}${distro_version},${python_version},tcp",
|
||||
'PATH=~/.rbenv/shims:/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
|
||||
@ -49,27 +54,27 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
stage('github-pending') {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "running ${TEST_SUITE}-${TEST_PLATFORM}-tcp...",
|
||||
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
|
||||
status: 'PENDING',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
}
|
||||
// Checkout the repo
|
||||
stage('checkout-scm') {
|
||||
cleanWs notFailBuild: true
|
||||
checkout scm
|
||||
sh 'git fetch --no-tags https://github.com/saltstack/salt.git +refs/heads/${SALT_TARGET_BRANCH}:refs/remotes/origin/${SALT_TARGET_BRANCH}'
|
||||
}
|
||||
|
||||
// Setup the kitchen required bundle
|
||||
stage('setup-bundle') {
|
||||
sh 'git fetch --no-tags https://github.com/saltstack/salt.git +refs/heads/${CHANGE_TARGET}:refs/remotes/origin/${CHANGE_TARGET}'
|
||||
sh 'bundle install --with ec2 windows --without docker macos opennebula vagrant'
|
||||
}
|
||||
|
||||
stage('Create VM') {
|
||||
retry(3) {
|
||||
sh '''
|
||||
t=$(shuf -i 1-15 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
t=$(shuf -i 30-120 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
bundle exec kitchen create $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"
|
||||
'''
|
||||
}
|
||||
@ -80,11 +85,11 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
try {
|
||||
timeout(time: testrun_timeout, unit: 'HOURS') {
|
||||
stage('Converge VM') {
|
||||
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
|
||||
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"'
|
||||
}
|
||||
stage('Run Tests') {
|
||||
withEnv(["DONT_DOWNLOAD_ARTEFACTS=1"]) {
|
||||
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
|
||||
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +102,7 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
'''
|
||||
}
|
||||
}
|
||||
archiveArtifacts artifacts: 'artifacts/*,artifacts/**/*'
|
||||
archiveArtifacts artifacts: 'artifacts/*,artifacts/**/*,.kitchen/logs/kitchen.log'
|
||||
junit 'artifacts/xml-unittests-output/*.xml'
|
||||
} finally {
|
||||
stage('Cleanup') {
|
||||
@ -126,21 +131,21 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM}-tcp job has passed",
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
|
||||
status: 'SUCCESS',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
} else {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM}-tcp job has failed",
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
|
||||
status: 'FAILURE',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
try {
|
||||
slackSend channel: "#jenkins-prod-pr",
|
||||
color: '#FF0000',
|
||||
message: "FAILED: PR-Job: '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
|
||||
message: "*${currentBuild.currentResult}*: ${currentBuild.getFullDisplayName()} (<${env.BUILD_URL}|open>)"
|
||||
} catch (Exception e) {
|
||||
sh 'echo Failed to send the Slack notification'
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//// Define the maximum time, in hours, that a test run should run for
|
||||
// Define the maximum time, in hours, that a test run should run for
|
||||
def testrun_timeout = 6
|
||||
// Now define a global pipeline timeout. This is the test run timeout with one(1) additional
|
||||
// hour to allow for artifacts to be downloaded, if possible.
|
||||
@ -7,23 +7,27 @@ def global_timeout = testrun_timeout + 1;
|
||||
def distro_name = 'ubuntu'
|
||||
def distro_version = '1604'
|
||||
def python_version = 'py2'
|
||||
def salt_target_branch = '2019.2.1'
|
||||
def golden_images_branch = '2019.2'
|
||||
|
||||
properties([
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')),
|
||||
[
|
||||
$class: 'ScannerJobProperty', doNotScan: false
|
||||
],
|
||||
[
|
||||
$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false
|
||||
],
|
||||
parameters([
|
||||
booleanParam(defaultValue: true, description: 'Run full test suite', name: 'runFull')
|
||||
])
|
||||
])
|
||||
|
||||
timeout(time: global_timeout, unit: 'HOURS') {
|
||||
// Be sure to cancel any previously running builds
|
||||
def buildNumber = env.BUILD_NUMBER as int
|
||||
if (buildNumber > 1) {
|
||||
// This will cancel the previous build which also defined a matching milestone
|
||||
milestone(buildNumber - 1)
|
||||
}
|
||||
// Define a milestone for this build so that, if another build starts, this one will be aborted
|
||||
milestone(buildNumber)
|
||||
|
||||
node('kitchen-slave') {
|
||||
timeout(time: global_timeout, unit: 'HOURS') {
|
||||
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding',
|
||||
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
|
||||
credentialsId: 'AWS_ACCESS_KEY_ID',
|
||||
@ -37,6 +41,7 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
'NOX_ENV_NAME=runtests-tcp',
|
||||
'NOX_ENABLE_FROM_FILENAMES=true',
|
||||
'NOX_PASSTHROUGH_OPTS=--ssh-tests',
|
||||
"SALT_TARGET_BRANCH=${salt_target_branch}",
|
||||
"GOLDEN_IMAGES_CI_BRANCH=${golden_images_branch}",
|
||||
"CODECOV_FLAGS=${distro_name}${distro_version},${python_version},tcp",
|
||||
'PATH=~/.rbenv/shims:/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
|
||||
@ -49,27 +54,27 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
stage('github-pending') {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "running ${TEST_SUITE}-${TEST_PLATFORM}-tcp...",
|
||||
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
|
||||
status: 'PENDING',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
}
|
||||
// Checkout the repo
|
||||
stage('checkout-scm') {
|
||||
cleanWs notFailBuild: true
|
||||
checkout scm
|
||||
sh 'git fetch --no-tags https://github.com/saltstack/salt.git +refs/heads/${SALT_TARGET_BRANCH}:refs/remotes/origin/${SALT_TARGET_BRANCH}'
|
||||
}
|
||||
|
||||
// Setup the kitchen required bundle
|
||||
stage('setup-bundle') {
|
||||
sh 'git fetch --no-tags https://github.com/saltstack/salt.git +refs/heads/${CHANGE_TARGET}:refs/remotes/origin/${CHANGE_TARGET}'
|
||||
sh 'bundle install --with ec2 windows --without docker macos opennebula vagrant'
|
||||
}
|
||||
|
||||
stage('Create VM') {
|
||||
retry(3) {
|
||||
sh '''
|
||||
t=$(shuf -i 1-15 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
t=$(shuf -i 30-120 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
bundle exec kitchen create $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"
|
||||
'''
|
||||
}
|
||||
@ -80,11 +85,11 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
try {
|
||||
timeout(time: testrun_timeout, unit: 'HOURS') {
|
||||
stage('Converge VM') {
|
||||
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
|
||||
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"'
|
||||
}
|
||||
stage('Run Tests') {
|
||||
withEnv(["DONT_DOWNLOAD_ARTEFACTS=1"]) {
|
||||
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
|
||||
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +102,7 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
'''
|
||||
}
|
||||
}
|
||||
archiveArtifacts artifacts: 'artifacts/*,artifacts/**/*'
|
||||
archiveArtifacts artifacts: 'artifacts/*,artifacts/**/*,.kitchen/logs/kitchen.log'
|
||||
junit 'artifacts/xml-unittests-output/*.xml'
|
||||
} finally {
|
||||
stage('Cleanup') {
|
||||
@ -126,21 +131,21 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM}-tcp job has passed",
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
|
||||
status: 'SUCCESS',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
} else {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM}-tcp job has failed",
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
|
||||
status: 'FAILURE',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
try {
|
||||
slackSend channel: "#jenkins-prod-pr",
|
||||
color: '#FF0000',
|
||||
message: "FAILED: PR-Job: '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
|
||||
message: "*${currentBuild.currentResult}*: ${currentBuild.getFullDisplayName()} (<${env.BUILD_URL}|open>)"
|
||||
} catch (Exception e) {
|
||||
sh 'echo Failed to send the Slack notification'
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
//// Define the maximum time, in hours, that a test run should run for
|
||||
// Define the maximum time, in hours, that a test run should run for
|
||||
def testrun_timeout = 6
|
||||
// Now define a global pipeline timeout. This is the test run timeout with one(1) additional
|
||||
// hour to allow for artifacts to be downloaded, if possible.
|
||||
@ -7,23 +7,27 @@ def global_timeout = testrun_timeout + 1;
|
||||
def distro_name = 'ubuntu'
|
||||
def distro_version = '1604'
|
||||
def python_version = 'py3'
|
||||
def salt_target_branch = '2019.2.1'
|
||||
def golden_images_branch = '2019.2'
|
||||
|
||||
properties([
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')),
|
||||
[
|
||||
$class: 'ScannerJobProperty', doNotScan: false
|
||||
],
|
||||
[
|
||||
$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false
|
||||
],
|
||||
parameters([
|
||||
booleanParam(defaultValue: true, description: 'Run full test suite', name: 'runFull')
|
||||
])
|
||||
])
|
||||
|
||||
timeout(time: global_timeout, unit: 'HOURS') {
|
||||
// Be sure to cancel any previously running builds
|
||||
def buildNumber = env.BUILD_NUMBER as int
|
||||
if (buildNumber > 1) {
|
||||
// This will cancel the previous build which also defined a matching milestone
|
||||
milestone(buildNumber - 1)
|
||||
}
|
||||
// Define a milestone for this build so that, if another build starts, this one will be aborted
|
||||
milestone(buildNumber)
|
||||
|
||||
node('kitchen-slave') {
|
||||
timeout(time: global_timeout, unit: 'HOURS') {
|
||||
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding',
|
||||
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
|
||||
credentialsId: 'AWS_ACCESS_KEY_ID',
|
||||
@ -37,6 +41,7 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
'NOX_ENV_NAME=runtests-tcp',
|
||||
'NOX_ENABLE_FROM_FILENAMES=true',
|
||||
'NOX_PASSTHROUGH_OPTS=--ssh-tests',
|
||||
"SALT_TARGET_BRANCH=${salt_target_branch}",
|
||||
"GOLDEN_IMAGES_CI_BRANCH=${golden_images_branch}",
|
||||
"CODECOV_FLAGS=${distro_name}${distro_version},${python_version},tcp",
|
||||
'PATH=~/.rbenv/shims:/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin',
|
||||
@ -49,27 +54,27 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
stage('github-pending') {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "running ${TEST_SUITE}-${TEST_PLATFORM}-tcp...",
|
||||
description: "running ${TEST_SUITE}-${TEST_PLATFORM}...",
|
||||
status: 'PENDING',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
}
|
||||
// Checkout the repo
|
||||
stage('checkout-scm') {
|
||||
cleanWs notFailBuild: true
|
||||
checkout scm
|
||||
sh 'git fetch --no-tags https://github.com/saltstack/salt.git +refs/heads/${SALT_TARGET_BRANCH}:refs/remotes/origin/${SALT_TARGET_BRANCH}'
|
||||
}
|
||||
|
||||
// Setup the kitchen required bundle
|
||||
stage('setup-bundle') {
|
||||
sh 'git fetch --no-tags https://github.com/saltstack/salt.git +refs/heads/${CHANGE_TARGET}:refs/remotes/origin/${CHANGE_TARGET}'
|
||||
sh 'bundle install --with ec2 windows --without docker macos opennebula vagrant'
|
||||
}
|
||||
|
||||
stage('Create VM') {
|
||||
retry(3) {
|
||||
sh '''
|
||||
t=$(shuf -i 1-15 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
t=$(shuf -i 30-120 -n 1); echo "Sleeping $t seconds"; sleep $t
|
||||
bundle exec kitchen create $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"
|
||||
'''
|
||||
}
|
||||
@ -80,11 +85,11 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
try {
|
||||
timeout(time: testrun_timeout, unit: 'HOURS') {
|
||||
stage('Converge VM') {
|
||||
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM'
|
||||
sh 'bundle exec kitchen converge $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"'
|
||||
}
|
||||
stage('Run Tests') {
|
||||
withEnv(["DONT_DOWNLOAD_ARTEFACTS=1"]) {
|
||||
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM'
|
||||
sh 'bundle exec kitchen verify $TEST_SUITE-$TEST_PLATFORM; echo "ExitCode: $?;"'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +102,7 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
'''
|
||||
}
|
||||
}
|
||||
archiveArtifacts artifacts: 'artifacts/*,artifacts/**/*'
|
||||
archiveArtifacts artifacts: 'artifacts/*,artifacts/**/*,.kitchen/logs/kitchen.log'
|
||||
junit 'artifacts/xml-unittests-output/*.xml'
|
||||
} finally {
|
||||
stage('Cleanup') {
|
||||
@ -126,21 +131,21 @@ timeout(time: global_timeout, unit: 'HOURS') {
|
||||
if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM}-tcp job has passed",
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has passed",
|
||||
status: 'SUCCESS',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
} else {
|
||||
if (env.NODE_NAME.startsWith('jenkins-pr-')) {
|
||||
githubNotify credentialsId: 'test-jenkins-credentials',
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM}-tcp job has failed",
|
||||
description: "The ${TEST_SUITE}-${TEST_PLATFORM} job has failed",
|
||||
status: 'FAILURE',
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}-tcp"
|
||||
context: "jenkins/pr/${TEST_SUITE}-${TEST_PLATFORM}"
|
||||
}
|
||||
try {
|
||||
slackSend channel: "#jenkins-prod-pr",
|
||||
color: '#FF0000',
|
||||
message: "FAILED: PR-Job: '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
|
||||
message: "*${currentBuild.currentResult}*: ${currentBuild.getFullDisplayName()} (<${env.BUILD_URL}|open>)"
|
||||
} catch (Exception e) {
|
||||
sh 'echo Failed to send the Slack notification'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user