Skip to content

Commit

Permalink
chore: Vendor Cortex dependency as an internal package (#5504)
Browse files Browse the repository at this point in the history
* Vendor Cortex dependency as an internal package

Signed-off-by: Kemal Akkoyun <[email protected]>

* Add gitattributes

Signed-off-by: Kemal Akkoyun <[email protected]>

* Skip checks for vendored directory

Signed-off-by: Kemal Akkoyun <[email protected]>

* Add copyright headers for Cortex

Signed-off-by: Kemal Akkoyun <[email protected]>
  • Loading branch information
kakkoyun authored Jul 15, 2022
1 parent 6047482 commit efbcf0c
Show file tree
Hide file tree
Showing 512 changed files with 118,780 additions and 691 deletions.
71 changes: 71 additions & 0 deletions .cortex-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
+ chunk
+ chunk/*.go
+ chunk/cache
+ chunk/encoding
+ chunk/purger
+ chunk/purger.test
+ chunk/testutils
- chunk/*
+ cortexpb
+ frontend
+ ingester
+ ingester/client
- ingester/*
+ prom1
+ prom1/storage
+ prom1/storage/metric
- prom1/storage/*
- prom1/*
+ querier
+ querier/*.go
+ querier/astmapper
+ querier/batch
+ querier/chunkstore
+ querier/iterators
+ querier/lazyquery
+ querier/queryrange
+ querier/series
+ querier/stats
+ querier/worker
+ querier.test
- querier/*
+ ring
+ ring/*.go
+ ring/client
+ ring/kv
+ ring/shard
+ ring/util
- ring/*
+ scheduler
+ storage
+ storage/bucket
+ storage/tsdb
- storage/*
+ storegateway
+ tenant
+ util
+ util/*.go
+ util/backoff
+ util/chunkcompat
+ util/concurrency
+ util/extract
+ util/flagext
+ util/grpcclient
+ util/grpcencoding
+ util/grpcencoding/snappy
+ util/grpcutil
+ util/httpgrpcutil
+ util/limiter
+ util/log
+ util/math
+ util/middleware
+ util/multierror
+ util/runutil
+ util/services
+ util/spanlogger
+ util/test
+ util/tls
+ util/validation
- util/grpcencoding/*
- util/*
- /*
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
internal/cortex/ linguist-vendored
2 changes: 2 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
paths-ignore:
- 'internal/cortex/**/*.go'
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
Expand Down
5 changes: 4 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ run:
# default value is empty list, but next dirs are always skipped independently
# from this option's value:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs: vendor
skip-dirs:
- vendor
- internal/cortex


# output configuration options
output:
Expand Down
33 changes: 26 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include .bingo/Variables.mk
include .busybox-versions

FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print)
FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -path ./internal/cortex -prune -o -name '*.go' -print)
MD_FILES_TO_FORMAT = $(shell find docs -name "*.md") $(shell find examples -name "*.md") $(filter-out mixin/runbook.md, $(shell find mixin -name "*.md")) $(shell ls *.md)
FAST_MD_FILES_TO_FORMAT = $(shell git diff --name-only | grep ".md")

Expand Down Expand Up @@ -173,6 +173,25 @@ deps: ## Ensures fresh go.mod and go.sum.
@go mod tidy
@go mod verify

