Skip to content

Commit 4ea1d80

Browse files
committed
Merge remote-tracking branch 'origin/master' into gitbase-0.18
Signed-off-by: Carlos Martín <[email protected]>
2 parents d7cb4b2 + ea2ecaf commit 4ea1d80

File tree

6 files changed

+124
-66
lines changed

6 files changed

+124
-66
lines changed

.drone.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ helm_deploy: &helm_deploy
3131
skip_tls_verify: true
3232
helm_repos: srcd-charts=https://src-d.github.io/charts/
3333
chart: srcd-charts/gitbase-web
34+
chart-version: 0.5.0
3435
release: gp
3536
tiller_ns: kube-system
3637
wait: true
@@ -63,8 +64,8 @@ pipeline:
6364
<<: *helm_deploy
6465
prefix: STG
6566
secrets: [ STG_API_SERVER, STG_KUBERNETES_TOKEN ]
66-
values: gitbaseWeb.image.tag=commit-${DRONE_COMMIT_SHA:0:7},ingress.globalStaticIpName=gitbase-playground-staging,ingress.hostname=gitbase-playground-staging.srcd.run
67-
values_files: [.helm-staging.yml]
67+
values: gitbaseWeb.image.tag=commit-${DRONE_COMMIT_SHA:0:7}
68+
values_files: [ .helm-defaults.yml, .helm-staging.yml]
6869
when:
6970
branch: [master]
7071
event: [push]

.helm-defaults.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
service:
2+
type: NodePort
3+
port: 8080
4+
5+
bblfshdServer:
6+
image:
7+
repository: bblfsh/bblfshd
8+
tag: v2.10.0
9+
pullPolicy: IfNotPresent
10+
drivers:
11+
install: true
12+
languages:
13+
python:
14+
repository: bblfsh/python-driver
15+
tag: v2.4.0
16+
cpp:
17+
repository: bblfsh/cpp-driver
18+
tag: v0.3.0
19+
java:
20+
repository: bblfsh/java-driver
21+
tag: v2.3.0
22+
php:
23+
repository: bblfsh/php-driver
24+
tag: v2.4.0
25+
ruby:
26+
repository: bblfsh/ruby-driver
27+
tag: v2.4.0
28+
javascript:
29+
repository: bblfsh/javascript-driver
30+
tag: v2.3.0
31+
bash:
32+
repository: bblfsh/bash-driver
33+
tag: v2.1.0
34+
go:
35+
repository: bblfsh/go-driver
36+
tag: v2.3.0
37+
38+
gitbaseServer:
39+
# commit defaults to HEAD unless given
40+
repositories:
41+
go-git:
42+
url: https://github.com/src-d/go-git.git
43+
#commit: v4.4.0
44+
gitbase:
45+
url: https://github.com/src-d/gitbase.git
46+
gitbase-web:
47+
url: https://github.com/src-d/gitbase-web.git
48+
bblfshd:
49+
url: https://github.com/bblfsh/bblfshd.git
50+
siva-java:
51+
url: https://github.com/src-d/siva-java.git
52+
image:
53+
repository: srcd/gitbase
54+
tag: v0.17.1
55+
pullPolicy: IfNotPresent
56+
squashEnable: "true"
57+
readonly: "true"
58+
59+
nodeSelector:
60+
cloud.google.com/gke-nodepool: default-pool
61+
62+
affinity:
63+
podAntiAffinity:
64+
requiredDuringSchedulingIgnoredDuringExecution:
65+
- labelSelector:
66+
matchExpressions:
67+
- key: app
68+
operator: In
69+
values:
70+
#if the chart name is changed or a nameOverride is used, this value has to be changed to the new name.
71+
- gitbase-web
72+
topologyKey: kubernetes.io/hostname

