Files
QVolution2019.2/AoM_Service/.jenkins/JenkinsFile
2021-09-12 22:16:11 -06:00

68 lines
2.5 KiB
Groovy
Executable File

#!/usr/bin/env groovy
pipeline {
agent {label 'nomad-builder'}
environment {
DOCKER_HOST = '127.0.0.1:2375'
WORKSPACE_PATH = "/var/lib/nomad/alloc/${NOMAD_ALLOC_ID}/${NOMAD_TASK_NAME}${WORKSPACE}"
}
stages {
stage('Info') {
steps {
sh script: 'hostname'
echo "WORKSPACE_PATH: $WORKSPACE_PATH"
}
}
stage('Build') {
steps {
echo "No build required"
}
}
stage('Test') {
steps {
echo "Test done during merge request"
//sh script: 'cd build; ./test_changed.sh "${WORKSPACE_PATH}"'
}
}
stage('Deploy') {
steps {
script {
if ("$GIT_BRANCH" == "origin/master"){
echo "Running publish script"
sh script: './publish.sh'
echo "Triggering Rundeck job"
script {
step([$class: 'RundeckNotifier', includeRundeckLogs: true, jobId: 'c5323400-0d97-4488-8cf2-1d736a5f7fb9', nodeFilters: '', options: '', rundeckInstance: 'team-rundeck -- techops', shouldFailTheBuild: true, shouldWaitForRundeckJob: true, tags: '', tailLog: false])
}
}
else {
echo "No deploy step required."
}
}
}
}
}
post {
success {
gitlabCommitStatus(name: "$JOB_NAME") {
// Test passed, update commit with green checkbox
}
// Notify Eng Viz of successful build
// slackSend color: 'good', message: "Passed Build: $BUILD_URL", channel: '#eng-invisibility'
}
failure {
gitlabCommitStatus(name: "$JOB_NAME") {
// Test failed, update commit status with red x
error("Build failed, check ${BUILD_URL} for details.")
}
// On failure send an email to Eng Vis
mail body: 'Please check ${BUILD_URL} or details.',
subject: 'Jenkins job ${JOB_NAME} build #${BUILD_NUMBER} failed',
from: 'Jenkins',
to: 'eng-visibility@qualtrics.com'
// Finally send a warning message to Eng Vis slack channel
slackSend color: 'warn', message: 'Failed Build: $BUILD_URL', channel: '#eng-invisibility'
}
}
}