Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ bin/
# Gradle build directory
build/

# Maven build directory
target/

# IntelliJ IDEA
*.iml

# Do not ignore .gitignore
!.gitignore
125 changes: 125 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
pipeline {
agent {
label 'gcloud-build--rocky-linux-8--x64'
}

options {
buildDiscarder(logRotator(numToKeepStr: '10'))
timeout(time: 1, unit: 'HOURS')
timestamps()
disableConcurrentBuilds()
}

environment {
JAVA_HOME = '/opt/corretto_java17'
PATH = "${JAVA_HOME}/bin:${env.PATH}"
VOLTDB_IMAGE = "${params.VOLTDB_IMAGE ?: 'voltdb/voltdb-enterprise:15.1.0'}"
}

parameters {
string(
name: 'VOLTDB_IMAGE',
defaultValue: 'voltdb/voltdb-enterprise:15.1.0',
description: 'VoltDB Docker image to use for integration tests'
)
booleanParam(
name: 'SKIP_INTEGRATION_TESTS',
defaultValue: false,
description: 'Skip integration tests'
)
}

stages {
stage('Checkout') {
steps {
checkout scm
}
}

stage('Build') {
steps {
sh 'mvn clean compile test-compile -DskipTests'
}
}

stage('Unit Tests') {
steps {
sh 'mvn test'
}
post {
always {
junit testResults: '**/target/surefire-reports/*.xml', allowEmptyResults: true
}
}
}

stage('Package') {
steps {
sh 'mvn package -DskipTests'
}
post {
success {
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true, allowEmptyArchive: true
}
}
}

stage('Integration Tests') {
when {
expression { return !params.SKIP_INTEGRATION_TESTS }
}
steps {
withCredentials([
usernamePassword(credentialsId: 'dockerhub', usernameVariable: 'DOCKER_CREDS_USR', passwordVariable: 'DOCKER_CREDS_PSW'),
string(credentialsId: 'VOLTDB_LICENSE1', variable: 'VOLTDB_LICENSE_CONTENT')
]) {
sh '''
# Login to Docker Hub
echo "${DOCKER_CREDS_PSW}" | docker login -u "${DOCKER_CREDS_USR}" --password-stdin

# Ensure Docker is available
docker info

# Pull VoltDB image
echo "Using VoltDB image: ${VOLTDB_IMAGE}"
docker pull ${VOLTDB_IMAGE}

# Write license to file (decode base64)
echo "${VOLTDB_LICENSE_CONTENT}" | base64 -d > license.xml
'''

// Run integration tests with license
sh '''
export PATH="${JAVA_HOME}/bin:${PATH}"
export VOLTDB_LICENSE="${WORKSPACE}/license.xml"
mvn verify -DskipUTs
'''
}
}
post {
always {
junit testResults: '**/target/failsafe-reports/*.xml', allowEmptyResults: true
sh 'rm -f license.xml || true'
sh 'docker logout || true'
}
}
}
}

post {
always {
// Clean up Docker containers
sh '''
docker ps -q --filter "ancestor=${VOLTDB_IMAGE}" | xargs -r docker stop || true
docker container prune -f || true
'''
cleanWs()
}
success {
echo 'Build completed successfully!'
}
failure {
echo 'Build failed!'
}
}
}
80 changes: 0 additions & 80 deletions build.gradle

This file was deleted.

Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Loading