feature/integrate-jenkins-code-coverage #3
Vendored
+28
-8
@@ -1,10 +1,5 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent none
|
||||||
docker {
|
|
||||||
image 'lifemaps/ci-cpp:latest'
|
|
||||||
reuseNode true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options {
|
options {
|
||||||
timestamps()
|
timestamps()
|
||||||
@@ -19,14 +14,38 @@ pipeline {
|
|||||||
QT_QPA_PLATFORM = "offscreen"
|
QT_QPA_PLATFORM = "offscreen"
|
||||||
LANG = "C.UTF-8"
|
LANG = "C.UTF-8"
|
||||||
LC_ALL = "C.UTF-8"
|
LC_ALL = "C.UTF-8"
|
||||||
|
DOCKER_IMAGE = "lifemaps/ci-cpp:latest"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Docker Image') {
|
||||||
|
agent { label 'any' }
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
echo "Checking if Docker image exists locally..."
|
||||||
|
def imageExists = sh(script: "docker inspect ${DOCKER_IMAGE} >/dev/null 2>&1", returnStatus: true) == 0
|
||||||
|
if (!imageExists) {
|
||||||
|
echo "Docker image not found. Building from ci/Dockerfile.ci..."
|
||||||
|
sh 'docker build -t ${DOCKER_IMAGE} -f ci/Dockerfile.ci .'
|
||||||
|
} else {
|
||||||
|
echo "Docker image ${DOCKER_IMAGE} found locally."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build and Test') {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'lifemaps/ci-cpp:latest'
|
||||||
|
reuseNode true
|
||||||
|
}
|
||||||
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Cleanup') {
|
stage('Cleanup') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
echo "Cleaning workspace to avoid corruption issues..."
|
echo "Cleaning workspace to avoid corruption issues..."
|
||||||
// Use shell command with chmod to handle permission issues
|
|
||||||
sh '''
|
sh '''
|
||||||
if [ -d "${WORKSPACE}/${BUILD_DIR}" ]; then
|
if [ -d "${WORKSPACE}/${BUILD_DIR}" ]; then
|
||||||
echo "Removing build directory with permission fix..."
|
echo "Removing build directory with permission fix..."
|
||||||
@@ -124,12 +143,13 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
script {
|
script {
|
||||||
if (getContext(hudson.FilePath)) {
|
if (getContext(hudson.FilePath)) {
|
||||||
// Use shell command with chmod to handle permission issues
|
|
||||||
sh '''
|
sh '''
|
||||||
if [ -d "${WORKSPACE}/${BUILD_DIR}" ]; then
|
if [ -d "${WORKSPACE}/${BUILD_DIR}" ]; then
|
||||||
echo "Final cleanup: Removing build directory..."
|
echo "Final cleanup: Removing build directory..."
|
||||||
|
|||||||
Reference in new issue
Block a user