cuddly-jelly-27016
05/07/2025, 11:27 PMcontainer_image but not pod_template. In repo.py, don't account for for either.
## What changes were proposed in this pull request?
1. Add a method to PodTemplate that hashes its contents.
2. Add a method that searches an entity for a pod template and adds its hash to a list.
3. Include the list of pod template hashes in the remote.py version computation.
4. Include the list of pod template hashes and container_images in the repo.py version computation.
## How was this patch tested?
Before:
1. Define a workflow with a pod template where the image is defined in an imagespec which takes a base image from an env variable.
2. pyflyte register with two different base images defined via the env variable -> get failure:
Request rejected by the API, due to Invalid input.
RPC Failed, with Status: StatusCode.INVALID_ARGUMENT
Details: wf.get_data task with different structure already exists. (Please register a new version of the task):
/template/Target/K8SPod/pod_spec/containers/0/image:
- ghcr.io/dansola/test-image:1b8tlwn3V2jJmbKngwS6Pg
+ ghcr.io/dansola/test-image:r754JC2IneS_Ey0WqswIVw
1. pyflyte run --remote with two different base images defined via the env variable -> get the same failure as above
After:
1. Define a workflow with a pod template where the image is defined in an imagespec which takes a base image from an env variable.
2. pyflyte register with two different base images defined via the env variable -> no failure and a re-registration doesn't generate a new version
3. pyflyte run --remote with two different base images defined via the env variable -> no failure
## Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
### Summary by Bito
This PR enhances versioning by incorporating pod template changes alongside container images in version computation. It adds a hashing method in PodTemplate to capture environment variable changes reflecting image modifications. The implementation spans remote.py and repo.py to ensure consistent behavior across registration and run commands, with comprehensive tests validating functionality.
Unit tests added: True
Estimated effort to review (1-5, lower is better): 2
flyteorg/flytekitcuddly-jelly-27016
05/08/2025, 10:39 AM