pipeline { agent any options { buildDiscarder(logRotator(numToKeepStr:'15')) disableConcurrentBuilds() timeout(time: 60, unit: 'MINUTES') timestamps() } tools { maven 'M3' } stages { stage('Checkout') { steps { checkout scm dir('.m2/repository/org/eclipse/xtext') { deleteDir() } dir('.m2/repository/org/eclipse/xtend') { deleteDir() } } } stage('Gradle Build') { steps { sh './1-gradle-build.sh' } } stage('Maven Build') { steps { sh './2-maven-build.sh' } } } post { always { junit testResults: '**/build/test-results/test/*.xml' } success { archiveArtifacts artifacts: 'build/**' } changed { script { def envName = '' if (env.JENKINS_URL.contains('ci.eclipse.org/xtext')) { envName = ' (JIPP)' } else if (env.JENKINS_URL.contains('jenkins.eclipse.org/xtext')) { envName = ' (CBI)' } else if (env.JENKINS_URL.contains('typefox.io')) { envName = ' (TF)' } def curResult = currentBuild.currentResult def color = '#00FF00' if (curResult == 'SUCCESS' && currentBuild.previousBuild != null) { curResult = 'FIXED' } else if (curResult == 'UNSTABLE') { color = '#FFFF00' } else if (curResult == 'FAILURE') { color = '#FF0000' } slackSend message: "${curResult}: <${env.BUILD_URL}|${env.JOB_NAME}#${env.BUILD_NUMBER}${envName}>", botUser: true, channel: 'xtext-builds', color: "${color}" } } } }