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 #2696 to release/v1.7 for Add String sorted topologicalSort #2698

Conversation

vdaas-ci
Copy link
Collaborator

@vdaas-ci vdaas-ci commented Oct 11, 2024

Description

SSIA

Related Issue

Versions

  • Vald Version: v1.7.13
  • Go Version: v1.23.2
  • Rust Version: v1.81.0
  • Docker Version: v27.3.1
  • Kubernetes Version: v1.31.1
  • Helm Version: v3.16.2
  • NGT Version: v2.2.4
  • Faiss Version: v1.9.0

Checklist

Special notes for your reviewer

Summary by CodeRabbit

  • New Features

    • New configuration files copied to the final image for specific applications.
    • Enhancements to the build efficiency and configuration for various components.
  • Bug Fixes

    • Minor formatting adjustments to the ENTRYPOINT directives across multiple Dockerfiles for consistency.
  • Chores

    • Clean-up and formatting updates, including the addition of newlines for better readability in several Dockerfiles.

Copy link

cloudflare-workers-and-pages bot commented Oct 11, 2024

Deploying vald with  Cloudflare Pages  Cloudflare Pages

Latest commit: 30d4638
Status: ✅  Deploy successful!
Preview URL: https://3cfdae33.vald.pages.dev
Branch Preview URL: https://backport-release-v1-7-refact-dmyx.vald.pages.dev

View logs

Copy link
Contributor

coderabbitai bot commented Oct 11, 2024

📝 Walkthrough

Walkthrough

The pull request includes modifications to multiple Dockerfiles across various directories. Key changes involve updates to the ENTRYPOINT instructions for consistency and minor formatting adjustments. Some Dockerfiles have new lines added, and a few include the copying of configuration files. Overall, the structural logic of the Dockerfiles remains unchanged, with no alterations to exported or public entities.

Changes

File Path Change Summary
dockers/agent/core/agent/Dockerfile Updated ENTRYPOINT instruction.
dockers/agent/core/faiss/Dockerfile Updated ENTRYPOINT; added line to copy sample.yaml to /etc/server/config.yaml.
dockers/agent/core/ngt/Dockerfile Updated ENTRYPOINT; removed newline at end of file.
dockers/agent/sidecar/Dockerfile Updated ENTRYPOINT instruction.
dockers/binfmt/Dockerfile Modified FROM instruction for syntax consistency; added newline at end of file.
dockers/buildbase/Dockerfile Added newline at end of file.
dockers/buildkit/Dockerfile Added newline at end of file.
dockers/buildkit/syft/scanner/Dockerfile Added newline at end of file.
dockers/ci/base/Dockerfile Updated ENTRYPOINT instruction for potential formatting correction.
dockers/dev/Dockerfile Extensive modifications to RUN command for package installations and cleanup.
dockers/discoverer/k8s/Dockerfile Updated ENTRYPOINT instruction for formatting.
dockers/gateway/filter/Dockerfile Updated ENTRYPOINT instruction for consistency.
dockers/gateway/lb/Dockerfile Updated ENTRYPOINT instruction.
dockers/gateway/mirror/Dockerfile Added line to copy sample.yaml to /etc/server/config.yaml; ENTRYPOINT unchanged.
dockers/index/job/correction/Dockerfile Modifications related to build process and final image configuration; ENTRYPOINT unchanged.
dockers/index/job/creation/Dockerfile Updated ENTRYPOINT instruction (functionally unchanged).
dockers/index/job/readreplica/rotate/Dockerfile Updated ENTRYPOINT instruction.
dockers/index/job/save/Dockerfile Updated ENTRYPOINT instruction.
dockers/index/operator/Dockerfile Updated ENTRYPOINT instruction.
dockers/manager/index/Dockerfile Modifications related to build process and final image configuration; ENTRYPOINT unchanged.
dockers/operator/helm/Dockerfile Modifications related to build and runtime configurations; ENTRYPOINT unchanged.
dockers/tools/benchmark/job/Dockerfile Modifications related to build process and environment setup.
dockers/tools/benchmark/operator/Dockerfile Updated ENTRYPOINT for consistency; added line to copy sample.yaml.
dockers/tools/cli/loadtest/Dockerfile Updated ENTRYPOINT instruction for formatting.

Possibly related PRs

Suggested labels

priority/low, size/L, area/internal, area/tools/cli/loadtest, area/makefile, area/gateway/lb, area/gateway/filter, area/gateway/mirror

Suggested reviewers

  • kpango

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@@ -145,4 +145,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
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ [hadolint] <DL3002> reported by reviewdog 🐶
Last USER should not be root

@vdaas-ci
Copy link
Collaborator Author

[CHATOPS:HELP] ChatOps commands.

  • 🙆‍♀️ /approve - approve
  • 🍱 /format - format codes and add licenses
  • /gen-test - generate test codes
  • 🏷️ /label - add labels
  • 🔚 2️⃣ 🔚 /label actions/e2e-deploy - run E2E deploy & integration test

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
dockers/tools/benchmark/job/Dockerfile (2)

Line range hint 41-79: LGTM: Well-structured RUN instruction with a minor suggestion

