feat: Implement intelligent dry-run logic for portracker and update standards

This commit is contained in:
2026-02-22 15:01:27 -05:00
parent a2d7fa1de6
commit 5da47fd120
3 changed files with 141 additions and 14 deletions

View File

@@ -18,6 +18,12 @@ This document outlines the mandatory standards for services managed in this repo
## 3. Deployment and Setup
- **Idempotent Scripts**: Every service must include a `create_<service>_folders.sh` script.
- **Setup Documentation**: Every service folder must contain a `SETUP.md` file documenting the end-to-end flow, highlighting manual pre-setup steps (user creation, ID lookup).
- **Intelligent Dry-Run Mode**: Scripts must support a dry-run mode (default) that compares current system state with target state:
- If a folder exists, report it as "existing" with the phrase "no changes will be made".
- If owner/permissions already match, report as "matched" with current state and the phrase "no changes will be made".
- If a target folder does not exist yet during a dry-run check, report ownership/permissions as "WILL SET upon creation".
- **Recursion**: For recursive operations (`chown -R`, `chmod -R`), dry-run must verify all nested items and report if any deviate from the target state.
- **Execute Instructions**: The dry-run output must clearly instruct the user how to apply the changes (e.g., "To apply changes, run: sudo bash $0 --run").
- **Script Requirements**:
- Must use `mkdir -p` to handle existing directories.
- Must set correct ownership (`chown`) and permissions (`chmod`) based on the service user.