Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 1.61 KB | None | 0 0
  1. #!groovy
  2. pipeline {
  3.     agent {
  4.         label 'master'
  5.     }
  6.  
  7.     options {
  8.         gitLabConnection('my_gitlab_connection')
  9.         gitlabCommitStatus(name: 'jenkins')
  10.         //gitlabBuilds(builds: ['checkout', 'mvn:compile', 'mvn:install'])
  11.         // Keep the 20 most recent builds
  12.         buildDiscarder(logRotator(numToKeepStr:'20'))
  13.     }
  14.  
  15.     triggers {
  16.         gitlab (triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
  17.     }
  18.  
  19.     tools {
  20.         maven "Maven-3.3.9"
  21.         jdk "JDK8"
  22.     }
  23.  
  24.     stages {
  25.         stage ('mvn:compile') {
  26.             steps {
  27.                 sh 'echo "path: ${PATH}"'
  28.                 sh 'echo "M2_HOME: ${M2_HOME}"'
  29.                 sh 'rm -rf M2REPO'
  30.                 sh 'mvn -U -B -s /opt/jenkins/settings.xml compile'
  31.             }
  32.         }
  33.         stage ('mvn:install') {
  34.             when {
  35.                 not {
  36.                     branch "main_branch"
  37.                 }
  38.             }
  39.             steps {
  40.                 sh 'mvn -U -B -s /opt/jenkins/settings.xml install -P ui,deb'
  41.             }
  42.             post {
  43.                 always {
  44.                     archive includes: '**/target/*.jar,**/target/feature/feature.xml', excludes: '**/target/*-sources.jar,**/target/*-javadoc.jar'
  45.                     junit '**/target/surefire-reports/TEST*.xml'
  46.                 }
  47.             }
  48.         }
  49.         stage ('mvn:deploy') {
  50.             when {
  51.                 branch "main_branch"
  52.             }
  53.             steps {
  54.                 sh 'mvn -U -B -s /opt/jenkins/settings.xml deploy -P ui,deb'
  55.             }
  56.             post {
  57.                 always {
  58.                     archive includes: '**/target/*.jar,**/target/feature/feature.xml', excludes: '**/target/*-sources.jar,**/target/*-javadoc.jar'
  59.                     junit '**/target/surefire-reports/TEST*.xml'
  60.                 }
  61.             }
  62.         }
  63.         stage ('upload packages to testing repo') {
  64.             when {
  65.                 branch "main_branch"
  66.             }
  67.             steps {
  68.                 sh 'sh deploy/deb-repo/upload2testing.sh'
  69.             }
  70.         }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement