xtext-core/CBI.Jenkinsfile
Karsten Thoms 90c2d10179 [releng] Prepare migration to JIRO
- [eclipse/xtext#1431] Add resource limits to fix OOM failures
- [eclipse/xtext#1463] Configure job timeouts
- [eclipse/xtext#1465] Use declarative JUnit step
- [eclipse/xtext#1467] Add JIRO as known environment qualifier for build
notification message

Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
2019-05-21 11:01:27 +02:00

118 lines
2.7 KiB
Text

pipeline {
agent {
kubernetes {
label 'xtext-build-pod'
defaultContainer 'xtext-buildenv'
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: jnlp
image: 'eclipsecbi/jenkins-jnlp-agent'
args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)']
volumeMounts:
- mountPath: /home/jenkins/.ssh
name: volume-known-hosts
- name: xtext-buildenv
image: docker.io/smoht/xtext-buildenv:0.7
tty: true
resources:
limits:
memory: "2Gi"
cpu: "1"
requests:
memory: "2Gi"
cpu: "1"
volumeMounts:
- name: settings-xml
mountPath: /home/jenkins/.m2/settings.xml
subPath: settings.xml
readOnly: true
- name: m2-repo
mountPath: /home/jenkins/.m2/repository
- name: volume-known-hosts
mountPath: /home/jenkins/.ssh
volumes:
- name: volume-known-hosts
configMap:
name: known-hosts
- name: settings-xml
configMap:
name: m2-dir
items:
- key: settings.xml
path: settings.xml
- name: m2-repo
emptyDir: {}
'''
}
}
options {
buildDiscarder(logRotator(numToKeepStr:'15'))
disableConcurrentBuilds()
timeout(time: 30, unit: 'MINUTES')
}
// 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'
}
}
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('ci-staging.eclipse.org/xtext')) {
envName = ' (JIRO)'
} 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}"
}
}
}
}