12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- // Define the maximum time, in hours, that a test run should run for
- def global_timeout = 2
- def salt_target_branch = '2019.2'
- properties([
- buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')),
- ])
- def shell_header
- node('docs') {
- timeout(time: global_timeout, unit: 'HOURS') {
- ansiColor('xterm') {
- timestamps {
- try {
- // Set the GH status even before cloning the repo
- if (env.NODE_NAME.startsWith('jenkins-pr-')) {
- stage('github-pending') {
- githubNotify credentialsId: 'test-jenkins-credentials',
- description: 'Testing docs...',
- status: 'PENDING',
- context: "jenkins/pr/docs"
- }
- shell_header = 'export PYENV_ROOT="/usr/local/pyenv"\nexport PATH="$PYENV_ROOT/bin:$PATH"'
- } else {
- shell_header = ''
- }
- // Checkout the repo
- stage('checkout-scm') {
- cleanWs notFailBuild: true
- checkout scm
- }
- // Setup the kitchen required bundle
- stage('Setup') {
- sh shell_header + '''
- eval "$(pyenv init -)"
- pyenv --version
- pyenv install --skip-existing 2.7.15
- pyenv shell 2.7.15
- python --version
- pip install tox
- '''
- }
- stage('Build') {
- sh shell_header + '''
- eval "$(pyenv init -)"
- pyenv shell 2.7.15
- tox -e docs
- '''
- }
- } catch (Exception e) {
- currentBuild.result = 'FAILURE'
- } finally {
- cleanWs notFailBuild: true
- if (currentBuild.resultIsBetterOrEqualTo('SUCCESS')) {
- if (env.NODE_NAME.startsWith('jenkins-pr-')) {
- githubNotify credentialsId: 'test-jenkins-credentials',
- description: 'The docs job has passed',
- status: 'SUCCESS',
- context: "jenkins/pr/docs"
- }
- } else {
- if (env.NODE_NAME.startsWith('jenkins-pr-')) {
- githubNotify credentialsId: 'test-jenkins-credentials',
- description: 'The docs job has failed',
- status: 'FAILURE',
- context: "jenkins/pr/docs"
- }
- try {
- slackSend channel: "#jenkins-prod-pr",
- color: '#FF0000',
- message: "FAILED: PR-Job: '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
- } catch (Exception e) {
- sh 'echo Failed to send the Slack notification'
- }
- }
- }
- }
- }
- }
- }
- // vim: ft=groovy
|