@@ -83,15 +83,29 @@ image_expectation() {
8383
8484workload_input_fingerprint () {
8585 local -a names=(" $@ " )
86+ local digest
87+ local file
88+ local name
89+ local rel
8690
8791 {
92+ printf ' schema=openshell-gpu-workload-input-v1\n'
8893 printf ' OPENSHELL_SANDBOX_BASE_IMAGE=%s\n' " ${BASE_IMAGE} "
8994 if contains_image cuda-basic " ${names[@]} " ; then
9095 printf ' CUDA_BUILD_IMAGE=%s\n' " ${CUDA_BUILD_IMAGE} "
9196 printf ' CUDA_SAMPLES_REPO=%s\n' " ${CUDA_SAMPLES_REPO} "
9297 printf ' CUDA_SAMPLES_REF=%s\n' " ${CUDA_SAMPLES_REF} "
9398 fi
94- } | git -C " ${ROOT} " hash-object --stdin | cut -c1-8
99+ for name in " ${names[@]} " ; do
100+ printf ' WORKLOAD=%s\n' " ${name} "
101+ while IFS= read -r -d ' ' file; do
102+ rel=" ${file# " ${ROOT} /" } "
103+ digest=" $( sha256sum " ${file} " | cut -d ' ' -f 1) "
104+ printf ' FILE=%s\n' " ${rel} "
105+ printf ' SHA256=%s\n' " ${digest} "
106+ done < <( find " ${IMAGES_ROOT} /${name} " -type f -print0 | sort -z)
107+ done
108+ } | sha256sum | cut -c1-12
95109}
96110
97111mapfile -t available < <( available_image_dirs)
@@ -122,28 +136,18 @@ if [[ ${#selected[@]} -eq 0 ]]; then
122136 exit 1
123137fi
124138
125- source_sha=" $( git -C " ${ROOT} " rev-parse HEAD) "
126- source_short_sha=" $( git -C " ${ROOT} " rev-parse --short HEAD) "
127- source_dirty=false
128- if [[ -n " $( git -C " ${ROOT} " status --short) " ]]; then
129- source_dirty=true
130- fi
139+ input_fingerprint=" $( workload_input_fingerprint " ${selected[@]} " ) "
131140
132141if [[ -n " ${OPENSHELL_GPU_WORKLOAD_IMAGE_TAG:- } " ]]; then
133142 image_tag=" ${OPENSHELL_GPU_WORKLOAD_IMAGE_TAG} "
134143else
135- input_fingerprint=" $( workload_input_fingerprint " ${selected[@]} " ) "
136- image_tag=" ${source_short_sha} -${input_fingerprint} "
137- if [[ " ${source_dirty} " == " true" ]]; then
138- image_tag=" ${image_tag} -dirty"
139- fi
144+ image_tag=" ${input_fingerprint} "
140145fi
141- input_fingerprint=" $( workload_input_fingerprint " ${selected[@]} " ) "
142146
143147declare -A image_refs=()
144148
145149echo " Building GPU workload images with ${CONTAINER_ENGINE} "
146- echo " Source : ${source_short_sha} (dirty: ${source_dirty} ) "
150+ echo " Fingerprint : ${input_fingerprint} "
147151echo " Tag: ${image_tag} "
148152
149153for name in " ${selected[@]} " ; do
@@ -158,7 +162,6 @@ for name in "${selected[@]}"; do
158162 --label " com.nvidia.openshell.gpu-workload.source=${name} "
159163 --label " com.nvidia.openshell.gpu-workload.base-image=${BASE_IMAGE} "
160164 --label " com.nvidia.openshell.gpu-workload.input-fingerprint=${input_fingerprint} "
161- --label " org.opencontainers.image.revision=${source_sha} "
162165 )
163166 if [[ " ${name} " == " cuda-basic" ]]; then
164167 build_args+=(
@@ -194,8 +197,6 @@ manifest_path="${BUILD_DIR}/workloads.yaml"
194197 echo " # Source this file to use the most recently built GPU workload images."
195198 write_env_var OPENSHELL_GPU_WORKLOAD_IMAGE_TAG " ${image_tag} "
196199 write_env_var OPENSHELL_GPU_WORKLOAD_IMAGE_SOURCE_PATH " ${IMAGES_ROOT} "
197- write_env_var OPENSHELL_GPU_WORKLOAD_IMAGE_SOURCE_SHA " ${source_sha} "
198- write_env_var OPENSHELL_GPU_WORKLOAD_IMAGE_SOURCE_DIRTY " ${source_dirty} "
199200 write_env_var OPENSHELL_GPU_WORKLOAD_IMAGE_INPUT_FINGERPRINT " ${input_fingerprint} "
200201 write_env_var OPENSHELL_SANDBOX_BASE_IMAGE " ${BASE_IMAGE} "
201202 write_env_var CUDA_BUILD_IMAGE " ${CUDA_BUILD_IMAGE} "
@@ -213,8 +214,6 @@ manifest_path="${BUILD_DIR}/workloads.yaml"
213214 echo " generated_by: $( yaml_quote " mise run e2e:workloads:build" ) "
214215 echo " source:"
215216 echo " path: $( yaml_quote " ${IMAGES_ROOT} " ) "
216- echo " revision: $( yaml_quote " ${source_sha} " ) "
217- echo " dirty: ${source_dirty} "
218217 echo " input_fingerprint: $( yaml_quote " ${input_fingerprint} " ) "
219218 echo " container_engine: $( yaml_quote " ${CONTAINER_ENGINE} " ) "
220219 echo " inputs:"
0 commit comments