fix(clp-package): Detect Docker plugin directory from docker info and resolve it if it's a symlink (fixes #1554).#1555
Conversation
…nd resolve if it is a symlink (fixes y-scope#1554).
WalkthroughDocker Compose plugin discovery now queries the Docker daemon via Changes
Sequence Diagram(s)sequenceDiagram
participant Script as .common-env.sh
participant Docker as Docker Daemon
rect rgb(220,240,255)
Note over Script: Old flow — filesystem scan
Script->>Script: Iterate candidate plugin dirs
Script->>Script: Test plugin presence
alt found
Script->>Script: Export CLP_DOCKER_PLUGIN_DIR
else not found
Script->>Script: Possibly warn and continue
end
end
rect rgb(240,240,220)
Note over Script,Docker: New flow — daemon query
Script->>Docker: Run `docker info` and parse plugin path
Docker-->>Script: Return plugin path (or empty)
alt plugin path returned
Script->>Script: Check path exists
Script->>Script: Resolve realpath -> resolved path
Script->>Script: Derive plugin directory from resolved path
Script->>Script: Export CLP_DOCKER_PLUGIN_DIR
else no plugin path / invalid
Script->>Script: Emit error and return/exit with non-zero
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related issues
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (11)📓 Common learnings📚 Learning: 2025-10-13T03:32:19.293ZApplied to files:
📚 Learning: 2025-10-20T21:05:30.417ZApplied to files:
📚 Learning: 2025-07-01T14:52:02.418ZApplied to files:
📚 Learning: 2025-07-07T17:43:04.349ZApplied to files:
📚 Learning: 2025-08-09T04:07:27.083ZApplied to files:
📚 Learning: 2025-07-23T09:54:45.185ZApplied to files:
📚 Learning: 2025-08-25T06:29:59.610ZApplied to files:
📚 Learning: 2025-10-22T21:14:12.225ZApplied to files:
📚 Learning: 2025-10-22T21:02:31.113ZApplied to files:
📚 Learning: 2025-09-15T22:20:40.750ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (5)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
components/package-template/src/sbin/.common-env.sh(1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: junhaoliao
Repo: y-scope/clp PR: 0
File: :0-0
Timestamp: 2025-10-22T21:02:31.113Z
Learning: Repository y-scope/clp: Maintain deterministic CI/builds for Rust; add a check to verify Cargo.lock is in sync with Cargo.toml without updating dependencies (non-mutating verification in clp-rust-checks workflow).
📚 Learning: 2025-10-13T03:32:19.293Z
Learnt from: junhaoliao
Repo: y-scope/clp PR: 1414
File: tools/docker-images/clp-package/Dockerfile:20-24
Timestamp: 2025-10-13T03:32:19.293Z
Learning: In the clp repository's Dockerfiles (e.g., tools/docker-images/clp-package/Dockerfile), ENV directives should be split into separate lines for readability rather than consolidated to reduce layer count. This is especially true for PATH modifications, as agreed upon in PR #1166. Later ENV settings may depend on earlier ones (e.g., referencing CLP_HOME).
Applied to files:
components/package-template/src/sbin/.common-env.sh
📚 Learning: 2025-10-20T21:05:30.417Z
Learnt from: junhaoliao
Repo: y-scope/clp PR: 1413
File: tools/docker-images/clp-package/Dockerfile:22-24
Timestamp: 2025-10-20T21:05:30.417Z
Learning: In the clp repository's Dockerfiles, ENV directives should be consolidated into multi-line ENV statements when possible to reduce image layers. ENV statements should only be split into separate commands when consolidation is not possible due to dependencies (e.g., when later variables must reference earlier ones that need to be set first, or when PATH must be modified sequentially).
Applied to files:
components/package-template/src/sbin/.common-env.sh
📚 Learning: 2025-07-07T17:43:04.349Z
Learnt from: jackluo923
Repo: y-scope/clp PR: 1054
File: components/core/tools/docker-images/clp-env-base-musllinux_1_2-aarch64/build.sh:3-5
Timestamp: 2025-07-07T17:43:04.349Z
Learning: In CLP project build scripts (specifically build.sh files in docker-images directories), maintain consistency with the established pattern of using separate `set -eu` and `set -o pipefail` commands rather than combining them into `set -euo pipefail`, to ensure uniform script structure across all platform build scripts.
Applied to files:
components/package-template/src/sbin/.common-env.sh
📚 Learning: 2025-07-01T14:52:02.418Z
Learnt from: jackluo923
Repo: y-scope/clp PR: 1054
File: components/core/tools/docker-images/clp-env-base-musllinux_1_2-x86/build.sh:18-24
Timestamp: 2025-07-01T14:52:02.418Z
Learning: In the CLP project, consistency across platform build scripts is prioritized over defensive programming when it comes to git remote handling. All build.sh files in docker-images directories should follow the same pattern for git metadata injection.
Applied to files:
components/package-template/src/sbin/.common-env.sh
📚 Learning: 2025-07-01T14:51:19.172Z
Learnt from: jackluo923
Repo: y-scope/clp PR: 1054
File: components/core/tools/scripts/lib_install/musllinux_1_2/install-packages-from-source.sh:6-8
Timestamp: 2025-07-01T14:51:19.172Z
Learning: In CLP installation scripts within `components/core/tools/scripts/lib_install/`, maintain consistency with existing variable declaration patterns across platforms rather than adding individual improvements like `readonly` declarations.
Applied to files:
components/package-template/src/sbin/.common-env.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: package-image
- GitHub Check: lint-check (macos-15)
- GitHub Check: lint-check (ubuntu-24.04)
🔇 Additional comments (2)
components/package-template/src/sbin/.common-env.sh (2)
34-36: Dynamic Docker Compose plugin detection viadocker infois well-implemented.The query correctly uses the ClientInfo.Plugins format to extract the compose plugin path, which is more reliable than scanning hardcoded directories.
38-41: Early validation of plugin path existence is appropriate.The check correctly validates that the plugin path returned by
docker infoboth exists and is a regular file before attempting to resolve it.
docker info and resolve if it is a symlink (fixes #1554).docker info and resolve it if it's a symlink (fixes #1554).
Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com>
…nd resolve it if it's a symlink (fixes y-scope#1554). (y-scope#1555) Co-authored-by: kirkrodrigues <2454684+kirkrodrigues@users.noreply.github.com>
Description
Checklist
breaking change.
Validation performed
Tested
start-clp.shwhich started successfully, on Ubuntu 22.04 WSL where the docker-compose plugin is symlinked to some target on the Windows host. No longer observed "clp_package_utils.general.DockerNotAvailableError: [Errno 2] Docker Compose is not installed or not functioning properly.":Tested
start-clp.shwhich started successfully, on Debian 13 with non-Desktop Docker installation:Summary by CodeRabbit