# NOTICE: This is a temporary workaround for the cyclic dependency issue documented in:
# https://github.com/thanos-io/thanos/issues/3832
# The real solution is to have our own version of needed packages, or extract them out from a dedicated module.
# vendor dependencies
.PHONY: internal/cortex
internal/cortex: ## Ensures the latest packages from 'cortex' are synced.
rm -rf internal/cortex
rm -rf tmp/cortex
git clone --depth 1 https://github.com/cortexproject/cortex tmp/cortex
mkdir -p internal/cortex
rsync -avur --delete tmp/cortex/pkg/* internal/cortex --include-from=.cortex-packages.txt
mkdir -p internal/cortex/integration
cp -R tmp/cortex/integration/ca internal/cortex/integration/ca
find internal/cortex -type f -exec sed -i 's/github.com\/cortexproject\/cortex\/pkg/github.com\/thanos-io\/thanos\/internal\/cortex/g' {} +
find internal/cortex -type f -exec sed -i 's/github.com\/cortexproject\/cortex\/integration/github.com\/thanos-io\/thanos\/internal\/cortex\/integration/g' {} +
rm -rf tmp/cortex
@echo ">> ensuring Copyright headers"
@go run ./scripts/copyright

.PHONY: docker
docker: ## Builds 'thanos' docker with no tag.
ifeq ($(OS)_$(ARCH), linux_x86_64)
Expand Down Expand Up @@ -286,7 +305,7 @@ test: export GOCACHE= $(TMP_GOPATH)/gocache
test: export THANOS_TEST_MINIO_PATH= $(MINIO)
test: export THANOS_TEST_PROMETHEUS_PATHS= $(PROMETHEUS_ARRAY)
test: export THANOS_TEST_ALERTMANAGER_PATH= $(ALERTMANAGER)
test: check-git install-deps
test: check-git install-tool-deps
@echo ">> install thanos GOOPTS=${GOOPTS}"
@echo ">> running unit tests (without /test/e2e). Do export THANOS_TEST_OBJSTORE_SKIP=GCS,S3,AZURE,SWIFT,COS,ALIYUNOSS,BOS if you want to skip e2e tests against all real store buckets. Current value: ${THANOS_TEST_OBJSTORE_SKIP}"
@go test $(shell go list ./... | grep -v /vendor/ | grep -v /test/e2e);
Expand Down Expand Up @@ -317,13 +336,13 @@ test-e2e-local:

.PHONY: quickstart
quickstart: ## Installs and runs a quickstart example of thanos.
quickstart: build install-deps
quickstart: build install-tool-deps
quickstart:
scripts/quickstart.sh

.PHONY: install-deps
install-deps: ## Installs dependencies for integration tests. It installs supported versions of Prometheus and alertmanager to test against in integration tests.
install-deps: $(ALERTMANAGER) $(MINIO) $(PROMETHEUS_ARRAY)
.PHONY: install-tool-deps
install-tool-deps: ## Installs dependencies for integration tests. It installs supported versions of Prometheus and alertmanager to test against in integration tests.
install-tool-deps: $(ALERTMANAGER) $(MINIO) $(PROMETHEUS_ARRAY)
@echo ">>GOBIN=$(GOBIN)"

.PHONY: check-git
Expand Down Expand Up @@ -376,7 +395,7 @@ github.com/prometheus/client_golang/prometheus.{DefaultGatherer,DefBuckets,NewUn
github.com/prometheus/client_golang/prometheus.{NewCounter,NewCounterVec,NewCounterVec,NewGauge,NewGaugeVec,NewGaugeFunc,\
NewHistorgram,NewHistogramVec,NewSummary,NewSummaryVec}=github.com/prometheus/client_golang/prometheus/promauto.{NewCounter,\
NewCounterVec,NewCounterVec,NewGauge,NewGaugeVec,NewGaugeFunc,NewHistorgram,NewHistogramVec,NewSummary,NewSummaryVec},\
sync/atomic=go.uber.org/atomic" ./...
sync/atomic=go.uber.org/atomic,github.com/cortexproject/cortex=github.com/thanos-io/thanos/internal/cortex" $(shell go list ./... | grep -v "internal/cortex")
@$(FAILLINT) -paths "fmt.{Print,Println,Sprint}" -ignore-tests ./...
@echo ">> linting all of the Go files GOGC=${GOGC}"
@$(GOLANGCI_LINT) run
Expand Down
11 changes: 5 additions & 6 deletions cmd/thanos/query_frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import (
"time"

"github.com/NYTimes/gziphandler"
cortexfrontend "github.com/cortexproject/cortex/pkg/frontend"
"github.com/cortexproject/cortex/pkg/frontend/transport"
"github.com/cortexproject/cortex/pkg/querier/queryrange"
cortexvalidation "github.com/cortexproject/cortex/pkg/util/validation"
extflag "github.com/efficientgo/tools/extkingpin"
"github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/oklog/run"
Expand All @@ -22,8 +19,10 @@ import (
"github.com/weaveworks/common/user"
"gopkg.in/yaml.v2"

extflag "github.com/efficientgo/tools/extkingpin"

cortexfrontend "github.com/thanos-io/thanos/internal/cortex/frontend"
"github.com/thanos-io/thanos/internal/cortex/frontend/transport"
"github.com/thanos-io/thanos/internal/cortex/querier/queryrange"
cortexvalidation "github.com/thanos-io/thanos/internal/cortex/util/validation"
"github.com/thanos-io/thanos/pkg/api"
"github.com/thanos-io/thanos/pkg/component"
"github.com/thanos-io/thanos/pkg/extkingpin"
Expand Down
50 changes: 27 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/cespare/xxhash/v2 v2.1.2
github.com/chromedp/cdproto v0.0.0-20200424080200-0de008e41fa0
github.com/chromedp/chromedp v0.5.3
github.com/cortexproject/cortex v1.12.0-rc.0.0.20220711221148-77a7e11cc893
github.com/davecgh/go-spew v1.1.1
github.com/efficientgo/e2e v0.12.1
github.com/efficientgo/tools/core v0.0.0-20210829154005-c7bad8450208
Expand All @@ -40,7 +39,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/golang/snappy v0.0.4
github.com/googleapis/gax-go v2.0.2+incompatible
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/go-grpc-middleware/providers/kit/v2 v2.0.0-20201002093600-73cf2ae9d891
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.2.0.20201207153454-9f6bf00c00a7
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
Expand Down Expand Up @@ -97,7 +96,26 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

require github.com/stretchr/testify v1.7.2
require (
github.com/armon/go-metrics v0.3.9
github.com/dustin/go-humanize v1.0.0
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2
github.com/hashicorp/consul/api v1.13.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-sockaddr v1.0.2
github.com/hashicorp/memberlist v0.3.1
github.com/json-iterator/go v1.1.12
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e
github.com/opentracing-contrib/go-stdlib v1.0.0
github.com/sony/gobreaker v0.4.1
github.com/stretchr/testify v1.7.1
go.etcd.io/etcd/api/v3 v3.5.4
go.etcd.io/etcd/client/pkg/v3 v3.5.4
go.etcd.io/etcd/client/v3 v3.5.4
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65
)

require (
cloud.google.com/go v0.100.2 // indirect
Expand All @@ -109,9 +127,9 @@ require (
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/OneOfOne/xxhash v1.2.6 // indirect
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/armon/go-metrics v0.3.9 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/aws/aws-sdk-go v1.44.29 // indirect
Expand All @@ -124,13 +142,13 @@ require (
github.com/aws/aws-sdk-go-v2/service/sso v1.9.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.14.0 // indirect
github.com/aws/smithy-go v1.10.0 // indirect
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/elastic/go-sysinfo v1.1.1 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
Expand All @@ -153,30 +171,22 @@ require (
github.com/gobwas/ws v1.0.2 // indirect
github.com/gogo/googleapis v1.4.0 // indirect
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20220608213341-c488b8fa1db3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/grafana/regexp v0.0.0-20220304095617-2e8d9baf4ac2 // indirect
github.com/hashicorp/consul/api v1.13.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v0.16.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/memberlist v0.3.1 // indirect
github.com/hashicorp/serf v0.9.6 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/klauspost/cpuid/v2 v2.0.14 // indirect
github.com/knq/sysutil v0.0.0-20191005231841-15668db23d08 // indirect
Expand All @@ -194,26 +204,22 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mozillazg/go-httpheader v0.2.1 // indirect
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e // indirect
github.com/opentracing-contrib/go-stdlib v1.0.0 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/prometheus/node_exporter v1.0.0-rc.0.0.20200428091818-01054558c289 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/santhosh-tekuri/jsonschema v1.2.4 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
github.com/sercand/kuberesolver v2.4.0+incompatible // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sony/gobreaker v0.4.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/weaveworks/promrus v1.2.0 // indirect
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da // indirect
go.elastic.co/apm/module/apmhttp v1.11.0 // indirect
go.elastic.co/fastjson v1.1.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.mongodb.org/mongo-driver v1.8.4 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 // indirect
Expand All @@ -222,7 +228,6 @@ require (
go.uber.org/zap v1.21.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
golang.org/x/tools v0.1.10 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand All @@ -236,7 +241,6 @@ replace (
// Required by Cortex https://github.com/cortexproject/cortex/pull/3051.
github.com/bradfitz/gomemcache => github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab

github.com/efficientgo/tools/core => github.com/efficientgo/tools/core v0.0.0-20210731122119-5d4a0645ce9a
// Update to v1.1.1 to make sure windows CI pass.
github.com/elastic/go-sysinfo => github.com/elastic/go-sysinfo v1.1.1

Expand All @@ -251,7 +255,7 @@ replace (
github.com/vimeo/galaxycache => github.com/thanos-community/galaxycache v0.0.0-20211122094458-3a32041a1f1e
google.golang.org/grpc => google.golang.org/grpc v1.40.1

// Overriding to use latest commit
// Overriding to use latest commit.
gopkg.in/alecthomas/kingpin.v2 => github.com/alecthomas/kingpin v1.3.8-0.20210301060133-17f40c25f497

// From Prometheus.
Expand Down
Loading

0 comments on commit efbcf0c

Please sign in to comment.