[#369] Add env GOFLAGS passing in Make targets
All checks were successful
/ Vulncheck (pull_request) Successful in 1m6s
/ Builds (1.20) (pull_request) Successful in 1m20s
/ Builds (1.21) (pull_request) Successful in 1m18s
/ DCO (pull_request) Successful in 40s
/ Lint (pull_request) Successful in 1m43s
/ Tests (1.20) (pull_request) Successful in 1m19s
/ Tests (1.21) (pull_request) Successful in 1m17s
All checks were successful
/ Vulncheck (pull_request) Successful in 1m6s
/ Builds (1.20) (pull_request) Successful in 1m20s
/ Builds (1.21) (pull_request) Successful in 1m18s
/ DCO (pull_request) Successful in 40s
/ Lint (pull_request) Successful in 1m43s
/ Tests (1.20) (pull_request) Successful in 1m19s
/ Tests (1.21) (pull_request) Successful in 1m17s
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
parent
86c8c5bc86
commit
7532afd237
4 changed files with 11 additions and 3 deletions
|
@ -3,11 +3,12 @@ FROM golang:1.21 as builder
|
|||
ARG BUILD=now
|
||||
ARG REPO=git.frostfs.info/TrueCloudLab/frostfs-s3-gw
|
||||
ARG VERSION=dev
|
||||
ARG GOFLAGS=""
|
||||
|
||||
WORKDIR /src
|
||||
COPY . /src
|
||||
|
||||
RUN make
|
||||
RUN make GOFLAGS=${GOFLAGS}
|
||||
|
||||
# Executable image
|
||||
FROM alpine AS frostfs-s3-gw
|
||||
|
|
6
Makefile
6
Makefile
|
@ -14,6 +14,8 @@ METRICS_DUMP_OUT ?= ./metrics-dump.json
|
|||
CMDS = $(addprefix frostfs-, $(notdir $(wildcard cmd/*)))
|
||||
BINS = $(addprefix $(BINDIR)/, $(CMDS))
|
||||
|
||||
GOFLAGS ?=
|
||||
|
||||
# Variables for docker
|
||||
REPO_BASENAME = $(shell basename `go list -m`)
|
||||
HUB_IMAGE ?= "truecloudlab/$(REPO_BASENAME)"
|
||||
|
@ -38,6 +40,7 @@ all: $(BINS)
|
|||
$(BINS): $(BINDIR) dep
|
||||
@echo "⇒ Build $@"
|
||||
CGO_ENABLED=0 \
|
||||
GOFLAGS=$(GOFLAGS) \
|
||||
go build -v -trimpath \
|
||||
-ldflags "-X $(REPO)/internal/version.Version=$(VERSION)" \
|
||||
-o $@ ./cmd/$(subst frostfs-,,$(notdir $@))
|
||||
|
@ -64,7 +67,7 @@ docker/%:
|
|||
-w /src \
|
||||
-u `stat -c "%u:%g" .` \
|
||||
--env HOME=/src \
|
||||
golang:$(GO_VERSION) make $*,\
|
||||
golang:$(GO_VERSION) make GOFLAGS=$(GOFLAGS) $*,\
|
||||
@echo "supported docker targets: all $(BINS) lint")
|
||||
|
||||
# Run tests
|
||||
|
@ -87,6 +90,7 @@ image:
|
|||
@docker build \
|
||||
--build-arg REPO=$(REPO) \
|
||||
--build-arg VERSION=$(VERSION) \
|
||||
--build-arg GOFLAGS=$(GOFLAGS) \
|
||||
--rm \
|
||||
-f .docker/Dockerfile \
|
||||
-t $(HUB_IMAGE):$(HUB_TAG) .
|
||||
|
|
|
@ -377,6 +377,9 @@ logger:
|
|||
|
||||
### `http_logging` section
|
||||
|
||||
Could be enabled only in builds with `loghttp` build tag. This could be done via `loghttp`,
|
||||
`docker/loghttp` or `image-loghttp` Make targets.
|
||||
|
||||
```yaml
|
||||
http_logging:
|
||||
enabled: false
|
||||
|
|
2
help.mk
2
help.mk
|
@ -12,7 +12,7 @@ help:
|
|||
|
||||
# Show help for docker/% IGNORE
|
||||
help.docker/%:
|
||||
$(eval TARGETS:=$(notdir all lint) ${BINS})
|
||||
$(eval TARGETS:=$(notdir all lint loghttp) ${BINS})
|
||||
@echo ' Usage:'
|
||||
@echo ''
|
||||
@echo ' make docker/% -- Run `make %` in Golang container'
|
||||
|
|
Loading…
Reference in a new issue