Feat/improve bootstraping - #2
Merged
Merged
Conversation
… and download capabilities Added a comprehensive set of features for managing ISO downloads and disk operations. Introduced functions for classifying block devices, downloading ISOs with verification, and handling various Linux distributions including Ubuntu and Fedora. Implemented disk listing and inspection functionalities, along with utilities for parsing size and checksum data. Enhanced testing with new unit tests for ISO parsing and disk classification, improving overall reliability and usability of the ISO management tools.
Added new functionalities for setting up essential tools in a homelab environment, including Docker, Distrobox, and Mise. Implemented package management for various distributions, ensuring installation and configuration of necessary packages. Introduced helper functions for managing Flathub remote and streamlined the process of running essential scripts. Enhanced testing coverage for the bootstrap process, improving reliability and usability.
Removed duplicate import statements in cli_test.go for clarity. In root.go, added new commands for self-update and ISO management, improving the CLI's functionality and organization. This refactor streamlines the codebase and enhances command handling.
Introduced new commands for bootstrapping essential packages for Ubuntu and Fedora Silverblue, enhancing the CLI's setup capabilities. Added comprehensive ISO management functionalities, including downloading ISOs, listing supported distributions, and writing ISOs to USB drives. This update improves the overall usability and functionality of the CLI for managing homelab environments.
Adjusted the formatting of the Session struct fields in appctx.go for improved readability and consistency. This change enhances code clarity without altering functionality.
Added a new ExitError struct to encapsulate exit codes and messages, improving error reporting in CLI applications. This enhancement allows for more informative error messages and better control over process exit codes.
Introduced a new exec package that provides a testable interface for executing external commands. Implemented the Runner interface with OSRunner for running commands and capturing output. Added unit tests for the mockRunner and OSRunner to ensure functionality and reliability.
Adjusted the formatting of the Runner struct fields in run.go for improved readability and consistency. This change enhances code clarity without altering functionality.
… testing Added APT and RPMOstree package managers to handle package installations for Debian/Ubuntu and Fedora Silverblue respectively. Implemented detection logic for identifying the OS and corresponding package manager from /etc/os-release. Included unit tests for APT installation and OS detection to ensure functionality and reliability. This update enhances the CLI's capability to manage packages across different Linux distributions.
Refactored the package detection logic in the Detect function to use a switch statement for better readability and maintainability. Added a helper function call in the test for improved test clarity. This change enhances the overall structure of the code without altering its functionality.
Updated the resource cleanup in the applyInstance, ensureDatabase, and grantConnect functions to use deferred anonymous functions for better error handling during connection closure. This change enhances code robustness without altering existing functionality.
Updated variable names for clarity in the discover.go and meta.go files, changing 'max' to 'highest' for better readability. Enhanced resource cleanup in usb.go by using a deferred function for closing the response body, improving error handling without altering existing functionality.
Introduced a new updater package that handles self-updates from GitHub releases. This includes functionality for fetching release metadata, downloading assets, verifying checksums, and performing updates. Added unit tests to ensure reliability and correctness of the update process. This enhancement significantly improves the CLI's ability to manage its own updates.
Adjusted the formatting of the knownLangs map for improved readability and consistency. This change enhances code clarity without altering functionality.
…rrors Updated the main function to check for custom exit errors and print relevant messages before exiting. This change improves error reporting and ensures that specific exit codes are handled appropriately, enhancing the overall robustness of the CLI application.
Added a new install script that allows users to download and install the homelab-cli binary from GitHub releases, including version detection and checksum verification. Introduced an uninstall script to remove the installed binary, enhancing user experience and management of the CLI tool. This implementation provides a complete installation and uninstallation process for the application.
…ings Modified the .golangci.yml file to exclude specific functions from errcheck and added additional exclusions for gosec. Updated the .goreleaser.yaml file to simplify the checksum name template, added nfpms configuration for packaging, and refined changelog filters. These changes improve linting configurations and streamline release management for the homelab-cli project.
Added version 0.2.0 to the changelog, introducing several new features including GoReleaser support for various package formats, installation and uninstallation scripts with SHA256 verification, and new commands for ISO management and bootstrapping essentials for Ubuntu and Fedora Silverblue. Updated the README to reflect these changes and provide clearer installation instructions, including a one-liner install command and self-update functionality. Enhanced command documentation to include new ISO-related commands.
Expanded the .gitignore file to exclude new build artifacts, local development files, and OS-specific files. Added entries for GoReleaser output, including package formats and checksums, to streamline the development process and prevent unnecessary files from being tracked.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR turns
homelab-clifrom a scaffold into a usable provisioning toolchain. Users can installlabfrom GitHub releases, keep it up to date in place, prepare bootable USB drives, and bootstrap a fresh OS with idempotent essentials.What's new
A. Release plumbing
.goreleaser.yaml:linux/amd64,linux/arm64,darwin/amd64,darwin/arm64.tar.gz,.deb,.rpmchecksums.txt(SHA256)nfpms: maintainer/description/license,bindir: /usr/bin,recommends: mise, podman, distroboxdocs:,chore:,test:,ci:excluded), sortascdraft: false,prerelease: auto,mode: replace.github/workflows/release.ymlunchanged in behavior (tagv*,fetch-depth: 0, Go cache,goreleaser release --clean)B. Install scripts
scripts/install.sh(POSIXsh):linux/darwin,amd64/arm64)/usr/local, fallback to$HOME/.localwhen not writable--version,--prefix,--force,--check.tar.gz, verifies SHA256 fromchecksums.txt, installslabscripts/uninstall.sh: removes binary from prefix (default/usr/local/bin/lab)C.
lab self-updatelab self-update--check(exit 0 up to date / 3 update available),--version,--pre-release,--yesinternal/updater/: GitHub releases, semver compare, checksum verify, atomic binary replaceclierrors.ExitError+main.gosupport for exit code 3 on--checkD.
lab iso— bootable USBlab iso listlab iso download <distro>gpg)lab iso diskslsblk -J)lab iso write <iso> --to <device>ddwith confirmation and system-disk guardsinternal/iso/: catalog, Ubuntu/Fedora resolvers, download, verify, write, disk classificationErrNotImplemented):ubuntu-server,fedora-workstation,debian,arch,opensuse-tumbleweed,nixosdisks/write; macOS stubs returnnot implemented yet--force), devices < 4 GiB, require exact device path confirmationE.
lab bootstrap essentialslab bootstrap essentials--target ubuntu|silverblue|auto(from/etc/os-release)--yes,--skip,--only,--dry-runsystem-update,cli-basics,shell-tools,build,container-runtime,mise,distrobox,flatpak-flathubinternal/pkgmgr/:apt,rpm-ostree,detectinternal/bootstrap/: essentials runner, package map, Docker (Ubuntu), mise, distrobox, Flathubinternal/exec/: testableRunnerinterface (all external commands mockable in tests)rpm-ostree install --idempotent, reboot notice after layering (no auto-reboot)Other changes
internal/cli/root.go: registerself-update,iso,bootstrap essentialsREADME.md: one-liner install, upgrade, provisioning walkthroughdocs/commands.md: mark new commands as ✅ readyCHANGELOG.md:[0.2.0]section.gitignore: release artifacts (.deb,.rpm, tarballs, checksums),.tools/,labbinaryTests
Unit tests (mock HTTP / mock runner, no real
apt/dd/rpm-ostree):internal/updater/github_test.go,semver_test.gointernal/iso/catalog_test.go(lsblk JSON classification)internal/pkgmgr/detect_test.go,apt_test.gointernal/bootstrap/essentials_test.gointernal/exec/runner_test.goManual test plan
v0.2.0→ GH Actions publishes.deb,.rpm,.tar.gz,checksums.txtcurl -sSL .../install.sh | bash→labin PATH,lab versionshows releaselab self-update --check→ exit 0 when on latestlab iso list→ catalog with Ubuntu Desktop + Silverbluelab iso download ubuntu-desktop→ verified ISO in cachelab iso download fedora-silverblue→ verified ISO in cachelab iso disks→ USB vs SYSTEM labelslab iso writeon system disk → refusedlab iso writeon USB → confirmation prompt, then burnlab bootstrap essentials --dry-run→ Ubuntu plan (auto-detect)lab bootstrap essentials --dry-run --target silverblue→ Silverblue planlab bootstrap essentials --only cli-basics --yes→ installs on UbuntuNotes / follow-ups
bartrosa/homelab-cli(matchesgo.mod)lab system usb(v0.1) remains alongsidelab iso; new provisioning flow usesiso41lab iso listresolves versions via network (Ubuntu index + Fedora API)maintainer/homepageplaceholders — update before public release if neededYYYY-MM-DDat tag timeBreaking changes
None. Existing v0.1 commands and tests remain compatible.