mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
git/docker: bsp-cli: fix BUILD_REPOSITORY_URL and BUILD_REPOSITORY_COMMIT under Docker; fixes AR-1750
This commit is contained in:
committed by
igorpecovnik
parent
03810833ef
commit
52710b3363
@@ -70,9 +70,10 @@ function do_main_configuration() {
|
||||
[[ -z "${CHROOT_CACHE_VERSION}" ]] && CHROOT_CACHE_VERSION=7
|
||||
|
||||
if [[ -d "${SRC}/.git" && "${CONFIG_DEFS_ONLY}" != "yes" ]]; then # don't waste time if only gathering config defs
|
||||
display_alert "Getting git info for repo" "${SRC}" "debug"
|
||||
BUILD_REPOSITORY_URL="$(git remote get-url "$(git remote | grep origin || true)" || true)" # ignore all errors
|
||||
BUILD_REPOSITORY_COMMIT="$(git describe --match=d_e_a_d_b_e_e_f --always --dirty || true)" # ignore error
|
||||
# The docker launcher will have passed these as environment variables. If not, try again here.
|
||||
if [[ -z "${BUILD_REPOSITORY_URL}" || -z "${BUILD_REPOSITORY_COMMIT}" ]]; then
|
||||
set_git_build_repo_url_and_commit_vars "main configuration"
|
||||
fi
|
||||
fi
|
||||
|
||||
ROOTFS_CACHE_MAX=200 # max number of rootfs cache, older ones will be cleaned up
|
||||
@@ -500,3 +501,13 @@ function source_family_config_and_arch() {
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function set_git_build_repo_url_and_commit_vars() {
|
||||
display_alert "Getting git info for repo, during ${1}..." "${SRC}" "debug"
|
||||
declare -g BUILD_REPOSITORY_URL BUILD_REPOSITORY_COMMIT
|
||||
BUILD_REPOSITORY_URL="$(git -C "${SRC}" remote get-url "$(git -C "${SRC}" remote | grep origin || true)" || true)" # ignore all errors
|
||||
BUILD_REPOSITORY_COMMIT="$(git -C "${SRC}" describe --match=d_e_a_d_b_e_e_f --always --dirty || true)" # ignore error
|
||||
display_alert "BUILD_REPOSITORY_URL set during ${1}" "${BUILD_REPOSITORY_URL}" "debug"
|
||||
display_alert "BUILD_REPOSITORY_COMMIT set during ${1}" "${BUILD_REPOSITORY_COMMIT}" "debug"
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user