Skip to content

Commit 4c568c6

Browse files
authored
Merge branch 'master' into feature/mysql-client
2 parents 67c57d5 + 0a56208 commit 4c568c6

File tree

7 files changed

+25
-8
lines changed

7 files changed

+25
-8
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ jobs:
3838
services: [docker]
3939

4040
before_deploy:
41-
- make packages
42-
- echo "${TRAVIS_TAG}" > version.txt
41+
- make static-package
4342
- make docker-push-latest-release
4443

4544
deploy:

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ FROM golang:1.11-alpine as builder
66
ENV GITBASE_REPO=github.com/src-d/gitbase
77
ENV GITBASE_PATH=$GOPATH/src/$GITBASE_REPO
88

9-
RUN apk add --no-cache git
9+
RUN apk add --update --no-cache libxml2-dev git make bash gcc g++ curl oniguruma-dev oniguruma
1010

1111
COPY . $GITBASE_PATH
1212
WORKDIR $GITBASE_PATH
13-
RUN go build -ldflags="-X main.version=$(cat version.txt || echo "undefined") -X main.build=$(date +"%m-%d-%Y_%H_%M_%S") -X main.commit=$(git rev-parse --short HEAD) -s -w" -o /bin/gitbase ./cmd/gitbase
13+
14+
ENV GO_BUILD_ARGS="-o /bin/gitbase"
15+
ENV GO_BUILD_PATH="./cmd/gitbase"
16+
RUN make static-build
1417

1518
#=================================
1619
# Stage 2: Start Gitbase Server

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pipeline {
77
nodeSelector 'srcd.host/type=jenkins-worker'
88
containerTemplate {
99
name 'regression-gitbase'
10-
image 'srcd/regression-gitbase:v0.2.0'
10+
image 'srcd/regression-gitbase:v0.2.1'
1111
ttyEnabled true
1212
command 'cat'
1313
}

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ static-package:
3030
docker rm gitbase-temp
3131

3232
# target used in the Dockerfile to build the static binary
33-
static-build: VERSION = $(shell git describe --exact-match --tags 2>/dev/null || dev-$(git rev-parse --short HEAD)$(test -n "`git status --porcelain`" && echo "-dirty" || true))
34-
static-build: LD_FLAGS += -linkmode external -extldflags '-static -lz'
33+
static-build: VERSION ?= $(shell git describe --exact-match --tags 2>/dev/null || "dev-$(git rev-parse --short HEAD)$(test -n "`git status --porcelain`" && echo "-dirty" || true)")
34+
static-build: LD_FLAGS += -linkmode external -extldflags '-static -lz' -s -w
3535
static-build: GO_BUILD_ARGS += -tags oniguruma
36+
static-build: GO_BUILD_PATH ?= github.com/src-d/gitbase/...
3637
static-build:
37-
go install -v $(GO_BUILD_ARGS) github.com/src-d/gitbase/...
38+
go build -ldflags="$(LD_FLAGS)" -v $(GO_BUILD_ARGS) $(GO_BUILD_PATH)
3839

3940
ci-e2e: packages
4041
go test ./e2e -gitbase-version="$(TRAVIS_TAG)" \

_testdata/not-permission/.gitkeep

Whitespace-only changes.

cmd/gitbase/command/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ func (c *Server) addMatch(match string) error {
309309
initDepth := strings.Count(root, string(os.PathSeparator))
310310
return filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
311311
if err != nil {
312+
if os.IsPermission(err) {
313+
return filepath.SkipDir
314+
}
312315
return err
313316
}
314317

cmd/gitbase/command/server_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package command
22

33
import (
4+
"os"
45
"testing"
56

67
"github.com/src-d/gitbase"
@@ -10,12 +11,22 @@ import (
1011
func TestAddMatch(t *testing.T) {
1112
require := require.New(t)
1213

14+
notPermissionDir := "../../../_testdata/not-permission/"
15+
fi, err := os.Stat(notPermissionDir)
16+
require.NoError(err)
17+
18+
require.NoError(os.Chmod(notPermissionDir, 0))
19+
defer func() {
20+
require.NoError(os.Chmod(notPermissionDir, fi.Mode()))
21+
}()
22+
1323
expected := []struct {
1424
path string
1525
err func(error, ...interface{})
1626
}{
1727
{"../../../_testdata/repositories/", require.NoError},
1828
{"../../../_testdata/repositories-link/", require.NoError},
29+
{notPermissionDir, require.NoError},
1930
{"../../../_testdata/repositories-not-exist/", require.Error},
2031
}
2132
c := &Server{pool: gitbase.NewRepositoryPool(0)}

0 commit comments

Comments
 (0)