armbian_build/lib/functions/cli/cli-oras.sh
Ricardo Pardini 1cec42392e
armbian-next: GHA & rootfs adventures, pt 1
- rootfs: create readonly global `rootfs_cache_id` (type+hash+date/version)
- add "oras-upload" CLI command (dumb, no retries, single target/single source)
- docker: mount-bind for & re-pass envs `GITHUB_OUTPUT` and `GITHUB_STEP_SUMMARY` down to Docker
- introduce `github-actions.sh::github_actions_add_output()`
- during logs cleanup, dump the Markdown log into GITHUB_STEP_SUMMARY if it is available
2023-02-18 07:44:41 -03:00

31 lines
892 B
Bash

function cli_oras_pre_run() {
: # Empty, no need to do anything.
}
function cli_oras_run() {
case "${ORAS_OPERATION}" in
upload)
display_alert "Uploading using ORAS" "OCI_TARGET: '${OCI_TARGET}' UPLOAD_FILE='${UPLOAD_FILE}'" "info"
display_alert "OCI_TARGET" "${OCI_TARGET}" "info"
display_alert "UPLOAD_FILE" "${UPLOAD_FILE}" "info"
# if OCI_TARGET is not set, exit_with_error
if [[ -z "${OCI_TARGET}" ]]; then
exit_with_error "OCI_TARGET is not set"
fi
if [[ -z "${UPLOAD_FILE}" ]]; then
exit_with_error "UPLOAD_FILE is not set"
fi
if [[ ! -f "${UPLOAD_FILE}" ]]; then
exit_with_error "File to upload not found '${UPLOAD_FILE}'"
fi
# This will download & install ORAS and run it.
oras_push_artifact_file "${OCI_TARGET}" "${UPLOAD_FILE}"
;;
*)
exit_with_error "Unknown ORAS_OPERATION '${ORAS_OPERATION}'"
;;
esac
return 0
}