Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 6246ac8

Browse files
lwsantydennwc
authored andcommitted
update sdk to v3.2.1
jenkins integration Each commit to the master branch will trigger Jenkins workflow: 1) run the bblfsh/performance container 2) bblfsh/performance container -> pull the branch content 3) bblfsh/performance container -> run transformations benchmarks inside the repo: go test -run=NONE -bench=. ./driver/... 4) bblfsh/performance container -> performance binary -> store transformations benchmarks results to prometheus pushgateway 5) bblfsh/performance container -> performance binary -> run end to end test that does several steps: 5.1) build current driver's image 5.2) install driver's image to bblfsh 5.3) run benchmarks using grpc go-client, benchmark files: ./fixtures/bench_*.go 5.4) store benchmark results to to prometheus pushgateway Signed-off-by: lwsanty <[email protected]>
1 parent 3a0c75e commit 6246ac8

File tree

6 files changed

+181
-49
lines changed

6 files changed

+181
-49
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ RUN pip3 install -U --prefix=./.local ./python_package
2525
# Stage 1.1: Native Driver Tests
2626
#================================
2727
FROM native as native_test
28+
2829
# run native driver tests
2930
RUN cd ./python_package/test && PYTHONPATH=../../.local:$PYTHONPATH python3 -m unittest discover
3031

3132

3233
#=================================
3334
# Stage 2: Go Driver Server Build
3435
#=================================
35-
FROM golang:1.10-alpine as driver
36+
FROM golang:1.12-alpine as driver
3637

3738
ENV DRIVER_REPO=github.com/bblfsh/python-driver
3839
ENV DRIVER_REPO_PATH=/go/src/$DRIVER_REPO
@@ -45,6 +46,9 @@ WORKDIR $DRIVER_REPO_PATH/
4546

4647
ENV GO111MODULE=on GOFLAGS=-mod=vendor
4748

49+
# workaround for https://github.com/golang/go/issues/28065
50+
ENV CGO_ENABLED=0
51+
4852
# build server binary
4953
RUN go build -o /tmp/driver ./driver/main.go
5054
# build tests

