Jenkinsfile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. node {
  2. try
  3. {
  4. // Mark the code checkout 'stage'....
  5. stage 'Checkout'
  6. checkout scm
  7. sh 'git submodule update --init --recursive'
  8. stage ('Clean'){
  9. withMaven(mavenLocalRepo: '.repository', mavenSettingsFilePath: "${env.MVN_SETTINGS_PATH}") {
  10. // Run the maven build
  11. sh "mvn clean -Dtycho.mode=maven -fn -f DSL_SemanticAdaptation/pom.xml"
  12. }}
  13. stage ('Package install'){
  14. withMaven(mavenLocalRepo: '.repository', mavenSettingsFilePath: "${env.MVN_SETTINGS_PATH}") {
  15. // Run the maven build
  16. sh "mvn install -f DSL_SemanticAdaptation/pom.xml"
  17. step([$class: 'ArtifactArchiver', artifacts: '**/target/*.jar', fingerprint: true])
  18. step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
  19. // step([$class: 'JacocoPublisher'])
  20. step([$class: 'TasksPublisher', canComputeNew: false, defaultEncoding: '', excludePattern: '', healthy: '', high: 'FIXME', ignoreCase: true, low: '', normal: 'TODO', pattern: '', unHealthy: ''])
  21. }}
  22. stage ('Deploy'){
  23. if (env.BRANCH_NAME == 'development') {
  24. sh "echo branch is now ${env.BRANCH_NAME}"
  25. DEST = sh script: "echo /home/jenkins/web/hybridcosimulation/development/${env.BRANCH_NAME}/Build-${BUILD_NUMBER}_`date +%Y-%m-%d_%H-%M`", returnStdout:true
  26. REMOTE = "jenkins@overture.au.dk"
  27. sh "echo The remote dir will be: ${DEST}"
  28. sh "ssh ${REMOTE} mkdir -p ${DEST}"
  29. sh "scp -r DSL_SemanticAdaptation/repository/target/repository/* ${REMOTE}:${DEST}"
  30. sh "ssh ${REMOTE} /home/jenkins/update-latest.sh web/hybridcosimulation/development/${env.BRANCH_NAME}"
  31. }
  32. }
  33. } catch (any) {
  34. currentBuild.result = 'FAILURE'
  35. throw any //rethrow exception to prevent the build from proceeding
  36. } finally {
  37. stage('Reporting'){
  38. // Notify on build failure using the Email-ext plugin
  39. emailext(body: '${DEFAULT_CONTENT}', mimeType: 'text/html',
  40. replyTo: '$DEFAULT_REPLYTO', subject: '${DEFAULT_SUBJECT}',
  41. to: emailextrecipients([[$class: 'CulpritsRecipientProvider'],
  42. [$class: 'RequesterRecipientProvider']]))
  43. }
  44. }
  45. }