gCubeBuild-AlternateJdk/Jenkinsfile

66 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-09-20 12:22:01 +02:00
// REMEMBER TO FILL THE environment section with your values.
// the following filed should be filled: imagename, git_url
// REMEMBER to put your Dockerfile in the root folder of your project
// The related jenkinsjob template is here:
pipeline {
2022-09-20 12:29:59 +02:00
agent { label 'CI'}
tools {
maven 'Maven 3-6-2'
jdk 'OpenJDK 8'
2022-09-20 12:22:01 +02:00
}
2022-09-20 12:29:59 +02:00
environment {
JAVA_HOME='/usr/lib/jvm/java-8-openjdk-amd64'
GIT_URL= "${params.GIT_URL}"
GIT_BRANCH= "${params.GIT_BRANCH}"
2022-09-20 12:22:01 +02:00
}
2022-09-20 12:29:59 +02:00
parameters {
string(name: 'GIT_URL',
defaultValue: '',
description: 'git url')
string(name: 'GIT_BRANCH',
defaultValue: '',
description: 'git branch')
}
stages {
stage('Checkout git project') {
steps {
2022-09-20 14:44:09 +02:00
echo " env GIT_URL: ${env.GIT_URL}"
echo " env GIT_BRANCH: ${env.GIT_URL}"
2022-09-20 14:46:14 +02:00
echo " param GIT_URL: ${params.GIT_URL}"
2022-09-20 14:44:09 +02:00
echo " GIT_URL: ${GIT_URL}"
git branch: "${GIT_BRANCH}", credentialsId: '88b54962-1c0e-49cb-8155-22276860f346', url: "${GIT_URL}"
2022-09-20 12:29:59 +02:00
}
}
stage('Build the job') {
steps {
sh 'mvn --settings $MAVEN_CONFIG_FOLDER/$gcube_settings -Dmaven.repo.local=$MAVEN_CONFIG_FOLDER/$local_repo $build_options dependency:tree clean deploy'
}
2022-09-20 12:22:01 +02:00
}
2022-09-20 14:14:56 +02:00
2022-09-20 14:15:50 +02:00
stage('Clean') {
steps{
sh "mvn clean"
2022-09-20 12:22:01 +02:00
2022-09-20 14:15:50 +02:00
}
}
2022-09-20 12:22:01 +02:00
}
// post-build actions
post {
success {
2022-09-20 12:29:59 +02:00
echo 'The gCubeBuild pipeline worked!'
emailext to: 'roberto.cirillo@isti.cnr.it',
subject: "[Jenkins gCubeBuild Pipeline] build ${currentBuild.fullDisplayName} worked",
2022-09-20 12:22:01 +02:00
body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
}
failure {
2022-09-20 12:29:59 +02:00
echo 'The gCubeBuild pipeline has failed'
2022-09-20 12:22:01 +02:00
emailext attachLog: true,
2022-09-20 12:29:59 +02:00
to: 'roberto.cirillo@isti.cnr.it',
2022-09-20 14:28:30 +02:00
subject: "[Jenkins DockerPipeline D4S] build ${currentBuild.fullDisplayName} failed",
2022-09-20 12:22:01 +02:00
body: "Something is wrong with ${env.BUILD_URL}"
}
}
}