@@ -166,8 +166,8 @@ function download_artifact() {
166166 run_a_script " jq -r '.config.buildArtifacts // empty | map(select(.file == \" ${fileName} \" )) | if length > 0 then .[0] | @base64 else \"\" end' ${SPACEFX_DIR} /tmp/config/spacefx-config.json" build_artifact --disable_log --ignore_error
167167
168168 if [[ -z " ${build_artifact} " ]]; then
169- # We don't have the artifact in the main build artifacts. Look in extraArtifacts
170- run_a_script " jq -r '.config.extraArtifacts // empty | map(select(.file == \" ${fileName} \" )) | if length > 0 then .[0] | @base64 else \"\" end' ${SPACEFX_DIR} /tmp/config/spacefx-config.json" build_artifact --disable_log --ignore_error
169+ # We don't have the artifact in the main build artifacts. Look in extraBuildArtifacts
170+ run_a_script " jq -r '.config.extraBuildArtifacts // empty | map(select(.file == \" ${fileName} \" )) | if length > 0 then .[0] | @base64 else \"\" end' ${SPACEFX_DIR} /tmp/config/spacefx-config.json" build_artifact --disable_log --ignore_error
171171 fi
172172
173173 # Found the artifact - parse the values
@@ -196,10 +196,11 @@ function download_artifact() {
196196 exit_with_error " Unable to find a registry for '${artifact_repo} :${artifact_tag} '"
197197 fi
198198
199- info_log " Found '${fileName} ' in registry '${artifact_registry} ' (${artifact_registry} /${artifact_repo} :${artifact_tag} )"
199+ info_log " Found '${fileName} ' in registry '${artifact_registry} '"
200+
201+ get_image_name --registry " ${artifact_registry} " --repo " ${artifact_repo} " --result artifact_full_image_name
200202
201203 if [[ " ${static_artifact} " == " false" ]]; then
202- get_image_name --registry " ${artifact_registry} " --repo " ${artifact_repo} " --result artifact_full_image_name
203204
204205 run_a_script " regctl manifest get ${artifact_full_image_name} :${artifact_tag} --format '{{json .}}'" artifact_manifest
205206
@@ -212,14 +213,12 @@ function download_artifact() {
212213 debug_log " Found manifest for architecture '${ARCHITECTURE} '."
213214 run_a_script " jq -r '.manifests[] | select(.artifactType == \" application/vnd.spacefx.${ARCHITECTURE} .buildartifact\" ) | .annotations.\" org.spacefx.artifact.directory\" ' <<< \$ {artifact_manifest}" artifact_directory
214215 run_a_script " jq -r '.manifests[] | select(.artifactType == \" application/vnd.spacefx.${ARCHITECTURE} .buildartifact\" ) | .annotations.\" org.spacefx.artifact.hash\" ' <<< \$ {artifact_manifest}" artifact_hash
215- else
216- artifact_full_image_name=" ${artifact_repo} /${artifact_repo} :${artifact_tag} "
217216 fi
218217
219218 info_log " Artifact: ${fileName} "
220- info_log " Full Image Name: ${artifact_full_image_name} "
219+ info_log " Full Image Name: ${artifact_full_image_name} : ${artifact_tag} "
221220 info_log " Directory: ${artifact_directory} "
222- info_log " Hash: ${artifact_hash} "
221+ info_log " Remote Hash: ${artifact_hash} "
223222 info_log " Repository: ${artifact_repo} "
224223 info_log " Tag: ${artifact_tag} "
225224 info_log " Static Artifact: ${static_artifact} "
@@ -229,14 +228,18 @@ function download_artifact() {
229228
230229 info_log " Local Hash: ${local_artifact_hash} "
231230
232- if [[ " ${artifact_hash} " == " ${local_artifact_hash} " ]]; then
231+ if [[ -n " ${local_file_hash} " ]] && [[ " ${artifact_hash} " == " ${local_artifact_hash} " ]]; then
233232 info_log " Hash for '${SPACEFX_DIR} /${artifact_directory} /${fileName} ' matches container registry hash ('${local_artifact_hash} ' = '${artifact_hash} '). Nothing to do."
234233 return
235234 fi
236235
237- info_log " Hash for '${SPACEFX_DIR} /${artifact_directory} /${fileName} ' doesn't match container registry hash ('${local_artifact_hash} ' <> '${artifact_hash} ')."
238- info_log " Downloading '${artifact_full_image_name} :${artifact_tag} ' to '${SPACEFX_DIR} /${artifact_directory} /${fileName} '..."
236+ if [[ -z " ${local_file_hash} " ]]; then
237+ info_log " Local hash for '${SPACEFX_DIR} /${artifact_directory} /${fileName} is empty."
238+ else
239+ info_log " Hash for '${SPACEFX_DIR} /${artifact_directory} /${fileName} ' doesn't match container registry hash ('${local_artifact_hash} ' <> '${artifact_hash} ')."
240+ fi
239241
242+ info_log " Downloading '${artifact_full_image_name} :${artifact_tag} ' to '${SPACEFX_DIR} /${artifact_directory} /${fileName} '..."
240243
241244 run_a_script " regctl artifact get ${artifact_full_image_name} :${artifact_tag} --output ${SPACEFX_DIR} /${artifact_directory} --filter-artifact-type application/vnd.spacefx.${ARCHITECTURE} .buildartifact"
242245 info_log " ...successfully downloaded '${artifact_full_image_name} :${artifact_tag} ' to '${SPACEFX_DIR} /${artifact_directory} /${fileName} '."
0 commit comments