Skip to content

feat: mechanism for sharing common run script functionality #69

@mairas

Description

@mairas

Problem

Each repository has its own run script with significant code duplication:

  • Docker build/clean commands
  • Debian package building
  • Version bumping
  • Test server deployment
  • Pre-commit hook installation

When we need to update common functionality (e.g., fix a bug in the Docker build command), we have to update it in every repo manually.

Proposed Solution

Create a shared library of run script functions that repos can source. Options:

Option 1: Shared Script in halos-distro

# In each repo's run script:
source ../halos-distro/lib/run-common.sh
# or
source "$(git rev-parse --show-toplevel 2>/dev/null)/../halos-distro/lib/run-common.sh"

Pros: Simple, works with workspace structure
Cons: Requires workspace checkout, breaks standalone repo use

Option 2: Git Submodule

Add a shared-scripts submodule to each repo.

Pros: Works standalone
Cons: Submodule management overhead

Option 3: Downloadable Script

# Download/cache shared functions on first run
SHARED_LIB="${XDG_CACHE_HOME:-$HOME/.cache}/halos/run-common.sh"
curl -s https://raw.githubusercontent.com/hatlabs/halos-distro/main/lib/run-common.sh -o "$SHARED_LIB"
source "$SHARED_LIB"

Pros: Works anywhere
Cons: Network dependency, version pinning complexity

Option 4: Template Generation

Use a tool to generate run scripts from a template, with repo-specific customizations.

Pros: No runtime dependency
Cons: Requires regeneration when template changes

Common Functions to Share

  • docker_build() - Build Docker images
  • docker_clean() - Clean Docker artifacts
  • build_deb() - Build Debian packages
  • lint_deb() - Run lintian
  • bumpversion() - Version management
  • deploy() - Deploy to test server
  • install_hooks() - Install pre-commit hooks

Implementation Requirements

Follow docs/IMPLEMENTATION_CHECKLIST.md during implementation.


🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions