-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix cleanup worker error and support multi platforms
Signed-off-by: duanmengkk <[email protected]>
- Loading branch information
1 parent
b6938f4
commit a2e0214
Showing
161 changed files
with
276 additions
and
28,291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,4 @@ jobs: | |
with: | ||
go-version: '1.20' | ||
- name: Compile | ||
run: make build | ||
run: make all |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,40 +8,101 @@ REGISTRY_USER_NAME?="" | |
REGISTRY_PASSWORD?="" | ||
REGISTRY_SERVER_ADDRESS?="" | ||
|
||
TARGETS := eps-probe-plugin | ||
|
||
# Build code. | ||
.PHONY: build | ||
build: | ||
@make build-eps-probe-plugin GOOS=linux GOARCH=amd64 | ||
# @make build-eps-probe-plugin GOOS=linux GOARCH=arm64 | ||
# @make build-eps-probe-plugin GOOS=darwin GOARCH=amd64 | ||
# @make build-eps-probe-plugin GOOS=darwin GOARCH=arm64 | ||
# | ||
# Args: | ||
# GOOS: OS to build. | ||
# GOARCH: Arch to build. | ||
# | ||
# Example: | ||
# make | ||
# make all | ||
# make eps-probe-plugin | ||
# make eps-probe-plugin GOOS=linux | ||
CMD_TARGET=$(TARGETS) | ||
|
||
.PHONY: all | ||
all: $(CMD_TARGET) | ||
|
||
build-eps-probe-plugin: | ||
hack/build.sh eps-probe-plugin ${GOOS} ${GOARCH} | ||
.PHONY: $(CMD_TARGET) | ||
$(CMD_TARGET): | ||
BUILD_PLATFORMS=$(GOOS)/$(GOARCH) hack/build.sh $@ | ||
|
||
# Build image. | ||
.PHONY: image | ||
image: build | ||
@make image-eps-probe-plugin GOOS=linux GOARCH=amd64 | ||
# | ||
# Args: | ||
# GOARCH: Arch to build. | ||
# OUTPUT_TYPE: Destination to save image(docker/registry). | ||
# | ||
# Example: | ||
# make images | ||
# make image-eps-probe-plugin | ||
# make image-eps-probe-plugin GOARCH=arm64 | ||
IMAGE_TARGET=$(addprefix image-, $(TARGETS)) | ||
.PHONY: $(IMAGE_TARGET) | ||
$(IMAGE_TARGET): | ||
set -e;\ | ||
target=$$(echo $(subst image-,,$@));\ | ||
make $$target GOOS=linux;\ | ||
VERSION=$(VERSION) REGISTRY=$(REGISTRY) BUILD_PLATFORMS=linux/$(GOARCH) hack/docker.sh $$target | ||
|
||
images: $(IMAGE_TARGET) | ||
|
||
# Build and push multi-platform image to DockerHub | ||
# | ||
# Example | ||
# make multi-platform-images | ||
# make mp-image-eps-probe-plugin | ||
MP_TARGET=$(addprefix mp-image-, $(TARGETS)) | ||
.PHONY: $(MP_TARGET) | ||
$(MP_TARGET): | ||
set -e;\ | ||
target=$$(echo $(subst mp-image-,,$@));\ | ||
make $$target GOOS=linux GOARCH=amd64;\ | ||
VERSION=$(VERSION) REGISTRY=$(REGISTRY) \ | ||
OUTPUT_TYPE=docker \ | ||
BUILD_PLATFORMS=linux/amd64 \ | ||
hack/docker.sh $$target | ||
|
||
multi-platform-images: $(MP_TARGET) | ||
|
||
image-eps-probe-plugin: | ||
VERSION=$(VERSION) REGISTRY=$(REGISTRY) hack/docker.sh eps-probe-plugin ${GOOS} ${GOARCH} | ||
.PHONY: clean | ||
clean: | ||
rm -rf _tmp _output | ||
|
||
# TODO Build and push multi-platform image to DockerHub | ||
upload-images: image | ||
.PHONY: update | ||
update: | ||
hack/update-all.sh | ||
|
||
.PHONY: verify | ||
verify: | ||
hack/verify-all.sh | ||
|
||
.PHONY: test | ||
test: | ||
mkdir -p ./_output/coverage/ | ||
go test --race --v ./pkg/... -coverprofile=./_output/coverage/coverage_pkg.txt -covermode=atomic | ||
go test --race --v ./cmd/... -coverprofile=./_output/coverage/coverage_cmd.txt -covermode=atomic | ||
|
||
upload-images: images | ||
@echo "push images to $(REGISTRY)" | ||
docker tag ${REGISTRY}/eps-probe-plugin:${VERSION} ${REGISTRY}/eps-probe-plugin:latest | ||
docker push ${REGISTRY}/eps-probe-plugin:${VERSION} | ||
docker push ${REGISTRY}/eps-probe-plugin:latest | ||
|
||
.PHONY: lint | ||
lint: golangci-lint | ||
$(GOLANGLINT_BIN) run | ||
|
||
.PHONY: lint-fix | ||
lint-fix: golangci-lint | ||
$(GOLANGLINT_BIN) run --fix | ||
|
||
golangci-lint: | ||
ifeq (, $(shell which golangci-lint)) | ||
GO111MODULE=on go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
GOLANGLINT_BIN=$(shell go env GOPATH)/bin/golangci-lint | ||
else | ||
GOLANGLINT_BIN=$(shell which golangci-lint) | ||
endif | ||
endif | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM alpine:3.15.0 | ||
|
||
ARG BINARY | ||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | ||
RUN apk add --no-cache ca-certificates | ||
|
||
COPY ${BINARY} /bin/${BINARY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM alpine:3.15.0 | ||
|
||
ARG BINARY | ||
ARG TARGETPLATFORM | ||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | ||
|
||
RUN apk add --no-cache ca-certificates | ||
|
||
COPY ${TARGETPLATFORM}/${BINARY} /bin/${BINARY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.