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

Backport PR #2743 to release/v1.7 for refactor dockerfiles and update gitattributes #2745

Open
wants to merge 1 commit into
base: release/v1.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 48 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,52 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
* text encoding=utf-8 eol=lf

# https://github.com/github/linguist/blob/master/docs/overrides.md
.all-contributorsrc linguist-language=JSON
*.Dockerfile text eol=lf
*.config text encoding=utf-8 eol=lf
*.cpp text encoding=utf-8 eol=lf diff=cpp
*.css text encoding=utf-8 eol=lf
*.csv text encoding=utf-8 eol=lf linguist-language=CSV
*.go text encoding=utf-8 eol=lf diff=go
*.h text encoding=utf-8 eol=lf diff=cpp
*.hpp text encoding=utf-8 eol=lf diff=cpp
*.json text encoding=utf-8 eol=lf diff=json linguist-language=JSON
*.md text encoding=utf-8 eol=lf
*.proto text encoding=utf-8 eol=lf diff=proto
*.py text encoding=utf-8 eol=lf diff=python
*.rs text encoding=utf-8 eol=lf diff=rust
*.txt text encoding=utf-8 eol=lf
*.xml text encoding=utf-8 eol=lf diff=html
*.yaml text encoding=utf-8 eol=lf
*.yml text encoding=utf-8 eol=lf
.all-contributorsrc text encoding=utf-8 eol=lf linguist-language=JSON
Dockerfile text encoding=utf-8 eol=lf
LICENSE text encoding=utf-8 eol=lf


*.a binary
*.gz binary
*.jpeg binary
*.o binary
*.pdf binary
*.so binary
*.zip binary
*.jpg binary filter=lfs diff=lfs merge=lfs -text
*.png binary filter=lfs diff=lfs merge=lfs -text
*.ai binary filter=lfs diff=lfs merge=lfs -text
*.psd binary filter=lfs diff=lfs merge=lfs -text

*.json merge=ours
*.mod merge=ours
*.sum merge=ours
*.svg merge=ours
Comment on lines +51 to +54
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Warning: The merge=ours strategy for critical files needs reconsideration

Based on the repository scan, this merge strategy poses significant risks:

  • Critical dependency files are affected:
    • go.mod and go.sum at root level control project dependencies
    • Multiple *.json schema files under charts/ define Helm configurations
    • Swagger API definitions in apis/swagger/v1/**/*.swagger.json
  • Numerous SVG files under assets/ contain important documentation diagrams

Using merge=ours will silently keep our version during merges, potentially:

  • Breaking dependency management
  • Overwriting API schema changes
  • Losing documentation updates
  • Creating inconsistencies in Helm charts

Recommend removing these merge strategy entries or switching to manual conflict resolution for these files.

🔗 Analysis chain

Caution: Review the use of merge=ours strategy.

Using merge=ours for these files automatically keeps our version during merge conflicts, which could be risky:

  • For *.mod and *.sum: Could lead to incorrect dependency resolution
  • For *.json: Might silently override important configuration changes
  • For *.svg: Could lose intentional visual changes

Consider if merge=union or manual conflict resolution would be more appropriate for some of these files.

Let's check the frequency of merge conflicts for these files:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check history for merge conflicts in specified files
echo "Checking merge conflict history..."
git log --all --full-history -p | rg -A 5 '^\+<{7}|^\+={7}|^\+>{7}' | rg -A 5 '\.(json|mod|sum|svg)$'

Length of output: 327


Script:

#!/bin/bash
# Let's try a different approach to check merge conflict patterns and history

# 1. Check if these files are frequently modified in merge commits
echo "=== Checking merge commit history for these files ==="
git log --merges --name-only --oneline | rg -w "\.(json|mod|sum|svg)$"

# 2. Check the number of times these files were modified in merge commits
echo -e "\n=== Frequency of modifications in merge commits ==="
git log --merges --name-only --oneline | rg -w "\.(json|mod|sum|svg)$" | sort | uniq -c | sort -nr

# 3. Look for any merge commits that modified these files in last 6 months
echo -e "\n=== Recent merge commits modifying these files ==="
git log --merges --since="6 months ago" --name-only --oneline | rg -w "\.(json|mod|sum|svg)$" -B 1

Length of output: 627


Script:

#!/bin/bash
# Let's check the current state and importance of these files

