llama-stack-mirror/scripts
2025-06-27 11:39:51 +02:00
..
check-init-py.sh ci: vector_io provider integration tests (#2537) 2025-06-26 17:04:32 -07:00
check-workflows-use-hashes.sh chore: enforce no git tags or branches in external github actions (#2159) 2025-05-14 20:40:06 +02:00
distro_codegen.py chore: remove dead code (#2403) 2025-06-05 21:17:54 +02:00
gen-changelog.py chore: enable ruff for ./scripts too (#1643) 2025-03-18 12:17:21 -07:00
generate_build_info.py Add version command with comprehensive unit tests and build integration 2025-06-26 12:53:28 +02:00
generate_prompt_format.py refactor: move all llama code to models/llama out of meta reference (#1887) 2025-04-07 15:03:58 -07:00
README.md Add version command with comprehensive unit tests and build integration 2025-06-26 12:53:28 +02:00
run_client_sdk_tests.py chore: consolidate scripts under ./scripts directory (#1646) 2025-03-17 17:56:30 -04:00
unit-tests.sh chore: bump python supported version to 3.12 (#2475) 2025-06-24 09:22:04 +05:30

Build Scripts

This directory contains scripts used during the build process.

generate_build_info.py

This script generates llama_stack/cli/build_info.py with hardcoded git information at build time. This ensures that version information is captured at build time rather than being read dynamically at runtime.

Usage

The script is automatically run during the build process via the custom BuildWithBuildInfo class in setup.py. You can also run it manually:

python scripts/generate_build_info.py

Generated Information

The script captures the following information:

  • Git commit hash (short form)
  • Git commit date
  • Git branch name
  • Git tag (latest)
  • Build timestamp

CI/CD Integration

The script handles common CI/CD scenarios:

  • Detached HEAD state (common in CI environments)
  • Missing git information (fallback to environment variables)
  • Git not available (fallback to "unknown" values)

Environment Variables

When running in CI/CD environments where the branch name might not be available via git (detached HEAD), the script checks these environment variables:

  • GITHUB_REF_NAME (GitHub Actions)
  • CI_COMMIT_REF_NAME (GitLab CI)
  • BUILDKITE_BRANCH (Buildkite)
  • TRAVIS_BRANCH (Travis CI)

Build Integration

The build info generation is integrated into the build process via:

  1. setup.py - Custom build command that runs the script before building
  2. pyproject.toml - Standard Python package configuration

This ensures that every build includes up-to-date git information without requiring runtime git access.