-
Notifications
You must be signed in to change notification settings - Fork 2
feat: implement skillet configuration tool #46
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
Open
gbagnoli
wants to merge
19
commits into
master
Choose a base branch
from
skillet
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8b1d017
feat: implement skillet configuration tool with containerized integra…
gbagnoli 1db75db
refactor: address PR review comments
gbagnoli 005d85b
refactor: replace expect with proper error propagation in cli crates
gbagnoli 9cc457d
ci: add skillet quality checks to GitHub workflow
gbagnoli c90f5f8
fix: resolve clippy type complexity warning in test_utils
gbagnoli 42b7e4b
refactor: simplify integration test container setup
gbagnoli a21ff6d
feat: implement service management and systemctl restart
gbagnoli dbefdc6
refactor(skillet): address code review comments
gbagnoli 75a6155
feat(skillet): implement ssh hardening and enforce pedantic clippy lints
gbagnoli 7dc9b5e
test(skillet): update beezelbot integration test recording
gbagnoli 2afcbbd
refactor(skillet): address second round of review comments
gbagnoli db99175
refactor(skillet): address review comments including systemd DBus int…
gbagnoli c20b696
refactor(skillet): optimize file hashing and verify directory types
gbagnoli 3d4d98a
refactor(skillet): address review comments on file hashing and direct…
gbagnoli 92cfb06
refactor(skillet): improve file/directory type verification and handl…
gbagnoli 1f8dea6
refactor(skillet): optimize systemd unit handling and improve test ru…
gbagnoli a1f0701
refactor(skillet): fix Sha256 usage and use constant for group existe…
gbagnoli ea08f62
refactor(skillet): ensure I/O errors are not ignored during hashing a…
gbagnoli f05638c
refactor(skillet): optimize file metadata calls and hashing, and refi…
gbagnoli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| target/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Skillet Project Constraints & Structure | ||
|
|
||
| This document defines the architectural mandates and project structure for `skillet`, a Rust-based idempotent host configuration tool. | ||
|
|
||
| ## Core Mandates | ||
|
|
||
| ### 1. Error Handling & Safety | ||
| - **Libraries MUST use `thiserror`** for custom error types. | ||
| - **Libraries MUST NOT use `anyhow`**. `anyhow` is reserved for the CLI binary only. | ||
| - **NEVER use `unwrap()` or `expect()`** in library code. All errors must be propagated and handled. | ||
| - **Prioritize Crates over Shell-out**: Use Rust crates (e.g., `users`, `nix`) for system interactions whenever possible instead of executing shell commands. | ||
|
|
||
| ### 2. Idempotency | ||
| - All resources (files, users, groups, etc.) must be **idempotent**. | ||
| - Before performing an action, check the current state (e.g., compare SHA256 hashes for files, check existence for users). | ||
| - Actions should only be taken if the system state does not match the desired state. | ||
|
|
||
| ### 3. Testing Strategy | ||
| - **Unit Tests**: Place unit tests in a `tests` submodule within each module's directory (e.g., `src/files/tests.rs`). | ||
| - **Separation**: Never put tests in the same `.rs` file as the implementation code. Reference them using `#[cfg(test)] #[path = "MODULE/tests.rs"] mod tests;`. | ||
| - **Abstractions**: Use Traits (e.g., `FileResource`, `SystemResource`) to allow for mocking in higher-level library tests. | ||
|
|
||
| ### 4. Quality Control & Validation | ||
| - **Formatting & Linting**: Always run `cargo fmt` and `cargo clippy` after making changes to ensure code quality and consistency. **Clippy MUST be run with `pedantic` lints enabled (configured in `Cargo.toml`).** | ||
| - **Verification**: Always run both: | ||
| - **Unit Tests**: `cargo test` across the workspace. | ||
| - **Integration Tests**: `skillet test run <hostname>` for affected hosts to verify end-to-end correctness in a containerized environment. | ||
|
|
||
| ## Project Structure | ||
|
|
||
| The project is organized as a Cargo workspace: | ||
|
|
||
| ```text | ||
| skillet/ | ||
| ├── Cargo.toml # Workspace configuration | ||
| ├── AGENTS.md # This file (Project mandates) | ||
| └── crates/ | ||
| ├── core/ # skillet_core: Low-level idempotent primitives | ||
| │ ├── src/ | ||
| │ │ ├── lib.rs | ||
| │ │ ├── files.rs # File management (Traits + Impl) | ||
| │ │ ├── files/ | ||
| │ │ │ └── tests.rs # Unit tests for files | ||
| │ │ ├── system.rs # User/Group management | ||
| │ │ └── system/ | ||
| │ │ └── tests.rs # Unit tests for system | ||
| │ └── tests/ # Integration tests | ||
| ├── hardening/ # skillet_hardening: Configuration logic (modules) | ||
| │ ├── src/ | ||
| │ │ ├── lib.rs # Hardening logic using core primitives | ||
| │ │ └── tests.rs # Unit tests for hardening logic | ||
| │ └── tests/ | ||
| └── cli/ # skillet: The binary executable | ||
| └── src/ | ||
| └── main.rs # CLI entry point (uses anyhow, clap) | ||
| ``` | ||
|
|
||
| ## Module Design | ||
| - **Modules as Cookbooks**: Each library crate under `crates/` (besides `core`) represents a "module" or "cookbook" (e.g., `skillet_hardening`). | ||
| - **Binary per Host**: The idea is to have one binary per host type that picks up these modules and reuses core primitives. | ||
| - **Core Primitives**: Found in `skillet_core`, providing the building blocks for all modules. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The project structure diagram seems to be outdated and doesn't reflect the actual structure of the workspace. It's missing the
cli-commonandhosts/beezelbotcrates. It would be beneficial to update the diagram to accurately represent all the crates in the workspace for better clarity and maintainability.For example, the structure could be updated to include: