Merge branch 'feature/17809'

This commit is contained in:
Manuele Simi 2019-10-23 23:09:33 -04:00
commit 27ad388814
2 changed files with 17 additions and 3 deletions

17
Jenkinsfile vendored
View File

@ -80,6 +80,7 @@ pipeline {
REMOVE_LOCAL_REPO = "${params.cleanup_local_repo}" REMOVE_LOCAL_REPO = "${params.cleanup_local_repo}"
GCUBE_RELEASE_NUMBER = "${params.gCube_release_version}" GCUBE_RELEASE_NUMBER = "${params.gCube_release_version}"
PIPELINE_BUILD_NUMBER = "${env.BUILD_NUMBER}" PIPELINE_BUILD_NUMBER = "${env.BUILD_NUMBER}"
TYPE = "${params.Type}"
} }
// see https://jenkins.io/doc/book/pipeline/syntax/#parameters // see https://jenkins.io/doc/book/pipeline/syntax/#parameters
@ -120,6 +121,11 @@ pipeline {
mv "${AGENT_ROOT_FOLDER}/settings.xml" "${AGENT_ROOT_FOLDER}/settings.${PIPELINE_BUILD_NUMBER}" mv "${AGENT_ROOT_FOLDER}/settings.xml" "${AGENT_ROOT_FOLDER}/settings.${PIPELINE_BUILD_NUMBER}"
cp "${AGENT_ROOT_FOLDER}/${MAVEN_SETTINGS_FILE}" "${AGENT_ROOT_FOLDER}/settings.xml" cp "${AGENT_ROOT_FOLDER}/${MAVEN_SETTINGS_FILE}" "${AGENT_ROOT_FOLDER}/settings.xml"
echo "Done with local repository and settings" echo "Done with local repository and settings"
echo "#Build ${PIPELINE_BUILD_NUMBER}" > ${AGENT_ROOT_FOLDER}/build_commits.csv
echo "#Release ${GCUBE_RELEASE_NUMBER}" >> ${AGENT_ROOT_FOLDER}/build_commits.csv
date=`date`
echo "#StartTime ${date}" >> ${AGENT_ROOT_FOLDER}/build_commits.csv
echo -e "GroupID,ArtifactID,Version,SCM URL,Branch,Build Number,Distribution URL,Filename" >> ${AGENT_ROOT_FOLDER}/build_commits.csv
''' '''
} }
} }
@ -242,6 +248,8 @@ pipeline {
script { script {
sh ''' sh '''
mv "${AGENT_ROOT_FOLDER}/settings.${PIPELINE_BUILD_NUMBER}" "${AGENT_ROOT_FOLDER}/settings.xml" mv "${AGENT_ROOT_FOLDER}/settings.${PIPELINE_BUILD_NUMBER}" "${AGENT_ROOT_FOLDER}/settings.xml"
mv ${AGENT_ROOT_FOLDER}/build_commits.csv ${AGENT_ROOT_FOLDER}/build_commits.${PIPELINE_BUILD_NUMBER}.csv
cp ${AGENT_ROOT_FOLDER}/build_commits.${PIPELINE_BUILD_NUMBER}.csv .
''' '''
} }
echo 'The default maven settings have been restored' echo 'The default maven settings have been restored'
@ -249,13 +257,18 @@ pipeline {
} }
success { success {
echo 'The pipeline worked!' echo 'The pipeline worked!'
mail to: 'jenkinsbuilds@d4science.org', emailext to: 'jenkinsbuilds@d4science.org',
subject: "[Jenkins build D4S] build ${currentBuild.fullDisplayName} worked", subject: "[Jenkins build D4S] build ${currentBuild.fullDisplayName} worked",
body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}" body: "Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
emailext attachmentsPattern: "**/*.${PIPELINE_BUILD_NUMBER}.csv",
to: 'jenkinsreleases@d4science.org',
subject: "${TYPE} report for release ${GCUBE_RELEASE_NUMBER} (build #${PIPELINE_BUILD_NUMBER})",
body: "${currentBuild.fullDisplayName}. Build time: ${currentBuild.durationString}. See ${env.BUILD_URL}"
} }
failure { failure {
echo 'The pipeline has failed' echo 'The pipeline has failed'
mail to: 'jenkinsbuilds@d4science.org', emailext attachLog: true,
to: 'jenkinsbuilds@d4science.org',
subject: "[Jenkins build D4S] build ${currentBuild.fullDisplayName} failed", subject: "[Jenkins build D4S] build ${currentBuild.fullDisplayName} failed",
body: "Something is wrong with ${env.BUILD_URL}" body: "Something is wrong with ${env.BUILD_URL}"
} }

View File

@ -8,7 +8,8 @@ Jenkins Pipeline script to manage a complete gCube release.
* [Pipeline: Maven](https://plugins.jenkins.io/pipeline-maven) * [Pipeline: Maven](https://plugins.jenkins.io/pipeline-maven)
* [Pipeline: Basic Steps](https://plugins.jenkins.io/workflow-basic-steps) * [Pipeline: Basic Steps](https://plugins.jenkins.io/workflow-basic-steps)
* [Kubernetes](https://plugins.jenkins.io/kubernetes) (for the YAML parser) * [Kubernetes](https://plugins.jenkins.io/kubernetes) (for the YAML parser)
* [NodeLabelParameter](https://plugins.jenkins.io/nodelabelparameter) (The node and label parameter plugin allows to dynamically select the node on which a job should be executed.) * [NodeLabelParameter](https://plugins.jenkins.io/nodelabelparameter) (to allow to dynamically select the node on which a job should be executed)
* [Email Extension](https://plugins.jenkins.io/email-ext) (to send emails with attachments)
* Jenkins configured with a JDK global tool named 'OpenJDK 8' * Jenkins configured with a JDK global tool named 'OpenJDK 8'
* Jenkins configured with a Maven global tool named 'Maven 3.6.2' * Jenkins configured with a Maven global tool named 'Maven 3.6.2'
* One or more Jenkins agents labeled as 'CD' * One or more Jenkins agents labeled as 'CD'