# 1. Check if these files exist and their locations
echo "=== Files matching the patterns ==="
fd -e json -e mod -e sum -e svg

# 2. Check if any of these are critical files
echo -e "\n=== Checking package.json, go.mod, go.sum ==="
fd -e json -e mod -e sum --max-depth 2

# 3. Check the content of .gitattributes to see surrounding context
echo -e "\n=== .gitattributes context ==="
if [ -f .gitattributes ]; then
    cat .gitattributes
fi

Length of output: 4986



vendor/** linguist-vendored

*.tmp export-ignore
*.tmp.* export-ignore
*~ export-ignore
.DS_Store export-ignore
.~lock.* export-ignore
Thumbs.db export-ignore
3 changes: 2 additions & 1 deletion dockers/agent/core/agent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -93,4 +94,4 @@ LABEL maintainer="vdaas.org vald team <[email protected]>"
COPY --from=builder /usr/bin/agent /usr/bin/agent
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/agent"]
ENTRYPOINT ["/usr/bin/agent"]
3 changes: 2 additions & 1 deletion dockers/agent/core/faiss/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -95,4 +96,4 @@ COPY --from=builder /usr/bin/faiss /usr/bin/faiss
COPY cmd/agent/core/faiss/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/faiss"]
ENTRYPOINT ["/usr/bin/faiss"]
3 changes: 2 additions & 1 deletion dockers/agent/core/ngt/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -94,4 +95,4 @@ COPY --from=builder /usr/bin/ngt /usr/bin/ngt
COPY cmd/agent/core/ngt/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/ngt"]
ENTRYPOINT ["/usr/bin/ngt"]
3 changes: 2 additions & 1 deletion dockers/agent/sidecar/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -84,4 +85,4 @@ LABEL maintainer="vdaas.org vald team <[email protected]>"
COPY --from=builder /usr/bin/sidecar /usr/bin/sidecar
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/sidecar"]
ENTRYPOINT ["/usr/bin/sidecar"]
3 changes: 2 additions & 1 deletion dockers/binfmt/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand All @@ -16,4 +17,4 @@
#

# DO_NOT_EDIT this Dockerfile is generated by https://github.com/vdaas/vald/blob/main/hack/docker/gen/main.go
FROM tonistiigi/binfmt:master AS builder
FROM tonistiigi/binfmt:master AS builder
3 changes: 2 additions & 1 deletion dockers/buildbase/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand All @@ -16,4 +17,4 @@
#

# DO_NOT_EDIT this Dockerfile is generated by https://github.com/vdaas/vald/blob/main/hack/docker/gen/main.go
FROM ubuntu:devel AS builder
FROM ubuntu:devel AS builder
3 changes: 2 additions & 1 deletion dockers/buildkit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand All @@ -16,4 +17,4 @@
#

# DO_NOT_EDIT this Dockerfile is generated by https://github.com/vdaas/vald/blob/main/hack/docker/gen/main.go
FROM moby/buildkit:master AS builder
FROM moby/buildkit:master AS builder
3 changes: 2 additions & 1 deletion dockers/buildkit/syft/scanner/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand All @@ -16,4 +17,4 @@
#

# DO_NOT_EDIT this Dockerfile is generated by https://github.com/vdaas/vald/blob/main/hack/docker/gen/main.go
FROM docker/buildkit-syft-scanner:edge AS scanner
FROM docker/buildkit-syft-scanner:edge AS scanner
3 changes: 2 additions & 1 deletion dockers/ci/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -127,4 +128,4 @@ RUN --mount=type=bind,target=.,rw \
&& rm -rf ${GOPATH}/src/github.com/${ORG}/${REPO}/*
# skipcq: DOK-DL3002
USER root:root
ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/bin/bash"]
3 changes: 2 additions & 1 deletion dockers/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -145,4 +146,4 @@ RUN --mount=type=bind,target=.,rw \
&& make faiss/install \
&& rm -rf ${GOPATH}/src/github.com/${ORG}/${REPO}/*
# skipcq: DOK-DL3002
USER root:root
USER root:root
kpango marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 2 additions & 1 deletion dockers/discoverer/k8s/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/discoverer /usr/bin/discoverer
COPY cmd/discoverer/k8s/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/discoverer"]
ENTRYPOINT ["/usr/bin/discoverer"]
3 changes: 2 additions & 1 deletion dockers/example/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -92,4 +93,4 @@ LABEL maintainer="vdaas.org vald team <[email protected]>"
COPY --from=builder /usr/bin/client /usr/bin/client
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/client"]
ENTRYPOINT ["/usr/bin/client"]
3 changes: 2 additions & 1 deletion dockers/gateway/filter/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/filter /usr/bin/filter
COPY cmd/gateway/filter/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/filter"]
ENTRYPOINT ["/usr/bin/filter"]
3 changes: 2 additions & 1 deletion dockers/gateway/lb/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/lb /usr/bin/lb
COPY cmd/gateway/lb/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/lb"]
ENTRYPOINT ["/usr/bin/lb"]
3 changes: 2 additions & 1 deletion dockers/gateway/mirror/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/mirror /usr/bin/mirror
COPY cmd/gateway/mirror/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/mirror"]
ENTRYPOINT ["/usr/bin/mirror"]
3 changes: 2 additions & 1 deletion dockers/index/job/correction/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/index-correction /usr/bin/index-correction
COPY cmd/index/job/correction/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-correction"]
ENTRYPOINT ["/usr/bin/index-correction"]
3 changes: 2 additions & 1 deletion dockers/index/job/creation/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/index-creation /usr/bin/index-creation
COPY cmd/index/job/creation/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-creation"]
ENTRYPOINT ["/usr/bin/index-creation"]
3 changes: 2 additions & 1 deletion dockers/index/job/deletion/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/index-deletion /usr/bin/index-deletion
COPY cmd/index/job/deletion/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-deletion"]
ENTRYPOINT ["/usr/bin/index-deletion"]
3 changes: 2 additions & 1 deletion dockers/index/job/readreplica/rotate/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/readreplica-rotate /usr/bin/readreplica-rotate
COPY cmd/index/job/readreplica/rotate/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/readreplica-rotate"]
ENTRYPOINT ["/usr/bin/readreplica-rotate"]
3 changes: 2 additions & 1 deletion dockers/index/job/save/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/index-save /usr/bin/index-save
COPY cmd/index/job/save/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-save"]
ENTRYPOINT ["/usr/bin/index-save"]
3 changes: 2 additions & 1 deletion dockers/index/operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/index-operator /usr/bin/index-operator
COPY cmd/index/operator/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index-operator"]
ENTRYPOINT ["/usr/bin/index-operator"]
3 changes: 2 additions & 1 deletion dockers/manager/index/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/index /usr/bin/index
COPY cmd/manager/index/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/index"]
ENTRYPOINT ["/usr/bin/index"]
3 changes: 2 additions & 1 deletion dockers/operator/helm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -106,4 +107,4 @@ COPY --from=builder /opt/helm/charts/vald /opt/helm/charts/vald
COPY --from=builder /opt/helm/charts/vald-helm-operator /opt/helm/charts/vald-helm-operator
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/helm-operator", "run", "--watches-file=/opt/helm/watches.yaml"]
ENTRYPOINT ["/usr/bin/helm-operator", "run", "--watches-file=/opt/helm/watches.yaml"]
3 changes: 2 additions & 1 deletion dockers/tools/benchmark/job/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -93,4 +94,4 @@ COPY --from=builder /usr/bin/job /usr/bin/job
COPY cmd/tools/benchmark/job/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/job"]
ENTRYPOINT ["/usr/bin/job"]
3 changes: 2 additions & 1 deletion dockers/tools/benchmark/operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -85,4 +86,4 @@ COPY --from=builder /usr/bin/operator /usr/bin/operator
COPY cmd/tools/benchmark/operator/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/operator"]
ENTRYPOINT ["/usr/bin/operator"]
3 changes: 2 additions & 1 deletion dockers/tools/cli/loadtest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# syntax = docker/dockerfile:latest
# check=error=true
#
# Copyright (C) 2019-2024 vdaas.org vald team <[email protected]>
#
Expand Down Expand Up @@ -93,4 +94,4 @@ COPY --from=builder /usr/bin/loadtest /usr/bin/loadtest
COPY cmd/tools/cli/loadtest/sample.yaml /etc/server/config.yaml
# skipcq: DOK-DL3002
USER nonroot:nonroot
ENTRYPOINT ["/usr/bin/loadtest"]
ENTRYPOINT ["/usr/bin/loadtest"]
Loading
Loading