nemo_gym.tasks.harbor.harbor_compat
nemo_gym.tasks.harbor.harbor_compat
Environment content hashing and image naming vendored from Harbor v0.22.0 (Apache-2.0).
Gym builds the images of Harbor tasks with its own tools (buildah, podman or docker; see
nemo_gym.tasks.harbor.image_build) but hashes the task’s environment/ folder and names the image
the way Harbor does, so a task prepared by either framework resolves to the same image name. Kept
byte-for-byte so Gym and Harbor compute the same image names for the same build context.
Vendored from https://github.com/harbor-framework/harbor (Apache-2.0, see ATTRIBUTIONS.md):
environment_content_hashand_CONTENT_HASH_IGNORE_NAMES: https://github.com/harbor-framework/harbor/blob/v0.22.0/src/harbor/environments/definition.pysanitize_docker_image_name(_sanitize_docker_image_nameupstream): https://github.com/harbor-framework/harbor/blob/v0.22.0/src/harbor/environments/docker/docker.py
Harbor’s environment id is environment_content_hash(environment_dir) and its task image is
sanitize_docker_image_name(f"hb__{environment_id}"): hb__<32 hex characters>.
Module Contents
Functions
Data
API
Return a stable SHA-256 hash of the environment contents.
The result is consistent across Linux and macOS. For an empty environment, the Docker image reference is hashed instead.
Sanitize a name to be a valid Docker image name.