.helm-staging.yml

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,13 @@
1-
bblfshdServer:
2-
image:
3-
repository: bblfsh/bblfshd
4-
tag: v2.9.0
5-
pullPolicy: IfNotPresent
6-
drivers:
7-
install: true
8-
languages:
9-
python:
10-
repository: bblfsh/python-driver
11-
tag: v2.3.0
12-
java:
13-
repository: bblfsh/java-driver
14-
tag: v2.2.0
15-
php:
16-
repository: bblfsh/php-driver
17-
tag: v2.3.0
18-
ruby:
19-
repository: bblfsh/ruby-driver
20-
tag: v2.3.0
21-
javascript:
22-
repository: bblfsh/javascript-driver
23-
tag: v2.2.0
24-
bash:
25-
repository: bblfsh/bash-driver
26-
tag: v1.1.1
27-
go:
28-
repository: bblfsh/go-driver
29-
tag: v2.2.0
30-
31-
gitbaseServer:
32-
# commit defaults to HEAD unless given
33-
repositories:
34-
go-git:
35-
url: https://github.com/src-d/go-git.git
36-
#commit: v4.4.0
37-
gitbase:
38-
url: https://github.com/src-d/gitbase.git
39-
gitbase-web:
40-
url: https://github.com/src-d/gitbase-web.git
41-
bblfshd:
42-
url: https://github.com/bblfsh/bblfshd.git
43-
siva-java:
44-
url: https://github.com/src-d/siva-java.git
45-
image:
46-
repository: srcd/gitbase
47-
tag: v0.17.1
48-
pullPolicy: IfNotPresent
49-
squashEnable: "true"
50-
readonly: "true"
51-
52-
nodeSelector:
53-
cloud.google.com/gke-nodepool: default-pool
1+
ingress:
2+
enabled: true
3+
annotations:
4+
kubernetes.io/ingress.class: gce
5+
kubernetes.io/tls-acme: "true"
6+
kubernetes.io/ingress.global-static-ip-name: gitbase-playground-staging
7+
path: /*
8+
hosts:
9+
- gitbase-playground-staging.srcd.run
10+
tls:
11+
- secretName: gitbase-playground-staging-srcd-run-tls
12+
hosts:
13+
- gitbase-playground-staging.srcd.run

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ services:
1818
volumes:
1919
- ${GITBASEPG_REPOS_FOLDER}:/opt/repos
2020
bblfsh:
21-
image: "bblfsh/bblfshd:v2.9.2-drivers"
21+
image: "bblfsh/bblfshd:v2.10.0-drivers"
2222
privileged: true

frontend/src/App.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,10 @@ class App extends Component {
7979
SELECT f.repository_id, f.file_path,
8080
LANGUAGE(f.file_path, f.blob_content) AS lang, f.blob_content,
8181
UAST(f.blob_content, LANGUAGE(f.file_path, f.blob_content)) AS uast
82-
FROM files AS f
83-
JOIN commit_files cf ON
84-
f.repository_id=cf.repository_id AND
85-
f.file_path=cf.file_path AND
86-
f.blob_hash=cf.blob_hash AND
87-
f.tree_hash=cf.tree_hash
88-
JOIN refs ON
89-
cf.repository_id = refs.repository_id AND
90-
cf.commit_hash = refs.commit_hash
91-
WHERE ref_name = 'HEAD'
82+
FROM refs AS r
83+
NATURAL JOIN commit_files
84+
NATURAL JOIN files AS f
85+
WHERE r.ref_name = 'HEAD'
9286
AND f.file_path REGEXP('.*main.go')`
9387
},
9488

server/service/uast_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package service_test
2+
3+
import (
4+
"bytes"
5+
"encoding/binary"
6+
"testing"
7+
8+
"github.com/src-d/gitbase-web/server/service"
9+
"github.com/stretchr/testify/suite"
10+
)
11+
12+
type UastSuite struct {
13+
suite.Suite
14+
}
15+
16+
func TestUastSuite(t *testing.T) {
17+
s := new(UastSuite)
18+
suite.Run(t, s)
19+
}
20+
21+
func (suite *UastSuite) TestNegativeNodeLen() {
22+
var nodeLen int32 = -20
23+
24+
buf := new(bytes.Buffer)
25+
err := binary.Write(buf, binary.BigEndian, nodeLen)
26+
suite.Require().NoError(err)
27+
28+
nodes, err := service.UnmarshalUAST(buf.Bytes())
29+
suite.Require().Error(err)
30+
suite.Require().Nil(nodes)
31+
}

0 commit comments

Comments
 (0)