#!/usr/bin/env bash
function cli_artifact_pre_run() {
case "${ARMBIAN_COMMAND}" in
download-artifact)
display_alert "download-only mode:" "won't build '${WHAT}'" "info"
declare -g DONT_BUILD_ARTIFACTS="${WHAT}"
declare -g KEEP_HASHED_DEB_ARTIFACTS="yes"
;;
esac
initialize_artifact "${WHAT}"
artifact_cli_adapter_pre_run
}
function cli_artifact_run() {
: "${chosen_artifact:?chosen_artifact is not set}"
: "${chosen_artifact_impl:?chosen_artifact_impl is not set}"
if [[ "${CONFIG_DEFS_ONLY}" != "yes" ]]; then
run_tool_oras
fi
display_alert "artifact" "${chosen_artifact}" "debug"
display_alert "artifact" "${chosen_artifact} :: ${chosen_artifact_impl}()" "debug"
track_general_config_variables "in cli_artifact_run before artifact_cli_adapter_config_prep"
declare -g artifact_version_requires_aggregation="no"
artifact_cli_adapter_config_prep
track_general_config_variables "in cli_artifact_run after artifact_cli_adapter_config_prep"
if [[ "${CONFIG_DEFS_ONLY}" == "yes" ]]; then
if [[ -z "${HOSTRELEASE}" ]]; then
obtain_hostrelease_only
fi
if [[ -z "${HOSTARCH}" ]]; then
obtain_hostarch_only
fi
fi
declare deploy_to_remote="no"
case "${ARMBIAN_COMMAND}" in
download-artifact)
display_alert "Running in download-artifact mode" "download-artifact" "ext"
;;
*)
if [[ "${ARTIFACT_USE_CACHE}" == "yes" ]]; then
display_alert "deprecated!" "ARTIFACT_USE_CACHE=yes is deprecated, its behaviour is now the default." "warn"
fi
if [[ "${UPLOAD_TO_OCI_ONLY}" == "yes" ]]; then
display_alert "UPLOAD_TO_OCI_ONLY=yes is set" "UPLOAD_TO_OCI_ONLY=yes; ignoring local cache and deploying to remote" "info"
deploy_to_remote="yes"
fi
;;
esac
if [[ "${ARTIFACT_BUILD_INTERACTIVE}" == "yes" ]]; then
display_alert "Running artifact build in interactive mode" "log file will be incomplete" "info"
do_with_default_build obtain_complete_artifact
else
do_with_default_build obtain_complete_artifact < /dev/null
fi
}