$ show HariSekhon/DevOps-Bash-tools
This repository is a comprehensive collection of over 1200 standalone Bash scripts for DevOps automation, cloud infrastructure management, CI/CD pipeline orchestration, and system administration. It is not a single application but a modular toolbox designed to be used interactively or integrated into CI workflows. The architecture is decentralized: each script is self-contained, sourcing shared libraries from the `lib/` directory for common functions like error handling, API authentication, and OS detection. Key entry points include the top-level `Makefile` for bootstrapping, `lib/utils.sh` as the core utility library, and numerous API wrapper scripts (e.g., `github_api.sh`, `aws_foreach_profile.sh`) that provide consistent patterns for interacting with external services. The primary data flows involve querying cloud provider APIs (AWS, GCP, Cloudflare), managing CI/CD platforms (Jenkins, BuildKite, GitHub Actions), manipulating Git repositories, and performing system tasks like disk benchmarking or SSL certificate verification. External dependencies are extensive but well-managed: the scripts assume the presence of `curl`, `jq`, and platform-specific CLIs (`aws`, `gcloud`, `kubectl`, `gh`), with many install scripts provided to bootstrap these tools. The codebase demonstrates high craftsmanship with consistent error handling (`set -euo pipefail`), input validation, and cross-platform compatibility guards. While some scripts are tailored to the author's personal environment, the core patterns and libraries are designed for reuse across projects.
The LLM identified 5 files worth highlighting for reuse:
Core utility library sourced by nearly every script in the repository. Provides essential functions such as `usage`, `die`, `timestamp`, `check_bin`, `is_mac`, `is_linux`, and `help_usage`. Demonstrates a clean, reusable pattern for centralizing common logic, reducing duplication, and ensuring consistent behavior across hundreds of scripts. Can be extracted and adapted for any Bash-based project.
Reusable API wrapper for GitHub REST API. Handles authentication via environment variables (`$GITHUB_TOKEN`), constructs API URLs, and supports pagination by following `next` links in response headers. Used by many GitHub-related scripts in the repo. The pattern of separating API interaction from business logic is a model for wrapping any REST API in Bash.
Generic script to download and install a binary from GitHub releases. Accepts parameters for repository, release tag, asset name, and target path. Handles OS and architecture detection, download with checksum verification, and installation with proper permissions. This pattern is reused by dozens of install scripts in the `install/` directory and can be easily adapted for any project needing to distribute CLI tools.
Template script for iterating over a list of Git repositories and executing a command in each. Supports placeholders like `{repo}` and `{dir}` in the command template, and can read the repo list from a file or stdin. Demonstrates a powerful pattern for batch operations across multiple repositories, with safety features like dry-run mode and error handling. The underlying iteration logic is reusable for any resource enumeration task.
Standalone JSON validation script that uses `jq` to parse and validate JSON files. Can process individual files or entire directories recursively. Returns non-zero exit code on invalid JSON, making it suitable for CI pipelines. The script is minimal, dependency-light, and can be reused in any project that needs to ensure JSON file integrity.