Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!groovy
- pipeline {
- agent {
- label 'master'
- }
- options {
- gitLabConnection('my_gitlab_connection')
- gitlabCommitStatus(name: 'jenkins')
- //gitlabBuilds(builds: ['checkout', 'mvn:compile', 'mvn:install'])
- // Keep the 20 most recent builds
- buildDiscarder(logRotator(numToKeepStr:'20'))
- }
- triggers {
- gitlab (triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
- }
- tools {
- maven "Maven-3.3.9"
- jdk "JDK8"
- }
- stages {
- stage ('mvn:compile') {
- steps {
- sh 'echo "path: ${PATH}"'
- sh 'echo "M2_HOME: ${M2_HOME}"'
- sh 'rm -rf M2REPO'
- sh 'mvn -U -B -s /opt/jenkins/settings.xml compile'
- }
- }
- stage ('mvn:install') {
- when {
- not {
- branch "main_branch"
- }
- }
- steps {
- sh 'mvn -U -B -s /opt/jenkins/settings.xml install -P ui,deb'
- }
- post {
- always {
- archive includes: '**/target/*.jar,**/target/feature/feature.xml', excludes: '**/target/*-sources.jar,**/target/*-javadoc.jar'
- junit '**/target/surefire-reports/TEST*.xml'
- }
- }
- }
- stage ('mvn:deploy') {
- when {
- branch "main_branch"
- }
- steps {
- sh 'mvn -U -B -s /opt/jenkins/settings.xml deploy -P ui,deb'
- }
- post {
- always {
- archive includes: '**/target/*.jar,**/target/feature/feature.xml', excludes: '**/target/*-sources.jar,**/target/*-javadoc.jar'
- junit '**/target/surefire-reports/TEST*.xml'
- }
- }
- }
- stage ('upload packages to testing repo') {
- when {
- branch "main_branch"
- }
- steps {
- sh 'sh deploy/deb-repo/upload2testing.sh'
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement