-
Notifications
You must be signed in to change notification settings - Fork 91
Fix truss hash calculation for dev builds #1880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| underneath. The (root) Directory will have the same hash, even if renamed. | ||
| """ | ||
| hasher = blake3() | ||
| print(f"Calculating hash for {root}, ignore_patterns: {ignore_patterns}") |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main change.
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.