|
| 1 | +# bootstrap-macos-runner.sh |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Bootstrap a macOS runner with required tooling and baseline configuration for devops.scripts automation. |
| 5 | + |
| 6 | +## Location |
| 7 | +`setup/runner/bootstrap-macos-runner.sh` |
| 8 | + |
| 9 | +## Preconditions |
| 10 | +- Required tools: `bash`, Homebrew (`brew`) or `--install-brew` path |
| 11 | +- Required permissions: package install permissions |
| 12 | +- Required environment variables: none |
| 13 | + |
| 14 | +## Arguments |
| 15 | +| Flag | Required | Default | Description | |
| 16 | +|------|----------|---------|-------------| |
| 17 | +| `--yes` | No | `false` | Non-interactive install mode | |
| 18 | +| `--dry-run` | No | `false` | Print actions without execution | |
| 19 | +| `--update-cache` | No | `false` | Refresh package metadata | |
| 20 | +| `--skip-docker` | No | `false` | Skip Docker installation | |
| 21 | +| `--skip-k8s` | No | `false` | Skip Kubernetes tool setup | |
| 22 | +| `--skip-cloud` | No | `false` | Skip cloud CLI setup | |
| 23 | +| `--skip-healthcheck` | No | `false` | Skip final runner healthcheck | |
| 24 | +| `--install-brew` | No | `false` | Install Homebrew if missing | |
| 25 | + |
| 26 | +## Scenarios |
| 27 | +- Happy path: Homebrew present, tools configured, healthcheck passes. |
| 28 | +- Common operational path: bootstrap managed macOS runners for CI jobs. |
| 29 | +- Failure path: Homebrew missing and `--install-brew` not provided, or install failures. |
| 30 | +- Recovery/rollback path: install Homebrew/dependencies and rerun. |
| 31 | + |
| 32 | +## Usage |
| 33 | +```bash |
| 34 | +setup/runner/bootstrap-macos-runner.sh --yes --update-cache |
| 35 | +setup/runner/bootstrap-macos-runner.sh --skip-cloud |
| 36 | +setup/runner/bootstrap-macos-runner.sh --dry-run --install-brew |
| 37 | +``` |
| 38 | + |
| 39 | +## Behavior |
| 40 | +- Main execution flow: install base/local/runner tools and apply local configurations. |
| 41 | +- Idempotency notes: rerunnable orchestration with skip/installed checks. |
| 42 | +- Side effects: package installs, configuration file updates. |
| 43 | + |
| 44 | +## Output |
| 45 | +- Standard output format: timestamped step logs. |
| 46 | +- Exit codes: |
| 47 | + - `0` successful bootstrap |
| 48 | + - non-zero from failing step |
| 49 | + - `2` invalid arguments or unsupported OS |
| 50 | + |
| 51 | +## Failure Modes |
| 52 | +- Common errors and likely causes: |
| 53 | + - script run on non-macOS host |
| 54 | + - Homebrew install/access issues |
| 55 | + - sub-installer failure |
| 56 | +- Recovery and rollback steps: |
| 57 | + - validate brew setup and network access |
| 58 | + - rerun failing sub-script directly |
| 59 | + - rerun bootstrap with corrected flags |
| 60 | + |
| 61 | +## Security Notes |
| 62 | +- Secret handling: no default secret requirements. |
| 63 | +- Least-privilege requirements: local user-level operations preferred. |
| 64 | +- Audit/logging expectations: retain bootstrap logs for runner provenance. |
| 65 | + |
| 66 | +## Testing |
| 67 | +- Unit tests: |
| 68 | + - flag and step selection behavior |
| 69 | +- Integration tests: |
| 70 | + - macOS CI runner bootstrap smoke test |
| 71 | +- Manual verification: |
| 72 | + - run `setup/runner/runner-healthcheck.sh` post-bootstrap |
0 commit comments