Skip to content

Commit b2012c5

Browse files
author
alexlianides
committed
updated push_build_artifacts.sh to search config for extraBuildArtifacts for tag as well as repository and directory. Updated logging for login container registry
1 parent 236144b commit b2012c5

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

build/push_build_artifact.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,22 @@ function main() {
302302
DEST_ARTIFACT_TAG="${ARTIFACT_VERSION}"
303303
DEST_SPACEFX_TAG="${SPACEFX_VERSION}"
304304

305-
# Check if we have a tag suffix from our config file
306-
run_a_script "jq -r 'if (.config | has(\"tagSuffix\")) then .config.tagSuffix else \"\" end' ${SPACEFX_DIR}/tmp/config/spacefx-config.json" tag_suffix --disable_log
305+
# Look in extraBuildArtifacts to see if a specfic tag is required
306+
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
307307

308-
if [[ -n "${tag_suffix}" ]]; then
309-
DEST_ARTIFACT_TAG="${ARTIFACT_VERSION}${tag_suffix}"
310-
DEST_SPACEFX_TAG="${SPACEFX_VERSION}${tag_suffix}"
311-
fi
308+
# Found the in extraBuildArtifacts, confirmed static artifact
309+
if [[ -n "${build_artifact}" ]]; then
310+
info_log "..found '${fileName}' in build artifacts."
311+
DEST_ARTIFACT_TAG="${ARTIFACT_VERSION}"
312+
else
313+
# artifact is not static, check if we have a tag suffix from our config file
314+
run_a_script "jq -r 'if (.config | has(\"tagSuffix\")) then .config.tagSuffix else \"\" end' ${SPACEFX_DIR}/tmp/config/spacefx-config.json" tag_suffix --disable_log
312315

316+
if [[ -n "${tag_suffix}" ]]; then
317+
DEST_ARTIFACT_TAG="${ARTIFACT_VERSION}${tag_suffix}"
318+
DEST_SPACEFX_TAG="${SPACEFX_VERSION}${tag_suffix}"
319+
fi
320+
fi
313321

314322
write_parameter_to_log DEST_ARTIFACT_TAG
315323
write_parameter_to_log DEST_SPACEFX_TAG

modules/m_60_container_registries.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,12 @@ function find_registry_for_image(){
239239
login_to_container_registry --container_registry "${container_registry}" --container_registry_username_file "${login_username_file}" --container_registry_password_file "${login_password_file}"
240240
fi
241241

242+
debug_log "Running 'regctl image manifest ${container_registry}/${_find_registry_for_image_repo}'"
242243
run_a_script "regctl image manifest ${container_registry}/${_find_registry_for_image_repo}" _find_registry_for_image_result --ignore_error --disable_log
244+
debug_log "_find_registry_for_image_result:"
245+
debug_log "${_find_registry_for_image_result}"
243246

247+
244248
if [[ "${_find_registry_for_image_result}" == *"unauthorized"* ]]; then
245249
exit_with_error "Unauthorized to access image to container registry '${container_registry}'. Please login with docker login '${container_registry}', regctl registry login '${container_registry}' --user <username> --pass <password>, or use the config login_username_file and login_password_file configuration options"
246250
fi

0 commit comments

Comments
 (0)