Skip to content
Anton Kremenetsky edited this page Oct 16, 2025 · 1 revision

Repository management (elements repository)

This toolkit can publish built elements to a repository and manage that repository.

  • Push element (push in genesis_devtools/cmd/cli.py function push_cmd)

    Push artifacts from a built element directory to the configured repository.

    # Push the element from the default build output directory (./output)
    genesis push .
    
    # Push from a specific element directory
    genesis push -e ./output .
    
    # Force re-push if such element version already exists
    genesis push -f .
    
    # Use a non-default project config file or target
    genesis push -c genesis/custom.yaml -t my-target .

    Options:

    • -c/--genesis-cfg-file – project config file name (default: genesis/genesis.yaml).
    • -t/--target – repository target/id from your project configuration.
    • -e/--element-dir – path to element artifacts directory (default: output).
    • -f/--force – remove existing element version before pushing again.
    • project_dir – path to project root (default: current directory).
  • Initialize repository (repo init in genesis_devtools/cmd/cli.py function repo_init_cmd)

    Creates a new repository structure at the configured destination.

    # Initialize repository for the default target
    genesis repo init .
    
    # Recreate repository if it already exists
    genesis repo init -f .
    
    # Use a specific config and target
    genesis repo init -c genesis/custom.yaml -t my-target .

    Options:

    • -c/--genesis-cfg-file, -t/--target, -f/--force, project_dir – see above.
  • Delete repository (repo delete in genesis_devtools/cmd/cli.py function repo_delete_cmd)

    genesis repo delete .
    genesis repo delete -c genesis/custom.yaml -t my-target .
  • List repository contents (repo list in genesis_devtools/cmd/cli.py function repo_list_cmd)

    # List all elements with latest version and versions count
    genesis repo list .
    
    # List versions for a specific element
    genesis repo list -e genesis-core .
    
    # With explicit config/target
    genesis repo list -c genesis/custom.yaml -t my-target .

    Options:

    • -c/--genesis-cfg-file, -t/--target – select repo configuration.
    • -e/--element – show versions of a single element.
    • project_dir – project root (default: current directory).

Repository driver system

The repository is accessed via a driver abstraction defined by AbstractRepoDriver in genesis_devtools/repo/base.py.

  • Interface (AbstractRepoDriver)

    • init_repo() – initialize a repository.
    • delete_repo() – delete a repository.
    • push(element) – publish an element (artifacts + inventory) to the repo.
    • pull(element, dst_path) – fetch an element into a local directory.
    • remove(element) – remove a specific element version from the repo.
    • list() -> dict[str, list[str]] – map of element name to available versions.
  • Metadata and errors

    • RepoMetaV1 – simple metadata stored as genesis-repo-meta.json at repo root.
    • Errors: RepoAlreadyExistsError, RepoNotFoundError, ElementAlreadyExistsError.

Repository driver selection is resolved by the CLI using the project configuration and optional --target. See your project configuration for how targets and drivers are defined.

Available drivers

  • Filesystem driver (FSRepoDriver in genesis_devtools/repo/fs.py)

    • Layout under repo root: genesis-elements/<element>/<version>/ with inventory.json.
    • push() copies files from the element inventory by categories reported by ElementInventory.categories().
    • pull() copies back the version directory and writes inventory.json into the destination.
    • list() scans genesis-elements/ and returns versions per element.
    • Notes: uses standard file operations; ensure the repo path is writable. Deletion removes version directories and repo metadata/files when applicable.
  • Nginx WebDAV driver (NginxRepoDriver in genesis_devtools/repo/nginx.py)

    • Stores elements on an Nginx HTTP server with WebDAV enabled.
    • Upload via HTTP PUT; download via GET; delete via DELETE.
    • Basic authentication supported via requests session auth.
    • Repo root contains genesis-repo-meta.json and genesis-elements/ (driver writes a .keeper to create dirs).
    • list() parses Nginx autoindex HTML to enumerate directories.
    • Requirements: Nginx with WebDAV and directory autoindex enabled; correct permissions for PUT/DELETE on the repo paths.

If you use a remote driver (e.g., Nginx), ensure network connectivity and credentials are configured in your project for the chosen --target.

Clone this wiki locally