[eclipse/xtext#1309] Provide Jenkinsfile for Eclipse CBI

- externalized build steps into shell scripts for convenient local usage
- added Slack notifications
- configure Maven default goal

Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
This commit is contained in:
Karsten Thoms 2019-01-21 16:53:42 +01:00
parent 35f9e08f60
commit 88235162f0
4 changed files with 102 additions and 0 deletions

15
1-gradle-build.sh Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
if [ -z "$JENKINS_URL" ]; then
# if not set in environment use default
JENKINS_URL=https://ci.eclipse.org/xtext/
fi
./gradlew \
clean cleanGenerateXtext build createLocalMavenRepo \
-PuseJenkinsSnapshots=true \
-PJENKINS_URL=$JENKINS_URL \
-PcompileXtend=true \
-PignoreTestFailures=true \
--refresh-dependencies \
--continue \
$@

15
2-maven-build.sh Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
if [ -z "$JENKINS_URL" ]; then
# if not set in environment use default
JENKINS_URL=https://ci.eclipse.org/xtext/
fi
mvn \
-f releng \
--batch-mode \
--update-snapshots \
-Dmaven.repo.local=.m2/repository \
-DJENKINS_URL=$JENKINS_URL \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
$@

71
CBI.Jenkinsfile Normal file
View file

@ -0,0 +1,71 @@
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr:'15'))
disableConcurrentBuilds()
}
tools {
// see https://wiki.eclipse.org/Jenkins#Jenkins_configuration_and_tools_.28clustered_infra.29
maven 'apache-maven-latest'
jdk 'oracle-jdk8-latest'
}
// https://jenkins.io/doc/book/pipeline/syntax/#triggers
triggers {
pollSCM('H/5 * * * *')
}
// Build stages
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Gradle Build') {
steps {
sh './1-gradle-build.sh'
step([$class: 'JUnitResultArchiver', testResults: '**/build/test-results/test/*.xml'])
}
}
stage('Maven Build') {
steps {
sh './2-maven-build.sh'
}
}
}
post {
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}"
}
}
}
}

View file

@ -160,6 +160,7 @@
</modules>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>