From b0da193630b6975f5032c008e9fe742d1e55a3c4 Mon Sep 17 00:00:00 2001 From: Alex Gonzalez Date: Thu, 16 Jun 2022 13:32:26 +0200 Subject: [PATCH] SQ --- automation/include/balena-docker.inc | 3 ++- automation/include/balena-lib.inc | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/automation/include/balena-docker.inc b/automation/include/balena-docker.inc index ee7e2951d..bab8efaa3 100644 --- a/automation/include/balena-docker.inc +++ b/automation/include/balena-docker.inc @@ -271,7 +271,8 @@ balena_docker_create_compose_file() { fi if [ -n "${_local_image}" ]; then _image_id=$(balena_docker_image_retrieve "${_local_image}") - _block_image="${_image_id}" + docker tag "${_image_id}" "${_block}:${_version}" + _block_image="${_block}:${_version}" else _block_image=$(balena_api_fetch_image_from_app "${_block}" "${_version}" "${_apiEnv}") if [ -z "${_block_image}" ] || [ "${_block_image}" = "" ]; then diff --git a/automation/include/balena-lib.inc b/automation/include/balena-lib.inc index c5d75a663..2d2531bef 100644 --- a/automation/include/balena-lib.inc +++ b/automation/include/balena-lib.inc @@ -465,13 +465,14 @@ balena_lib_release() { local _releaseID="" local _status="" local _debug="" + local _version [ -z "${_appName}" ] && >&2 echo "balena_lib_release: Application name is required" && exit 1 _apiEnv=${_apiEnv:-"$(balena_lib_environment)"} _path=${_path:-"$(pwd)"} + _version=$(balena_lib_get_os_version) if [ -f "${_path}/balena.yml" ]; then _contract_version=$(awk '/version:/ {print $2}' "${_path}/balena.yml") - _version=$(balena_lib_get_os_version) if [ "${_contract_version}" != "${_version}" ]; then >&2 echo "balena_lib_release: Version mismatch, contract ${_contract_version} os ${_version}" return 1 @@ -489,7 +490,7 @@ balena_lib_release() { if [ -n "${_image_id}" ]; then _releaseID=$(BALENARC_BALENA_URL="${_apiEnv}" balena deploy "${_appName}" "${_image_id}" --source "${_path}" ${_status} ${_debug} | sed -n 's/.*Release: //p') else - _releaseID=$(BALENARC_BALENA_URL="${_apiEnv}" balena deploy "${_appName}" --build --source "${_path}" ${_status} ${_debug} | sed -n 's/.*Release: //p') + _releaseID=$(BALENARC_BALENA_URL="${_apiEnv}" balena deploy "${_appName}" --build --source "${_path}" --cache-from ${_appName#*/}:${_version} ${_status} ${_debug} | sed -n 's/.*Release: //p') fi [ -n "${_releaseID}" ] && >&2 echo "Deployed ${_image_id} to ${_appName} as ${_status##--} at ${_releaseID}" echo "${_releaseID}"