Skip to content

chore(docker): Add integrity validation for separately installed pip packages #906

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

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

MaxymVlasov
Copy link
Collaborator

Description of your changes

Check pip after each installation, to ensure that everything still works correctl

Address #635 (comment):

do not install distributions with pip separately because it will not take all things installed in the previous session into account when you run a new install command. Enumerate everything and let the dependency resolver know all your requirements together. Ideally, use pip-compile to produce and commit constraint files (lockfiles) and invoke it via pip install -r direct-deps.txt -c constraint.txt.
If you do run separate pip installs, inject a pip check invocation at the end to verify integrity.

I suppose it should be runs just once at the end of installation, but it's mostly free to run pip check after all pip installations, so I did exactly that

@Copilot Copilot AI review requested due to automatic review settings June 9, 2025 13:06
Copy link

coderabbitai bot commented Jun 9, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Added a verification step after installing Python packages to check for dependency conflicts or broken installations during tool setup.

Walkthrough

The installation scripts for Checkov and pre-commit were updated to include a pip3 check command immediately after each tool's installation. This addition verifies the integrity of installed Python packages before proceeding with any further steps in the scripts.

Changes

Files Change Summary
tools/install/checkov.sh, tools/install/pre-commit.sh Added pip3 check after installation to verify package dependencies.

Suggested reviewers

  • antonbabenko

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e4d393 and cbaf591.

📒 Files selected for processing (2)
  • tools/install/checkov.sh (1 hunks)
  • tools/install/pre-commit.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: 📦 v1.99.4.dev2+g506710d
  • GitHub Check: Ubuntu ARM
  • GitHub Check: pre-commit
  • GitHub Check: Ubuntu x64
  • GitHub Check: Analyze (python)
🔇 Additional comments (2)
tools/install/pre-commit.sh (1)

17-17:

✅ Verification successful

Add integrity check after installation and ensure failures abort
Running pip3 check immediately after pip3 install is a great safeguard against dependency conflicts. Confirm that _common.sh enables strict shell error handling (e.g., set -euo pipefail); if not, consider adding explicit failure logic:

pip3 check || { echo "Dependency conflict detected"; exit 1; }

To verify strict-mode is set in _common.sh, run:


🏁 Script executed:

#!/bin/bash
rg -Hn "set.*-e" tools/install/_common.sh
rg -Hn "pipefail" tools/install/_common.sh

Length of output: 174


Strict mode confirmed; explicit failure logic isn’t needed

The _common.sh script already sets -euo pipefail (line 3), so the pip3 check command will abort the installation on any error. No additional || { …; exit 1; } wrapper is required here.

tools/install/checkov.sh (1)

32-32:

✅ Verification successful

Add integrity check after installation and ensure failures abort
Including pip3 check right after Checkov’s install is a solid practice. Verify that _common.sh sources strict modes (set -euo pipefail); otherwise, wrap the command to exit on error:

pip3 check || { echo "Dependency conflict detected"; exit 1; }

Use this to confirm strict-mode:


🏁 Script executed:

#!/bin/bash
rg -Hn "set.*-e" tools/install/_common.sh
rg -Hn "pipefail" tools/install/_common.sh

Length of output: 174


No additional wrapper needed—pip3 check will already abort on failure
The _common.sh script sources strict mode with set -eo pipefail (including -e), so any non-zero exit from pip3 check will terminate the script as intended.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

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.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Add integrity validation by running pip3 check after separate package installations to catch dependency issues early.

  • Insert pip3 check into the Pre-commit installer script.
  • Insert pip3 check into the Checkov installer script.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tools/install/pre-commit.sh Added pip3 check after pip3 install.
tools/install/checkov.sh Added pip3 check after pip3 install.

Copy link
Contributor

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

This is not a bad idea for the end-users. But it doesn't address the predictability problem for this project's own test envs.

@MaxymVlasov MaxymVlasov merged commit 7ce059e into master Jun 12, 2025
47 checks passed
@MaxymVlasov MaxymVlasov deleted the chore/validate_pip branch June 12, 2025 11:54
@antonbabenko
Copy link
Owner

This PR is included in version 1.99.4 🎉

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

Successfully merging this pull request may close these issues.

4 participants