[#369] Add loghttp Make targets
All checks were successful
/ Vulncheck (pull_request) Successful in 1m9s
/ DCO (pull_request) Successful in 53s
/ Builds (1.20) (pull_request) Successful in 1m27s
/ Builds (1.21) (pull_request) Successful in 1m30s
/ Lint (pull_request) Successful in 2m23s
/ Tests (1.20) (pull_request) Successful in 1m37s
/ Tests (1.21) (pull_request) Successful in 1m36s

Add the following Make targets: loghttp, docker/loghttp, image-loghttp.

Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
Nikita Zinkevich 2024-07-30 14:30:31 +03:00
parent e72871ab40
commit 4d6da10eda
5 changed files with 26 additions and 10 deletions

View file

@ -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 TARGET=""
WORKDIR /src
COPY . /src
RUN make
RUN make ${TARGET}
# Executable image
FROM alpine AS frostfs-s3-gw

View file

@ -14,6 +14,10 @@ METRICS_DUMP_OUT ?= ./metrics-dump.json
CMDS = $(addprefix frostfs-, $(notdir $(wildcard cmd/*)))
BINS = $(addprefix $(BINDIR)/, $(CMDS))
# Variables for loghttp
BUILD_TAGS ?=
TARGET ?= ""
# Variables for docker
REPO_BASENAME = $(shell basename `go list -m`)
HUB_IMAGE ?= "truecloudlab/$(REPO_BASENAME)"
@ -35,11 +39,17 @@ PKG_VERSION ?= $(shell echo $(VERSION) | sed "s/^v//" | \
# Make all binaries
all: $(BINS)
# Make binaries with http_logging feature in s3-gw
loghttp:
$(MAKE) BINS="$(filter %-s3-gw,$(BINS))" BUILD_TAGS="loghttp" $(BINS)
$(MAKE) BINS="$(filter-out %-s3-gw,$(BINS))" $(BINS)
$(BINS): $(BINDIR) dep
@echo "⇒ Build $@"
CGO_ENABLED=0 \
go build -v -trimpath \
-ldflags "-X $(REPO)/internal/version.Version=$(VERSION)" \
-tags "$(BUILD_TAGS)" \
-o $@ ./cmd/$(subst frostfs-,,$(notdir $@))
$(BINDIR):
@ -57,7 +67,7 @@ dep:
# Run `make %` in Golang container, for more information run `make help.docker/%`
docker/%:
$(if $(filter $*,all $(BINS)), \
$(if $(filter $*,all loghttp $(BINS)), \
@echo "=> Running 'make $*' in clean Docker environment" && \
docker run --rm -t \
-v `pwd`:/src \
@ -87,10 +97,14 @@ image:
@docker build \
--build-arg REPO=$(REPO) \
--build-arg VERSION=$(VERSION) \
--build-arg TARGET=$(TARGET) \
--rm \
-f .docker/Dockerfile \
-t $(HUB_IMAGE):$(HUB_TAG) .
image-loghttp:
$(MAKE) TARGET=loghttp image
# Push Docker image to the hub
image-push:
@echo "⇒ Publish image"

View file

@ -377,7 +377,8 @@ logger:
### `http_logging` section
Could be enabled only in builds with `loghttp` build tag.
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:

View file

@ -32,12 +32,12 @@ If corresponding flag is set, it overrides parameter from config.
### Configuration parameters
#### Global params
| # | Parameter | Flag name | Type | Default value | Description |
|---|-----------------------|-----------------|--------|---------------|--------------------------------------------------------------------|
| 1 | http_timeout | http-timeout | int | 60 | http request timeout |
| 2 | skip_verify_tls | skip-verify-tls | bool | false | skips tls certificate verification for self-signed https endpoints |
| 3 | credentials.accessKey | - | string | - | AWS access key id |
| 4 | credentials.secretKey | - | string | - | AWS secret key |
| # | Parameter | Flag name | Type | Default value | Description |
|---|-----------------------|-----------------|--------|---------------|--------------------------------------------------------|
| 1 | http_timeout | http-timeout | int | 60 | http request timeout |
| 2 | skip_verify_tls | skip-verify-tls | bool | false | skips tls certificate verification for https endpoints |
| 3 | credentials.accessKey | - | string | - | AWS access key id |
| 4 | credentials.secretKey | - | string | - | AWS secret key |
#### `run` command parameters
| # | Parameter | Flag name | Type | Default value | Description |

View file

@ -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'