-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (53 loc) · 1.82 KB
/
Copy pathMakefile
File metadata and controls
63 lines (53 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export CGO_ENABLED=0
export VERSION?=$(shell git describe --tags --abbrev=0)
ARCH := $(shell uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')
PLATFORM := linux/$(ARCH)
all: sacloud-otel-collector
ocb:
curl --proto '=https' --tlsv1.2 -fL -o ocb \
https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fbuilder%2Fv0.154.0/ocb_0.154.0_linux_amd64
chmod +x ocb
.PHONY: build-src
build-src: ocb
./ocb \
--config=builder-config.yaml \
--skip-compilation
perl -pi -E 's{^\s*Version:\s*.*,}{Version: Version,}' cmd/sacloud-otel-collector/main.go
# Fix absolute paths in replace directives to relative paths
perl -pi -E 's{=> \S+/(exporter/sacloudexporter)$$}{=> ../../$$1}' cmd/sacloud-otel-collector/go.mod
cd cmd/sacloud-otel-collector && go fmt ./...
sacloud-otel-collector: cmd/sacloud-otel-collector/*.go cmd/sacloud-otel-collector/go.* exporter/sacloudexporter/*.go exporter/sacloudexporter/*
cd cmd/sacloud-otel-collector && go build -o ../../sacloud-otel-collector .
.PHONY: test
test: sacloud-otel-collector
@for f in testdata/*.yaml; do \
echo "Validating $$f..."; \
./sacloud-otel-collector validate --config "$$f"; \
done
.PHONY: dist
dist:
goreleaser build --snapshot --clean
.PHONY: release
release:
goreleaser release --clean
.PHONY: clean
clean:
rm -rf dist sacloud-otel-collector
.PHONY: docker-push
docker-push:
docker buildx build \
--build-arg VERSION=$(VERSION) \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/sacloud/sacloud-otel-collector:$(VERSION) \
-t ghcr.io/sacloud/sacloud-otel-collector:latest \
--push \
.
.PHONY: docker-load
docker-load:
docker buildx build \
--build-arg VERSION=$(VERSION) \
--platform $(PLATFORM) \
-t ghcr.io/sacloud/sacloud-otel-collector:$(VERSION) \
-t ghcr.io/sacloud/sacloud-otel-collector:latest \
--load \
.