This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Jenkinsfile
88 lines (88 loc) · 3.17 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
84
85
86
87
88
pipeline {
agent {
kubernetes {
label 'python-driver-bblfsh-performance'
defaultContainer 'python-driver-bblfsh-performance'
yaml """
spec:
nodeSelector:
srcd.host/type: jenkins-worker
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: jenkins
operator: In
values:
- slave
topologyKey: kubernetes.io/hostname
containers:
- name: python-driver-bblfsh-performance
image: bblfsh/performance:latest
imagePullPolicy: Always
securityContext:
privileged: true
command:
- dockerd
tty: true
"""
}
}
environment {
DRIVER_LANGUAGE = "python"
DRIVER_REPO = "https://github.com/bblfsh/python-driver.git"
DRIVER_SRC_FIXTURES = "${env.WORKSPACE}/fixtures"
BENCHMARK_FILE = "${env.WORKSPACE}/bench.log"
LOG_LEVEL = "debug"
PROM_ADDRESS = "http://prom-pushgateway-prometheus-pushgateway.monitoring.svc.cluster.local:9091"
PROM_JOB = "bblfsh_perfomance"
}
// TODO(lwsanty): https://github.com/src-d/infrastructure/issues/992
// this is polling for every 2 minutes
// however it's better to use trigger curl http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>
// https://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/
// the problem is that it requires Jenkins to be accessible from the hook side
// probably Travis CI could trigger Jenkins after all unit tests have passed...
triggers { pollSCM('H/2 * * * *') }
stages {
stage('Run transformations benchmark') {
when { branch 'master' }
steps {
sh "set -o pipefail ; go test -run=NONE -bench=/transform ./driver/... | tee ${env.BENCHMARK_FILE}"
}
}
stage('Store transformations benchmark to prometheus') {
when { branch 'master' }
steps {
sh "/root/bblfsh-performance parse-and-store --language=${env.DRIVER_LANGUAGE} --commit=${env.GIT_COMMIT} --storage=prom ${env.BENCHMARK_FILE}"
}
}
stage('Run driver-native benchmark') {
when { branch 'master' }
steps {
sh "/root/bblfsh-performance driver-native --language=${env.DRIVER_LANGUAGE} --commit=${env.GIT_COMMIT} --native=/root/utils/native-driver-performance --storage=prom ${env.DRIVER_SRC_FIXTURES}"
}
}
stage('Run driver benchmark') {
when { branch 'master' }
steps {
sh "/root/bblfsh-performance driver --language=${env.DRIVER_LANGUAGE} --commit=${env.GIT_COMMIT} --storage=prom ${env.DRIVER_SRC_FIXTURES}"
}
}
stage('Run end-to-end benchmark') {
when { branch 'master' }
steps {
sh "/root/bblfsh-performance end-to-end --language=${env.DRIVER_LANGUAGE} --commit=${env.GIT_COMMIT} --docker-tag=latest --custom-driver=true --storage=prom ${env.DRIVER_SRC_FIXTURES}"
}
}
}
post {
success {
slackSend (color: '#2eb886', message: "SUCCESS: `${env.JOB_NAME}` <${env.BUILD_URL}|build #${env.BUILD_NUMBER}>")
}
failure {
slackSend (color: '#b82e60', message: "FAILED: `${env.JOB_NAME}` <${env.BUILD_URL}|build #${env.BUILD_NUMBER}>")
}
}
}