-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
83 lines (71 loc) · 2.74 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env groovy
pipeline {
agent {
label 'slave-group-normal'
}
options {
timeout(time: 1, unit: 'HOURS')
}
stages {
stage('Prepare') {
steps {
withCredentials([
string(credentialsId: 'krb5.user', variable: 'USER'),
file(credentialsId: 'krb5.keytab', variable: 'FILE')
]) {
sh "kinit $USER -k -t $FILE"
}
// Workaround for JENKINS-47230
script {
env.MAVEN_HOME = tool('Maven')
sh 'make stop-openshift'
// See https://github.com/openshift/origin/issues/15038#issuecomment-345252400
sh 'sudo rm -rf /usr/share/rhel/secrets'
sh 'make clean-docker clean-maven MVN_COMMAND="$MAVEN_HOME/bin/mvn -s services/functional-tests/maven-settings.xml"'
sh 'make build-image'
// Make sure openshift is definitely still not running
sh 'oc cluster status || true'
sh 'make start-openshift-with-catalog login-to-openshift prepare-openshift-project push-image-to-local-openshift'
}
checkout scm
}
}
stage('Functional tests') {
steps {
script {
try {
sh 'make test-functional MVN_COMMAND="$MAVEN_HOME/bin/mvn -s services/functional-tests/maven-settings.xml"'
} finally {
sh 'tail -n +1 -- services/functional-tests/target/surefire-reports/*.txt'
}
}
}
}
stage('Gather test results') {
steps {
script {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/*.xml'
}
}
}
}
post {
always {
archiveArtifacts allowEmptyArchive: true, artifacts: '**/target/surefire-reports/*.txt, **/target/surefire-reports/*.log', fingerprint: true
junit '**/target/surefire-reports/*.xml'
}
failure {
sh 'oc cluster status || true'
sh 'oc describe pods -n default || true'
sh 'mkdir logs'
sh 'sudo docker ps -a --format \'{{.ID}} {{.Image}}\' | grep openshift | awk \'{print $1}\' | xargs -r docker inspect --format=\'{{.Name}} {{.LogPath}}\' | xargs -l bash -c \'sudo install -C -m 755 -o infinispan -g users $1 logs$0.log\''
archiveArtifacts allowEmptyArchive: true, artifacts: 'logs/*.log', fingerprint: true
}
cleanup {
sh 'make stop-openshift clean-docker'
sh 'git clean -qfdx || echo "git clean failed, exit code $?"'
sh 'docker container prune -f'
sh 'docker rmi $(docker images -f "dangling=true" -q) || true'
}
}
}