-
Notifications
You must be signed in to change notification settings - Fork 290
feat: add help for makefile and unify variable in Dockerfile #819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bobsongplus
wants to merge
1
commit into
Project-HAMi:master
Choose a base branch
from
bobsongplus:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -3,7 +3,13 @@ include version.mk Makefile.defs | |
|
||
all: build | ||
|
||
docker: | ||
.PHONY: help | ||
help: ## Display this help. | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
|
||
##@ Build | ||
.PHONY: docker-build | ||
docker-build: ## Build docker image with the vgpu. | ||
docker build \ | ||
--build-arg GOLANG_IMAGE=${GOLANG_IMAGE} \ | ||
--build-arg TARGET_ARCH=${TARGET_ARCH} \ | ||
|
@@ -13,7 +19,8 @@ docker: | |
--build-arg GOPROXY=https://goproxy.cn,direct \ | ||
. -f=docker/Dockerfile -t ${IMG_TAG} | ||
|
||
dockerwithlib: | ||
.PHONY: docker-buildwithlib | ||
docker-buildwithlib: ## Build docker image without the enterprise vgpu and vgpuvalidator. | ||
docker build \ | ||
--no-cache \ | ||
--build-arg GOLANG_IMAGE=${GOLANG_IMAGE} \ | ||
|
@@ -27,11 +34,16 @@ dockerwithlib: | |
tidy: | ||
$(GO) mod tidy | ||
|
||
.PHONY: lint | ||
lint: | ||
bash hack/verify-staticcheck.sh | ||
|
||
proto: | ||
$(GO) get github.com/gogo/protobuf/[email protected] | ||
protoc --gofast_out=plugins=grpc:. ./pkg/api/*.proto | ||
|
||
build: $(CMDS) $(DEVICES) | ||
.PHONY: build | ||
build: tidy lint $(CMDS) $(DEVICES) ## Build hami-scheduler,hami-device-plugin,vGPUmonitor binary | ||
|
||
$(CMDS): | ||
$(GO) build -ldflags '-s -w -X github.com/Project-HAMi/HAMi/pkg/version.version=$(VERSION)' -o ${OUTPUT_DIR}/$@ ./cmd/$@ | ||
|
@@ -43,21 +55,26 @@ clean: | |
$(GO) clean -r -x ./cmd/... | ||
-rm -rf $(OUTPUT_DIR) | ||
|
||
.PHONY: all build docker clean $(CMDS) | ||
.PHONY: all build docker-build clean $(CMDS) | ||
|
||
test: | ||
##@ Test | ||
.PHONY: test | ||
test: ## Unit test | ||
mkdir -p ./_output/coverage/ | ||
bash hack/unit-test.sh | ||
|
||
lint: | ||
bash hack/verify-staticcheck.sh | ||
.PHONY: e2e-test | ||
e2e-test: ## e2-test | ||
./hack/e2e-test.sh "${E2E_TYPE}" "${KUBE_CONF}" | ||
|
||
.PHONY: e2e-env-setup | ||
e2e-env-setup: | ||
./hack/e2e-test-setup.sh | ||
|
||
.PHONY: verify | ||
verify: | ||
hack/verify-all.sh | ||
|
||
.PHONY: lint_dockerfile | ||
lint_dockerfile: | ||
##@ Security | ||
.PHONY: dockerfile-security | ||
dockerfile-security: ##Scan Dockerfile security | ||
@ docker run --rm \ | ||
-v $(ROOT_DIR)/.trivyignore:/.trivyignore \ | ||
-v /tmp/trivy:/root/trivy.cache/ \ | ||
|
@@ -66,8 +83,8 @@ lint_dockerfile: | |
(($$?==0)) || { echo "error, failed to check dockerfile trivy" && exit 1 ; } ; \ | ||
echo "dockerfile trivy check: pass" | ||
|
||
.PHONY: lint_chart | ||
lint_chart: | ||
.PHONY: chart-security | ||
chart-security: ##Scan Charts security | ||
@ docker run --rm \ | ||
-v $(ROOT_DIR)/.trivyignore:/.trivyignore \ | ||
-v /tmp/trivy:/root/trivy.cache/ \ | ||
|
@@ -76,14 +93,15 @@ lint_chart: | |
(($$?==0)) || { echo "error, failed to check chart trivy" && exit 1 ; } ; \ | ||
echo "chart trivy check: pass" | ||
|
||
.PHONY: e2e-env-setup | ||
e2e-env-setup: | ||
./hack/e2e-test-setup.sh | ||
|
||
|
||
##@ Deploy | ||
.PHONY: helm-deploy | ||
helm-deploy: | ||
helm-deploy: ##Deploy hami to the K8s cluster specified in ~/.kube/config. | ||
./hack/deploy-helm.sh "${E2E_TYPE}" "${KUBE_CONF}" "${HAMI_VERSION}" | ||
|
||
.PHONY: e2e-test | ||
e2e-test: | ||
./hack/e2e-test.sh "${E2E_TYPE}" "${KUBE_CONF}" | ||
|
||
.PHONY: verify | ||
verify: | ||
hack/verify-all.sh | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -2,10 +2,11 @@ ARG GOLANG_IMAGE | |
ARG NVIDIA_IMAGE | ||
FROM $GOLANG_IMAGE AS build | ||
|
||
FROM $GOLANG_IMAGE AS GOBUILD | ||
FROM $GOLANG_IMAGE AS gobuild | ||
ARG VERSION | ||
|
||
ADD . /k8s-vgpu | ||
ARG GOPROXY=https://goproxy.cn,direct | ||
ARG VERSION | ||
RUN go env -w GO111MODULE=on | ||
RUN cd /k8s-vgpu && make all VERSION=$VERSION | ||
RUN go install github.com/NVIDIA/mig-parted/cmd/nvidia-mig-parted@latest | ||
|
@@ -19,9 +20,10 @@ ENV NVIDIA_DRIVER_CAPABILITIES=utility | |
ARG VERSION | ||
LABEL version="$VERSION" | ||
LABEL maintainer="[email protected]" | ||
|
||
COPY ./LICENSE /k8s-vgpu/LICENSE | ||
COPY --from=GOBUILD /k8s-vgpu/bin /k8s-vgpu/bin | ||
COPY --from=GOBUILD /go/bin/nvidia-mig-parted /k8s-vgpu/bin/ | ||
COPY --from=gobuild /k8s-vgpu/bin /k8s-vgpu/bin | ||
COPY --from=gobuild /go/bin/nvidia-mig-parted /k8s-vgpu/bin/ | ||
COPY ./docker/entrypoint.sh /k8s-vgpu/bin/entrypoint.sh | ||
COPY ./docker/vgpu-init.sh /k8s-vgpu/bin/vgpu-init.sh | ||
COPY ./lib /k8s-vgpu/lib | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not add GOPROXY, it may block the CI