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

59 lines
2.1 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 "Building AOM container"
sh script: 'docker build . -t aom_test_container'
}
}
stage('Test') {
steps {
echo "Launching container on test mode. It will take a few minutes."
sh script: 'docker run -e TEST=true -h $(hostname) --add-host=\"telegraf:$(nslookup jenkins.eng.qops.net|grep Server | awk \'{print $2}\')\" aom_test_container'
echo "Removing docker image and container"
sh script: 'docker rmi -f aom_test_container'
}
}
stage('Deploy') {
steps {
echo "No deploy step required for Merge Request"
}
}
}
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'
}
}
}