Skip to content

Conversation

@ndeepak-baseten
Copy link
Contributor

This is a first-cut PR, and is not ready to merge.

🚀 What

Adjust truss hash calculation to ignore changes to environment variables.

Prior to this, dev builds for regular (non-custom-server) truss deployments rebuilt the image even on environment variable changes.

💻 How

Compute a reduced-set truss config for hash calculation.

🔬 Testing

Tested locally. Unit tests and integration tests pending.

underneath. The (root) Directory will have the same hash, even if renamed.
"""
hasher = blake3()
print(f"Calculating hash for {root}, ignore_patterns: {ignore_patterns}")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug changes only.

if absolute_path.is_file():
hasher.update(file_content_hash(absolute_path))
return hasher.hexdigest()
hash_str = hasher.hexdigest()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug changes only.


def _update_config(self, **fields_to_update):
config = self._spec.config.model_copy(update=fields_to_update)
print(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug changes only.

docker_file_path = build_dir / MODEL_DOCKERFILE_NAME
docker_file_path.write_text(dockerfile_contents)

def _calculate_sanitized_truss_hash(self, build_dir: Path) -> str:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main change.

@ndeepak-baseten ndeepak-baseten changed the title Fix truss hash calculation Fix truss hash calculation for dev builds Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants