Skip to content
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

[DO NOT MERGE]: Fix format-diff error #2343

Closed
84 changes: 84 additions & 0 deletions .github/workflows/dockers-agent-faiss-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#
# Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: "Build docker image: agent-faiss"
on:
push:
branches:
- "main"
- "release/v*.*"
- "!release/v*.*.*"
tags:
- "*.*.*"
- "v*.*.*"
- "*.*.*-*"
- "v*.*.*-*"
paths:
- ".github/actions/docker-build/actions.yaml"
- ".github/workflows/_docker-image.yaml"
- ".github/workflows/dockers-agent-faiss-image.yml"
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "!internal/k8s/**"
- "apis/grpc/**"
- "pkg/agent/core/faiss/**"
- "cmd/agent/core/faiss/**"
- "dockers/agent/core/faiss/Dockerfile"
- "versions/GO_VERSION"
- "versions/FAISS_VERSION"
pull_request:
paths:
- ".github/actions/docker-build/actions.yaml"
- ".github/workflows/_docker-image.yaml"
- ".github/workflows/dockers-agent-faiss-image.yml"
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "!internal/k8s/**"
- "apis/grpc/**"
- "pkg/agent/core/faiss/**"
- "cmd/agent/core/faiss/**"
- "dockers/agent/core/faiss/Dockerfile"
- "versions/GO_VERSION"
- "versions/FAISS_VERSION"
pull_request_target:
paths:
- ".github/actions/docker-build/actions.yaml"
- ".github/workflows/_docker-image.yaml"
- ".github/workflows/dockers-agent-faiss-image.yml"
- "go.mod"
- "go.sum"
- "internal/**"
- "!internal/**/*_test.go"
- "!internal/db/**"
- "!internal/k8s/**"
- "apis/grpc/**"
- "pkg/agent/core/faiss/**"
- "cmd/agent/core/faiss/**"
- "dockers/agent/core/faiss/Dockerfile"
- "versions/GO_VERSION"
- "versions/FAISS_VERSION"
jobs:
build:
uses: ./.github/workflows/_docker-image.yaml
with:
target: agent-faiss
platforms: linux/amd64
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/dockers-agent-ngt-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ jobs:
uses: ./.github/workflows/_docker-image.yaml
with:
target: agent-ngt
platforms: linux/amd64,linux/arm64
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/dockers-benchmark-job-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ jobs:
uses: ./.github/workflows/_docker-image.yaml
with:
target: benchmark-job
platforms: linux/amd64,linux/arm64
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/dockers-helm-operator-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ jobs:
uses: ./.github/workflows/_docker-image.yaml
with:
target: operator/helm
platforms: linux/amd64,linux/arm64
secrets: inherit
8 changes: 5 additions & 3 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Run formatter and license.go
run: |
make format
git checkout go.mod go.sum
git checkout go.mod go.sum ./rust/Cargo.lock
- name: Check and Push to main branch
continue-on-error: true
run: |
Expand Down Expand Up @@ -90,7 +90,8 @@ jobs:
runs-on: ubuntu-latest
needs: [detect-ci-container]
container:
image: ghcr.io/vdaas/vald/vald-ci-container:${{ needs.detect-ci-container.outputs.TAG_NAME }}
# TODO: revert this change.
image: ghcr.io/vdaas/vald/vald-ci-container:pr-2334
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -105,9 +106,10 @@ jobs:
run: |
make deps/install
make format
git checkout go.mod go.sum
git checkout go.mod go.sum ./rust/Cargo.lock
- name: Check format difference
run: |
git diff
if git diff --quiet --exit-code; then
echo "Nothing updated"
else
Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ DATETIME = $(eval DATETIME := $(shell date -u +%Y/%m/%d_%
TAG ?= latest
CRORG ?= $(ORG)
GHCRORG = ghcr.io/$(ORG)/$(NAME)
AGENT_IMAGE = $(NAME)-agent-ngt
AGENT_NGT_IMAGE = $(NAME)-agent-ngt
AGENT_FAISS_IMAGE = $(NAME)-agent-faiss
AGENT_SIDECAR_IMAGE = $(NAME)-agent-sidecar
CI_CONTAINER_IMAGE = $(NAME)-ci-container
DEV_CONTAINER_IMAGE = $(NAME)-dev-container
Expand Down Expand Up @@ -386,11 +387,7 @@ clean-generated:
.PHONY: license
## add license to files
license:
GOPRIVATE=$(GOPRIVATE) \
MAINTAINER=$(MAINTAINER) \
GOARCH=$(GOARCH) \
GOOS=$(GOOS) \
go run -mod=readonly hack/license/gen/main.go $(ROOTDIR)
$(call gen-license,$(ROOTDIR),$(MAINTAINER))

.PHONY: init
## initialize development environment
Expand Down Expand Up @@ -571,7 +568,7 @@ faiss/install: /usr/local/lib/libfaiss.so
curl -LO https://github.com/facebookresearch/faiss/archive/v$(FAISS_VERSION).tar.gz
tar zxf v$(FAISS_VERSION).tar.gz -C $(TEMP_DIR)/
cd $(TEMP_DIR)/faiss-$(FAISS_VERSION) && \
cmake -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON -B build . && \
cmake -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -B build . && \
make -C build -j faiss && \
make -C build install
rm -rf v$(FAISS_VERSION).tar.gz
Expand Down
2 changes: 1 addition & 1 deletion Makefile.d/actions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ list/actions:
.PHONY: update/actions
# update github actions version
update/actions:
@$(call update-github-actions, $(ACTIONS_LIST))
$(call update-github-actions, $(ACTIONS_LIST))
26 changes: 13 additions & 13 deletions Makefile.d/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ binary/build: \
cmd/agent/core/ngt/ngt: \
ngt/install
$(eval CGO_ENABLED = 1)
$(call go-build,agent/core/ngt,-linkmode 'external',-fPIC -pthread -fopenmp -std=gnu++20 -lstdc++ -lm -z relro -z now $(EXTLDFLAGS), cgo,NGT-$(NGT_VERSION),$@)
$(call go-build,agent/core/ngt,-linkmode 'external',-static -fPIC -pthread -fopenmp -std=gnu++20 -lstdc++ -lm -z relro -z now $(EXTLDFLAGS), cgo,NGT-$(NGT_VERSION),$@)

cmd/agent/core/faiss/faiss: \
faiss/install
Expand All @@ -45,50 +45,50 @@ cmd/agent/core/faiss/faiss: \

cmd/agent/sidecar/sidecar:
$(eval CGO_ENABLED = 0)
$(call go-build,agent/sidecar,,,,,$@)
$(call go-build,agent/sidecar,,-static,,,$@)

cmd/discoverer/k8s/discoverer:
$(eval CGO_ENABLED = 0)
$(call go-build,discoverer/k8s,,,,,$@)
$(call go-build,discoverer/k8s,,-static,,,$@)

cmd/gateway/lb/lb:
$(eval CGO_ENABLED = 0)
$(call go-build,gateway/lb,,,,,$@)
$(call go-build,gateway/lb,,-static,,,$@)

cmd/gateway/filter/filter:
$(eval CGO_ENABLED = 0)
$(call go-build,gateway/filter,,,,,$@)
$(call go-build,gateway/filter,,-static,,,$@)

cmd/gateway/mirror/mirror:
$(eval CGO_ENABLED = 0)
$(call go-build,gateway/mirror,,,,,$@)
$(call go-build,gateway/mirror,,-static,,,$@)

cmd/manager/index/index:
$(eval CGO_ENABLED = 0)
$(call go-build,manager/index,,,,,$@)
$(call go-build,manager/index,,-static,,,$@)

cmd/index/job/correction/index-correction:
$(eval CGO_ENABLED = 0)
$(call go-build,index/job/correction,,,,,$@)
$(call go-build,index/job/correction,,-static,,,$@)

cmd/index/job/creation/index-creation:
$(eval CGO_ENABLED = 0)
$(call go-build,index/job/creation,,,,,$@)
$(call go-build,index/job/creation,,-static,,,$@)

cmd/index/job/save/index-save:
$(eval CGO_ENABLED = 0)
$(call go-build,index/job/save,,,,,$@)
$(call go-build,index/job/save,,-static,,,$@)

cmd/index/job/readreplica/rotate/readreplica-rotate:
$(eval CGO_ENABLED = 0)
$(call go-build,index/job/readreplica/rotate,,,,,$@)
$(call go-build,index/job/readreplica/rotate,,-static,,,$@)

cmd/tools/benchmark/job/job:
$(call go-build,tools/benchmark/job,-linkmode 'external',-fPIC -pthread -fopenmp -std=gnu++20 -lhdf5 -lhdf5_hl -lm -ldl, cgo,$(HDF5_VERSION),$@)
$(call go-build,tools/benchmark/job,-linkmode 'external',-static -fPIC -pthread -fopenmp -std=gnu++20 -lhdf5 -lhdf5_hl -lm -ldl, cgo,$(HDF5_VERSION),$@)

cmd/tools/benchmark/operator/operator:
$(eval CGO_ENABLED = 0)
$(call go-build,tools/benchmark/operator,,,,,$@)
$(call go-build,tools/benchmark/operator,,-static,,,$@)

.PHONY: binary/build/zip
## build all binaries and zip them
Expand Down
8 changes: 4 additions & 4 deletions Makefile.d/docker.mk
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ endif

.PHONY: docker/name/agent-ngt
docker/name/agent-ngt:
@echo "$(ORG)/$(AGENT_IMAGE)"
@echo "$(ORG)/$(AGENT_NGT_IMAGE)"

.PHONY: docker/build/agent-ngt
## build agent-ngt image
docker/build/agent-ngt:
@make DOCKERFILE="$(ROOTDIR)/dockers/agent/core/ngt/Dockerfile" \
IMAGE=$(AGENT_IMAGE) \
IMAGE=$(AGENT_NGT_IMAGE) \
docker/build/image

.PHONY: docker/name/agent-faiss
docker/name/agent-faiss:
@echo "$(ORG)/$(AGENT_IMAGE)"
@echo "$(ORG)/$(AGENT_FAISS_IMAGE)"

.PHONY: docker/build/agent-faiss
## build agent-faiss image
docker/build/agent-faiss:
@make DOCKERFILE="$(ROOTDIR)/dockers/agent/core/faiss/Dockerfile" \
IMAGE=$(AGENT_IMAGE) \
IMAGE=$(AGENT_FAISS_IMAGE) \
docker/build/image

.PHONY: docker/name/agent-sidecar
Expand Down
28 changes: 25 additions & 3 deletions Makefile.d/functions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ define go-build
GO_VERSION=$(GO_VERSION) \
go build \
--ldflags "-w $2 \
-extldflags '-static $3' \
-extldflags '$3' \
-X '$(GOPKG)/internal/info.AlgorithmInfo=$5' \
-X '$(GOPKG)/internal/info.BuildCPUInfoFlags=$(CPU_INFO_FLAGS)' \
-X '$(GOPKG)/internal/info.BuildTime=$(DATETIME)' \
Expand Down Expand Up @@ -278,15 +278,37 @@ define gen-go-option-test-sources
done
endef

define gen-license
MAINTAINER=$2 \
GOPRIVATE=$(GOPRIVATE) \
GOARCH=$(GOARCH) \
GOOS=$(GOOS) \
go run -mod=readonly $(ROOTDIR)/hack/license/gen/main.go $1
endef

define gen-vald-helm-schema
BIN_PATH="$(TEMP_DIR)/vald-helm-schema-gen"
rm -rf $$BIN_PATH
GOPRIVATE=$(GOPRIVATE) \
GOARCH=$(GOARCH) \
GOOS=$(GOOS) \
go build -mod=readonly -a -o $$BIN_PATH $(ROOTDIR)/hack/helm/schema/gen/main.go
$$BIN_PATH charts/$1.yaml > charts/$1.schema.json
rm -rf $$BIN_PATH
endef

define gen-vald-crd
if [[ -f $(ROOTDIR)/charts/$1/crds/$2.yaml ]]; then \
mv $(ROOTDIR)/charts/$1/crds/$2.yaml $(TEMP_DIR)/$2.yaml; \
fi;
BIN_PATH="$(TEMP_DIR)/vald-helm-crd-schema-gen"
rm -rf $$BIN_PATH
GOPRIVATE=$(GOPRIVATE) \
GOARCH=$(GOARCH) \
GOOS=$(GOOS) \
go run -mod=readonly $(ROOTDIR)/hack/helm/schema/crd/main.go \
$(ROOTDIR)/charts/$3.yaml > $(TEMP_DIR)/$2-spec.yaml
go build -mod=readonly -a -o $$BIN_PATH $(ROOTDIR)/hack/helm/schema/crd/main.go
$$BIN_PATH $(ROOTDIR)/charts/$3.yaml > $(TEMP_DIR)/$2-spec.yaml
rm -rf $$BIN_PATH
$(BINDIR)/yq eval-all 'select(fileIndex==0).spec.versions[0].schema.openAPIV3Schema.properties.spec = select(fileIndex==1).spec | select(fileIndex==0)' \
$(TEMP_DIR)/$2.yaml $(TEMP_DIR)/$2-spec.yaml > $(ROOTDIR)/charts/$1/crds/$2.yaml
endef
Expand Down
Loading