diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .gitlab-ci.yml | 20 | ||||
-rw-r--r-- | Makefile | 60 | ||||
-rw-r--r-- | NOTICE | 24 | ||||
-rw-r--r-- | cmd/gitaly-git2go/main.go | 23 | ||||
-rw-r--r-- | ctxt.BuildTags | 5 | ||||
-rw-r--r-- | go.mod | 1 | ||||
-rw-r--r-- | go.sum | 3 |
8 files changed, 15 insertions, 122 deletions
diff --git a/.gitignore b/.gitignore index 35e7aeb1f..25909590c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ /_build /config.mak /gitaly -/gitaly-git2go /gitaly-hooks cmd/gitaly-ssh/gitaly-ssh /gitaly-ssh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 614cd15ea..f8688418d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,25 +29,13 @@ danger-review: .ruby_template: &ruby_definition cache: - key: - files: - - Makefile - - ruby/Gemfile.lock + key: gems-ruby-2.6 paths: - - _build/libgit2 - ruby/vendor/bundle .build_template: &build_definition <<: *ruby_definition stage: build - cache: - key: - files: - - Makefile - - ruby/Gemfile.lock - paths: - - _build/libgit2 - - ruby/vendor/bundle script: - go version - make @@ -74,12 +62,8 @@ danger-review: stage: test # Override the ruby_definition cache definition for pull cache: - key: - files: - - Makefile - - ruby/Gemfile.lock + key: gems-ruby-2.6 paths: - - _build/libgit2 - ruby/vendor/bundle policy: pull artifacts: @@ -50,13 +50,13 @@ BUILD_TIME := $(shell date +"%Y%m%d.%H%M%S") GITALY_VERSION := $(shell git describe --match v* 2>/dev/null | sed 's/^v//' || cat ${SOURCE_DIR}/VERSION 2>/dev/null || echo unknown) GO_LDFLAGS := -ldflags '-X ${GITALY_PACKAGE}/internal/version.version=${GITALY_VERSION} -X ${GITALY_PACKAGE}/internal/version.buildtime=${BUILD_TIME}' GO_TEST_LDFLAGS := -X gitlab.com/gitlab-org/gitaly/auth.timestampThreshold=5s +GO_BUILD_TAGS := tracer_static tracer_static_jaeger continuous_profiler_stackdriver # Dependency versions GOLANGCI_LINT_VERSION ?= 1.27.0 PROTOC_VERSION ?= 3.6.1 PROTOC_GEN_GO_VERSION ?= 1.3.2 GIT_VERSION ?= v2.27.0 -LIBGIT2_VERSION ?= v1.0.1 # Dependency downloads ifeq (${OS},Darwin) @@ -90,29 +90,6 @@ ifeq (${GIT_BUILD_OPTIONS},) GIT_BUILD_OPTIONS += NO_R_TO_GCC_LINKER=YesPlease endif -# libgit2 target -LIBGIT2_REPO_URL ?= https://gitlab.com/libgit2/libgit2 -LIBGIT2_SOURCE_DIR ?= ${BUILD_DIR}/src/libgit2 -LIBGIT2_BUILD_DIR ?= ${LIBGIT2_SOURCE_DIR}/build -LIBGIT2_INSTALL_DIR ?= ${BUILD_DIR}/libgit2 - -ifeq (${LIBGIT2_BUILD_OPTIONS},) - LIBGIT2_BUILD_OPTIONS += -DTHREADSAFE=ON - LIBGIT2_BUILD_OPTIONS += -DBUILD_CLAR=OFF - LIBGIT2_BUILD_OPTIONS += -DBUILD_SHARED_LIBS=OFF - LIBGIT2_BUILD_OPTIONS += -DCMAKE_C_FLAGS=-fPIC - LIBGIT2_BUILD_OPTIONS += -DCMAKE_BUILD_TYPE=Release - LIBGIT2_BUILD_OPTIONS += -DCMAKE_INSTALL_PREFIX=${LIBGIT2_INSTALL_DIR} - LIBGIT2_BUILD_OPTIONS += -DCMAKE_INSTALL_LIBDIR=lib - LIBGIT2_BUILD_OPTIONS += -DENABLE_TRACE=OFF - LIBGIT2_BUILD_OPTIONS += -DUSE_SSH=OFF - LIBGIT2_BUILD_OPTIONS += -DUSE_HTTPS=OFF - LIBGIT2_BUILD_OPTIONS += -DUSE_NTLMCLIENT=OFF - LIBGIT2_BUILD_OPTIONS += -DUSE_BUNDLED_ZLIB=ON - LIBGIT2_BUILD_OPTIONS += -DUSE_HTTP_PARSER=builtin - LIBGIT2_BUILD_OPTIONS += -DREGEX_BACKEND=builtin -endif - # These variables control test options and artifacts TEST_OPTIONS ?= TEST_REPORT_DIR ?= ${BUILD_DIR}/reports @@ -134,10 +111,9 @@ find_go_sources = $(shell find ${SOURCE_DIR} -type d \( -name ruby -o -name ven find_go_packages = $(dir $(call find_go_sources, 's|[^/]*\.go||')) unexport GOROOT -export GOBIN = ${BUILD_DIR}/bin -export GOPROXY ?= https://proxy.golang.org -export PATH := ${BUILD_DIR}/bin:${PATH} -export PKG_CONFIG_PATH := ${LIBGIT2_INSTALL_DIR}/lib/pkgconfig +export GOBIN = ${BUILD_DIR}/bin +export GOPROXY ?= https://proxy.golang.org +export PATH := ${BUILD_DIR}/bin:${PATH} .NOTPARALLEL: @@ -146,8 +122,8 @@ all: INSTALL_DEST_DIR = ${SOURCE_DIR} all: install .PHONY: build -build: ${SOURCE_DIR}/.ruby-bundle libgit2 - go install ${GO_LDFLAGS} $(addprefix ${GITALY_PACKAGE}/cmd/, $(call find_commands)) +build: ${SOURCE_DIR}/.ruby-bundle + go install ${GO_LDFLAGS} -tags "${GO_BUILD_TAGS}" $(addprefix ${GITALY_PACKAGE}/cmd/, $(call find_commands)) .PHONY: install install: build @@ -193,20 +169,20 @@ prepare-tests: ${GITLAB_SHELL_DIR}/config.yml ${TEST_REPO} ${TEST_REPO_GIT} ${SO test: test-go rspec rspec-gitlab-shell .PHONY: test-go -test-go: prepare-tests ${GO_JUNIT_REPORT} libgit2 +test-go: prepare-tests ${GO_JUNIT_REPORT} ${Q}mkdir -p ${TEST_REPORT_DIR} ${Q}echo 0>${TEST_EXIT} - ${Q}go test ${TEST_OPTIONS} -v -ldflags='${GO_TEST_LDFLAGS}' -count=1 $(call find_go_packages) 2>&1 | tee ${TEST_OUTPUT} || echo $$? >${TEST_EXIT} + ${Q}go test ${TEST_OPTIONS} -v -tags "${GO_BUILD_TAGS}" -ldflags='${GO_TEST_LDFLAGS}' -count=1 $(call find_go_packages) 2>&1 | tee ${TEST_OUTPUT} || echo $$? >${TEST_EXIT} ${Q}${GO_JUNIT_REPORT} <${TEST_OUTPUT} >${TEST_REPORT} ${Q}exit `cat ${TEST_EXIT}` .PHONY: test-with-proxies test-with-proxies: prepare-tests - ${Q}go test -count=1 -exec ${SOURCE_DIR}/_support/bad-proxies ${GITALY_PACKAGE}/internal/rubyserver/ + ${Q}go test -tags "${GO_BUILD_TAGS}" -count=1 -exec ${SOURCE_DIR}/_support/bad-proxies ${GITALY_PACKAGE}/internal/rubyserver/ .PHONY: test-with-praefect test-with-praefect: build prepare-tests - ${Q}GITALY_TEST_PRAEFECT_BIN=${BUILD_DIR}/bin/praefect go test -ldflags='${GO_TEST_LDFLAGS}' -count=1 $(call find_go_packages) # count=1 bypasses go 1.10 test caching + ${Q}GITALY_TEST_PRAEFECT_BIN=${BUILD_DIR}/bin/praefect go test -tags "${GO_BUILD_TAGS}" -ldflags='${GO_TEST_LDFLAGS}' -count=1 $(call find_go_packages) # count=1 bypasses go 1.10 test caching .PHONY: race-go race-go: TEST_OPTIONS = -race @@ -232,7 +208,7 @@ check-mod-tidy: ${Q}${SOURCE_DIR}/_support/check-mod-tidy .PHONY: lint -lint: ${GOLANGCI_LINT} libgit2 +lint: ${GOLANGCI_LINT} ${Q}${GOLANGCI_LINT} cache clean && ${GOLANGCI_LINT} run --out-format tab --config ${SOURCE_DIR}/.golangci.yml .PHONY: check-formatting @@ -275,7 +251,7 @@ rubocop: ${SOURCE_DIR}/.ruby-bundle ${Q}cd ${GITALY_RUBY_DIR} && bundle exec rubocop --parallel .PHONY: cover -cover: prepare-tests libgit2 +cover: prepare-tests ${Q}echo "NOTE: make cover does not exit 1 on failure, don't use it to check for tests success!" ${Q}mkdir -p "${COVERAGE_DIR}" ${Q}rm -f "${COVERAGE_DIR}/all.merged" "${COVERAGE_DIR}/all.html" @@ -294,7 +270,7 @@ docker: cp -r ${GITALY_RUBY_DIR} ${BUILD_DIR}/docker/ruby ${Q}rm -rf ${BUILD_DIR}/docker/ruby/vendor/bundle for command in $(call find_commands); do \ - GOOS=linux GOARCH=amd64 go build ${GO_LDFLAGS} -o "${BUILD_DIR}/docker/bin/$${command}" ${GITALY_PACKAGE}/cmd/$${command}; \ + GOOS=linux GOARCH=amd64 go build -tags "${GO_BUILD_TAGS}" ${GO_LDFLAGS} -o "${BUILD_DIR}/docker/bin/$${command}" ${GITALY_PACKAGE}/cmd/$${command}; \ done cp ${SOURCE_DIR}/Dockerfile ${BUILD_DIR}/docker/ docker build -t gitlab/gitaly:v${GITALY_VERSION} -t gitlab/gitaly:latest ${BUILD_DIR}/docker/ @@ -336,9 +312,6 @@ build-git: ${Q}mkdir -p ${GIT_INSTALL_DIR} ${MAKE} -C ${GIT_SOURCE_DIR} -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} install -.PHONY: libgit2 -libgit2: ${LIBGIT2_INSTALL_DIR}/lib/libgit2.a - # This file is used by Omnibus and CNG to skip the "bundle install" # step. Both Omnibus and CNG assume it is in the Gitaly root, not in # _build. Hence the '../' in front. @@ -380,13 +353,6 @@ ${BUILD_DIR}/git_full_bins.tgz: | ${BUILD_DIR} ${Q}printf '${GIT_BINARIES_HASH} $@.tmp' | shasum -a256 -c - ${Q}mv $@.tmp $@ -${LIBGIT2_INSTALL_DIR}/lib/libgit2.a: - ${Q}rm -rf ${LIBGIT2_SOURCE_DIR} - git clone --depth 1 --branch ${LIBGIT2_VERSION} --quiet ${LIBGIT2_REPO_URL} ${LIBGIT2_SOURCE_DIR} - ${Q}mkdir -p ${LIBGIT2_BUILD_DIR} - ${Q}cd ${LIBGIT2_BUILD_DIR} && cmake ${LIBGIT2_SOURCE_DIR} ${LIBGIT2_BUILD_OPTIONS} - ${Q}cmake --build ${LIBGIT2_BUILD_DIR} --target install - ${GOIMPORTS}: ${BUILD_DIR}/go.mod | ${BUILD_DIR}/bin ${Q}cd ${BUILD_DIR} && go get golang.org/x/tools/cmd/goimports@2538eef75904eff384a2551359968e40c207d9d2 @@ -671,30 +671,6 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -LICENSE - github.com/libgit2/git2go/v30 -The MIT License - -Copyright (c) 2013 The git2go contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LICENSE - github.com/mattn/go-runewidth The MIT License (MIT) diff --git a/cmd/gitaly-git2go/main.go b/cmd/gitaly-git2go/main.go deleted file mode 100644 index a11cfcad8..000000000 --- a/cmd/gitaly-git2go/main.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import ( - "os" - - git "github.com/libgit2/git2go/v30" -) - -func main() { - repo, err := git.OpenRepository(".") - if err != nil { - os.Exit(1) - } - defer repo.Free() - - head, err := repo.Head() - if err != nil { - os.Exit(1) - } - defer head.Free() - - println(head.Target().String()) -} diff --git a/ctxt.BuildTags b/ctxt.BuildTags deleted file mode 100644 index 6deb1ea8a..000000000 --- a/ctxt.BuildTags +++ /dev/null @@ -1,5 +0,0 @@ -continuous_profiler_stackdriver -static -system_libgit2 -tracer_static -tracer_static_jaeger @@ -11,7 +11,6 @@ require ( github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/kelseyhightower/envconfig v1.3.0 github.com/lib/pq v1.2.0 - github.com/libgit2/git2go/v30 v30.0.5 github.com/olekukonko/tablewriter v0.0.2 github.com/otiai10/curr v1.0.0 // indirect github.com/prometheus/client_golang v1.0.0 @@ -199,10 +199,7 @@ github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvf github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/libgit2/git2go v0.0.0-20190104134018-ecaeb7a21d47 h1:HDt7WT3kpXSHq4mlOuLzgXH9LeOK1qlhyFdKIAzxxeM= github.com/libgit2/git2go v0.0.0-20190104134018-ecaeb7a21d47/go.mod h1:4bKN42efkbNYMZlvDfxGDxzl066GhpvIircZDsm8Y+Y= -github.com/libgit2/git2go/v30 v30.0.5 h1:gxKqXOslpvYDZNC62f8GV34TAk0qw4wZ++IdYw8V9I4= -github.com/libgit2/git2go/v30 v30.0.5/go.mod h1:YReiQ7xhMoyAL4ISYFLZt+OGqn6xtLqvTC1xJ9oAH7Y= github.com/lightstep/lightstep-tracer-go v0.15.6 h1:D0GGa7afJ7GcQvu5as6ssLEEKYXvRgKI5d5cevtz8r4= github.com/lightstep/lightstep-tracer-go v0.15.6/go.mod h1:6AMpwZpsyCFwSovxzM78e+AsYxE8sGwiM6C3TytaWeI= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= |