Pulse/scripts
rcourtman c39ee99529 feat: add shared script library system and refactor docker-agent installer
Implements a comprehensive script improvement infrastructure to reduce code
duplication, improve maintainability, and enable easier testing of installer
scripts.

## New Infrastructure

### Shared Library System (scripts/lib/)
- common.sh: Core utilities (logging, sudo, dry-run, cleanup management)
- systemd.sh: Service management helpers with container-safe systemctl
- http.sh: HTTP/download helpers with curl/wget fallback and retry logic
- README.md: Complete API documentation for all library functions

### Bundler System
- scripts/bundle.sh: Concatenates library modules into single-file installers
- scripts/bundle.manifest: Defines bundling configuration for distributables
- Enables both modular development and curl|bash distribution

### Test Infrastructure
- scripts/tests/run.sh: Test harness for running all smoke tests
- scripts/tests/test-common-lib.sh: Common library validation (5 tests)
- scripts/tests/test-docker-agent-v2.sh: Installer smoke tests (4 tests)
- scripts/tests/integration/: Container-based integration tests (5 scenarios)
- All tests passing ✓

## Refactored Installer

### install-docker-agent-v2.sh
- Reduced from 1098 to 563 lines (48% code reduction)
- Uses shared libraries for all common operations
- NEW: --dry-run flag support
- Maintains 100% backward compatibility with original
- Fully tested with smoke and integration tests

### Key Improvements
- Sudo escalation: 100+ lines → 1 function call
- Download logic: 51 lines → 1 function call
- Service creation: 33 lines → 2 function calls
- Logging: Standardized across all operations
- Error handling: Improved with common library

## Documentation

### Rollout Strategy (docs/installer-v2-rollout.md)
- 3-phase rollout plan (Alpha → Beta → GA)
- Feature flag mechanism for gradual deployment
- Testing checklist and success metrics
- Rollback procedures and communication plan

### Developer Guides
- docs/script-library-guide.md: Complete library usage guide
- docs/CONTRIBUTING-SCRIPTS.md: Contribution workflow
- docs/installer-v2-quickref.md: Quick reference for operators

## Metrics

- Code reduction: 48% (1098 → 563 lines)
- Reusable functions: 0 → 30+
- Test coverage: 0 → 8 test scenarios
- Documentation: 0 → 5 comprehensive guides

## Testing

All tests passing:
- Smoke tests: 2/2 passed (8 test cases)
- Integration tests: 5/5 scenarios passed
- Bundled output: Syntax validated, dry-run tested

## Next Steps

This lays the foundation for migrating other installers (install.sh,
install-sensor-proxy.sh) to use the same pattern, reducing overall
maintenance burden and improving code quality across the project.
2025-10-20 15:13:38 +00:00
..
dev feat: add OIDC single sign-on 2025-09-29 10:22:27 +00:00
lib feat: add shared script library system and refactor docker-agent installer 2025-10-20 15:13:38 +00:00
systemd feat: add automatic SSH key cleanup when nodes are removed 2025-10-18 07:03:05 +00:00
tests feat: add shared script library system and refactor docker-agent installer 2025-10-20 15:13:38 +00:00
.go-version feat: unify styling and improve cluster detection 2025-09-28 18:46:52 +00:00
build-release.sh Add Helm chart tooling, CI, and release packaging 2025-10-18 11:50:57 +00:00
bundle.manifest feat: add shared script library system and refactor docker-agent installer 2025-10-20 15:13:38 +00:00
bundle.sh feat: add shared script library system and refactor docker-agent installer 2025-10-20 15:13:38 +00:00
clean-mock-alerts.sh Add guest agent caching and update doc hints (refs #560) 2025-10-16 08:15:49 +00:00
create-sensor-user.sh security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
dev-hot.sh Align dev ports and improve auto-register UX 2025-09-29 15:05:59 +00:00
docker-build.sh security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
harden-sensor-proxy.sh security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
hot-dev.sh security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
install-docker-agent-v2.sh feat: add shared script library system and refactor docker-agent installer 2025-10-20 15:13:38 +00:00
install-docker-agent.sh feat: add docker agent command handling 2025-10-15 19:27:19 +00:00
install-docker.sh security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
install-go-toolchain.sh feat: unify styling and improve cluster detection 2025-09-28 18:46:52 +00:00
install-sensor-proxy.sh security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
package-helm-chart.sh Add Helm chart tooling, CI, and release packaging 2025-10-18 11:50:57 +00:00
pulse-auto-update.sh fix: add missing auto-update script 2025-08-29 20:34:22 +00:00
pulse-proxy-rotate-keys.sh refactor: Rename pulse-temp-proxy to pulse-sensor-proxy 2025-10-13 13:17:05 +00:00
pulse-sensor-cleanup.sh fix: gracefully handle standalone node cleanup limitation 2025-10-18 07:34:18 +00:00
pulse-sensor-proxy.service refactor: Rename pulse-temp-proxy to pulse-sensor-proxy 2025-10-13 13:17:05 +00:00
run-tests-mock.sh Adopt multi-token auth across docs, UI, and tooling 2025-10-14 15:47:49 +00:00
secure-sensor-files.sh security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
setup-log-forwarding.sh security: complete Phase 1 sensor proxy hardening 2025-10-20 15:13:37 +00:00
sync-production-config.sh Improve powered-off alerts toggle layout and fix dev config sync 2025-10-05 20:17:47 +00:00
take-all-screenshots.js fix: regenerate all screenshots in dark mode 2025-08-04 21:33:39 +00:00
take-screenshots.js perf: optimize mock mode state retrieval and JSON encoding 2025-10-01 13:35:49 +00:00
test-vm-disk.sh Update Proxmox guest agent permissions docs and tooling (refs #548) 2025-10-14 10:21:52 +00:00
toggle-mock-pure.sh fix: replace old PVENodeTable with NodeSummaryTable for correct column ordering 2025-08-29 13:55:53 +00:00
toggle-mock.sh feat: capture Proxmox memory snapshots in diagnostics 2025-10-12 10:25:43 +00:00