Jenkinsfile

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
pipeline {
2+
agent {
3+
kubernetes {
4+
label 'python-driver-bblfsh-performance'
5+
defaultContainer 'python-driver-bblfsh-performance'
6+
yaml """
7+
spec:
8+
nodeSelector:
9+
srcd.host/type: jenkins-worker
10+
affinity:
11+
podAntiAffinity:
12+
requiredDuringSchedulingIgnoredDuringExecution:
13+
- labelSelector:
14+
matchExpressions:
15+
- key: jenkins
16+
operator: In
17+
values:
18+
- slave
19+
topologyKey: kubernetes.io/hostname
20+
containers:
21+
- name: python-driver-bblfsh-performance
22+
image: bblfsh/performance:latest
23+
imagePullPolicy: Always
24+
securityContext:
25+
privileged: true
26+
command:
27+
- dockerd
28+
tty: true
29+
"""
30+
}
31+
}
32+
environment {
33+
DRIVER_LANGUAGE = "python"
34+
DRIVER_REPO = "https://github.com/bblfsh/python-driver.git"
35+
DRIVER_SRC_FIXTURES = "${env.WORKSPACE}/fixtures"
36+
BENCHMARK_FILE = "${env.WORKSPACE}/bench.log"
37+
LOG_LEVEL = "debug"
38+
PROM_ADDRESS = "http://prom-pushgateway-prometheus-pushgateway.monitoring.svc.cluster.local:9091"
39+
PROM_JOB = "bblfsh_perfomance"
40+
}
41+
// TODO(lwsanty): https://github.com/src-d/infrastructure/issues/992
42+
// this is polling for every 2 minutes
43+
// however it's better to use trigger curl http://yourserver/jenkins/git/notifyCommit?url=<URL of the Git repository>
44+
// https://kohsuke.org/2011/12/01/polling-must-die-triggering-jenkins-builds-from-a-git-hook/
45+
// the problem is that it requires Jenkins to be accessible from the hook side
46+
// probably Travis CI could trigger Jenkins after all unit tests have passed...
47+
triggers { pollSCM('H/2 * * * *') }
48+
stages {
49+
stage('Run transformations benchmark') {
50+
when { branch 'master' }
51+
steps {
52+
sh "set -o pipefail ; go test -run=NONE -bench=. ./driver/... | tee ${env.BENCHMARK_FILE}"
53+
}
54+
}
55+
stage('Store transformations benchmark to prometheus') {
56+
when { branch 'master' }
57+
steps {
58+
sh "/root/bblfsh-performance parse-and-store --language=${env.DRIVER_LANGUAGE} --commit=${env.GIT_COMMIT} --storage=prom ${env.BENCHMARK_FILE}"
59+
}
60+
}
61+
stage('Run end-to-end benchmark') {
62+
when { branch 'master' }
63+
steps {
64+
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}"
65+
}
66+
}
67+
}
68+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Python driver for [Babelfish](https://github.com/bblfsh/bblfshd) ![Driver Status](https://img.shields.io/badge/status-beta-dbd25c.svg) [![Build Status](https://travis-ci.org/bblfsh/python-driver.svg?branch=master)](https://travis-ci.org/bblfsh/python-driver) ![Native Version](https://img.shields.io/badge/python%20version-3.6.2-aa93ea.svg) ![Go Version](https://img.shields.io/badge/go%20version-1.12-63afbf.svg)
1+
# Python driver for [Babelfish](https://github.com/bblfsh/bblfshd) ![Driver Status](https://img.shields.io/badge/status-beta-dbd25c.svg) [![Build Status](https://travis-ci.org/bblfsh/python-driver.svg?branch=master)](https://travis-ci.org/bblfsh/python-driver) ![Native Version](https://img.shields.io/badge/python%20version-3.6-aa93ea.svg) ![Go Version](https://img.shields.io/badge/go%20version-1.12-63afbf.svg)
22

33
Development Environment
44
-----------------------

build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
sdk: '2'
22
go-runtime:
3-
version: '1.10-alpine'
3+
version: '1.12-alpine'
44
native:
55
image: 'python:3.6-alpine'
66
deps:

go.mod

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,28 @@ module github.com/bblfsh/python-driver
33
go 1.12
44

55
require (
6-
github.com/BurntSushi/toml v0.3.1 // indirect
7-
github.com/Microsoft/go-winio v0.4.12 // indirect
8-
github.com/bblfsh/sdk/v3 v3.0.0
9-
github.com/containerd/continuity v0.0.0-20181203112020-004b46473808 // indirect
10-
github.com/gogo/protobuf v1.2.0 // indirect
11-
github.com/mattn/go-isatty v0.0.4 // indirect
6+
github.com/Microsoft/go-winio v0.4.13 // indirect
7+
github.com/bblfsh/sdk/v3 v3.2.1
8+
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect
9+
github.com/docker/go-connections v0.4.0 // indirect
10+
github.com/docker/go-units v0.4.0 // indirect
11+
github.com/gogo/protobuf v1.2.1 // indirect
12+
github.com/google/go-cmp v0.3.0 // indirect
13+
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
14+
github.com/mattn/go-colorable v0.1.2 // indirect
1215
github.com/opencontainers/runc v1.0.0-rc6 // indirect
13-
github.com/pkg/errors v0.8.1 // indirect
14-
github.com/sirupsen/logrus v1.3.0 // indirect
16+
github.com/opentracing/opentracing-go v1.1.0 // indirect
17+
github.com/ory/dockertest v3.3.4+incompatible // indirect
1518
github.com/stretchr/testify v1.3.0 // indirect
16-
golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613 // indirect
17-
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 // indirect
18-
golang.org/x/sys v0.0.0-20190130150945-aca44879d564 // indirect
19-
google.golang.org/genproto v0.0.0-20190128161407-8ac453e89fca // indirect
20-
google.golang.org/grpc v1.18.0 // indirect
19+
github.com/uber-go/atomic v1.4.0 // indirect
20+
github.com/uber/jaeger-client-go v2.16.0+incompatible // indirect
21+
github.com/uber/jaeger-lib v2.0.0+incompatible // indirect
22+
go.uber.org/atomic v1.4.0 // indirect
23+
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect
24+
golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 // indirect
25+
golang.org/x/text v0.3.2 // indirect
26+
google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610 // indirect
27+
google.golang.org/grpc v1.22.0 // indirect
28+
gopkg.in/bblfsh/sdk.v1 v1.17.0 // indirect
2129
gopkg.in/yaml.v2 v2.2.2 // indirect
2230
)

0 commit comments

Comments
 (0)