diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3366ab1a..22578890 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -36,8 +36,6 @@ jobs: echo "$HOME/gotip/bin" >> $GITHUB_PATH - name: Checkout code uses: percona-platform/checkout@v2 - - name: Build - run: make build - name: Run checks run: | go build -modfile=tools/go.mod -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint @@ -54,10 +52,6 @@ jobs: AWS_ACCESS_KEY: AKIAZPBRO3QWCEHJTL35 AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} run: make codecov - - name: Build tarball - run: make tarball - - name: Build tarball - run: make docker - name: Run debug commands on failure if: ${{ failure() }} run: | diff --git a/.goreleaser.yml b/.goreleaser.yml index c7ae34d8..9feaadfc 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -18,7 +18,11 @@ builds: flags: - -v ldflags: - - -s -w -X main.version=v{{.Version}} -X main.commit={{.ShortCommit}} -X main.buildDate={{.Date}} + - -s -w + - -X github.com/prometheus/common/version.Version={{ .Version }} + - -X github.com/prometheus/common/version.Revision={{ .ShortCommit }} + - -X github.com/prometheus/common/version.Branch={{ .Branch }} + - -X github.com/prometheus/common/version.BuildDate={{ .Date }} archives: - name_template: "{{ .ProjectName }}-{{ .Version }}.{{ .Os }}-{{ .Arch }}" wrap_in_directory: true diff --git a/.promu.yml b/.promu.yml deleted file mode 100644 index 02facbe7..00000000 --- a/.promu.yml +++ /dev/null @@ -1,22 +0,0 @@ -go: - cgo: false -repository: - path: github.com/percona/rds_exporter -build: - flags: -a -tags netgo - ldflags: | - -X {{repoPath}}/vendor/github.com/prometheus/common/version.Version={{.Version}} - -X {{repoPath}}/vendor/github.com/prometheus/common/version.Revision={{.Revision}} - -X {{repoPath}}/vendor/github.com/prometheus/common/version.Branch={{.Branch}} - -X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildUser={{user}}@{{host}} - -X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} -tarball: - files: - - LICENSE - # - config.yml -crossbuild: - platforms: - - linux/amd64 - - linux/386 - - darwin/amd64 - - darwin/386 diff --git a/Dockerfile b/Dockerfile index c175bce7..e05cd0d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.16 as build COPY . /usr/src/rds_exporter -RUN cd /usr/src/rds_exporter && make build +RUN cd /usr/src/rds_exporter FROM alpine:latest diff --git a/Makefile b/Makefile index 14f4e6fc..85be5980 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,6 @@ # limitations under the License. GO := go -PROMU := bin/promu pkgs = $(shell $(GO) list ./...) PREFIX ?= $(shell pwd) @@ -42,23 +41,10 @@ vet: @echo ">> vetting code" @$(GO) vet $(pkgs) -build: promu - @echo ">> building binaries" - @$(PROMU) build --prefix $(PREFIX) - -tarball: promu - @echo ">> building release tarball" - @$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) - docker: @echo ">> building docker image $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" @docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . -promu: - @GOOS=$(shell uname -s | tr A-Z a-z) \ - GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \ - $(GO) build -modfile=tools/go.mod -o bin/promu github.com/prometheus/promu - check: bin/golangci-lint run -c=.golangci.yml --out-format=line-number @@ -68,5 +54,3 @@ codecov: gocoverutil gocoverutil: @$(GO) build -modfile=tools/go.mod -o bin/gocoverutil github.com/AlekSi/gocoverutil - -.PHONY: all style format build test vet tarball docker promu diff --git a/tools/go.mod b/tools/go.mod index 461b6f18..8ab28308 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -5,6 +5,8 @@ go 1.15 require ( github.com/AlekSi/gocoverutil v0.2.0 github.com/golangci/golangci-lint v1.40.1 - github.com/prometheus/promu v0.12.0 + github.com/prometheus/client_golang v1.7.1 // indirect github.com/reviewdog/reviewdog v0.11.0 + google.golang.org/api v0.33.0 // indirect + google.golang.org/grpc v1.32.0 // indirect ) diff --git a/tools/go.sum b/tools/go.sum index 9fd501a4..68c96d96 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -641,6 +641,7 @@ github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.19.0 h1:Itb4+NjG9wRdkAWgVucbM/adyIXxEhbw0866e0uZE6A= github.com/prometheus/common v0.19.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= @@ -651,8 +652,6 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/promu v0.12.0 h1:Y0zJJfaZo1i4SaLVFpcqUrkLUdeJyGGYkuJ3Q+IvDrE= -github.com/prometheus/promu v0.12.0/go.mod h1:pO1U0Qd0Id6Gt2xBrtsuyJ2L3q1hbTMx/o3phrr0pY4= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/pseudomuto/protoc-gen-doc v1.3.2/go.mod h1:y5+P6n3iGrbKG+9O04V5ld71in3v/bX88wUwgt+U8EA= github.com/pseudomuto/protokit v0.2.0/go.mod h1:2PdH30hxVHsup8KpBTOXTBeMVhJZVio3Q8ViKSAXT0Q= @@ -932,6 +931,7 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 h1:ld7aEMNHoBnnDAX15v1T6z31v8HwR2A9FYOuAhWqkwc= golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84 h1:duBc5zuJsmJXYOVVE/6PxejI+N3AaCqKjtsoLn1Je5Q= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= diff --git a/tools/tools.go b/tools/tools.go index 37daefb8..243caa44 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -6,8 +6,7 @@ package tools import ( + _ "github.com/AlekSi/gocoverutil" _ "github.com/golangci/golangci-lint/cmd/golangci-lint" - _ "github.com/prometheus/promu" _ "github.com/reviewdog/reviewdog/cmd/reviewdog" - _ "github.com/AlekSi/gocoverutil" )