The RUN instruction is well-structured, combining multiple operations to reduce image layers. It includes comprehensive package installation, proper locale configuration, and necessary build steps. The use of mount options for caching is an excellent practice for optimizing build times.

One minor suggestion:

Consider adding a comment explaining the purpose of the echo commands that modify APT behavior. This would improve readability for future maintainers.

+    # Configure APT to keep downloaded packages and avoid installing recommended packages
     && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \
     && echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/no-install-recommends \

93-94: LGTM: Proper file copying with a suggestion for documentation

The COPY instructions are correctly placed in the final stage, copying only the necessary files from the builder stage. This is a good practice for keeping the final image small.

Consider adding a comment or updating the documentation to explain the purpose of the sample configuration file (sample.yaml) and how users can customize it. This will improve the usability of the image.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 18babd9 and 30d4638.

⛔ Files ignored due to path filters (1)
  • hack/docker/gen/main.go is excluded by !**/gen/**
📒 Files selected for processing (24)
  • dockers/agent/core/agent/Dockerfile (1 hunks)
  • dockers/agent/core/faiss/Dockerfile (1 hunks)
  • dockers/agent/core/ngt/Dockerfile (1 hunks)
  • dockers/agent/sidecar/Dockerfile (1 hunks)
  • dockers/binfmt/Dockerfile (1 hunks)
  • dockers/buildbase/Dockerfile (1 hunks)
  • dockers/buildkit/Dockerfile (1 hunks)
  • dockers/buildkit/syft/scanner/Dockerfile (1 hunks)
  • dockers/ci/base/Dockerfile (1 hunks)
  • dockers/dev/Dockerfile (1 hunks)
  • dockers/discoverer/k8s/Dockerfile (1 hunks)
  • dockers/gateway/filter/Dockerfile (1 hunks)
  • dockers/gateway/lb/Dockerfile (1 hunks)
  • dockers/gateway/mirror/Dockerfile (1 hunks)
  • dockers/index/job/correction/Dockerfile (1 hunks)
  • dockers/index/job/creation/Dockerfile (1 hunks)
  • dockers/index/job/readreplica/rotate/Dockerfile (1 hunks)
  • dockers/index/job/save/Dockerfile (1 hunks)
  • dockers/index/operator/Dockerfile (1 hunks)
  • dockers/manager/index/Dockerfile (1 hunks)
  • dockers/operator/helm/Dockerfile (1 hunks)
  • dockers/tools/benchmark/job/Dockerfile (1 hunks)
  • dockers/tools/benchmark/operator/Dockerfile (1 hunks)
  • dockers/tools/cli/loadtest/Dockerfile (1 hunks)
✅ Files skipped from review due to trivial changes (21)
  • dockers/agent/core/agent/Dockerfile
  • dockers/agent/core/faiss/Dockerfile
  • dockers/agent/core/ngt/Dockerfile
  • dockers/agent/sidecar/Dockerfile
  • dockers/binfmt/Dockerfile
  • dockers/buildbase/Dockerfile
  • dockers/buildkit/Dockerfile
  • dockers/buildkit/syft/scanner/Dockerfile
  • dockers/ci/base/Dockerfile
  • dockers/discoverer/k8s/Dockerfile
  • dockers/gateway/filter/Dockerfile
  • dockers/gateway/lb/Dockerfile
  • dockers/gateway/mirror/Dockerfile
  • dockers/index/job/correction/Dockerfile
  • dockers/index/job/creation/Dockerfile
  • dockers/index/job/readreplica/rotate/Dockerfile
  • dockers/index/job/save/Dockerfile
  • dockers/index/operator/Dockerfile
  • dockers/operator/helm/Dockerfile
  • dockers/tools/benchmark/operator/Dockerfile
  • dockers/tools/cli/loadtest/Dockerfile
🧰 Additional context used
🔇 Additional comments (3)
dockers/manager/index/Dockerfile (1)

88-88: LGTM: Correct ENTRYPOINT configuration

The ENTRYPOINT instruction is correctly set to run the index manager binary. This change ensures that the container executes the appropriate application when started. The use of the exec form (JSON array notation) is a best practice, as it allows for proper signal handling and process management within the container.

dockers/tools/benchmark/job/Dockerfile (2)

Line range hint 22-38: LGTM: Comprehensive environment setup

The added ENV instructions provide a thorough setup for the build environment. They cover essential variables for Go, locale settings, and application-specific configurations. This approach ensures consistency across builds and is a good practice in Dockerfile construction.


96-96: LGTM: Improved ENTRYPOINT instruction

The modification of the ENTRYPOINT instruction to use the exec form (["command", "param1"]) instead of the shell form is a good improvement. This change allows signals to be properly passed to the application and avoids creating an unnecessary shell process, which can lead to better container management.

@@ -145,4 +145,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
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Redundant USER root:root directive

The USER root:root directive is already specified earlier in the Dockerfile at line 15. Re-declaring it at line 148 is unnecessary unless there is a user context change in between, which doesn't appear to be the case here. Removing the redundant directive can simplify the Dockerfile.

Apply the following diff to remove the redundant line:

148
-    USER root:root
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
USER root:root

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants