Reliability improvements to recipe .. release
This commit is contained in:
parent
a261114bbc
commit
103a4941c7
27
abra
27
abra
@ -448,7 +448,7 @@ require_consent_for_update() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
require_docker_version (){
|
require_docker_version() {
|
||||||
get_servers
|
get_servers
|
||||||
|
|
||||||
MIN_DOCKER_VERSION=19
|
MIN_DOCKER_VERSION=19
|
||||||
@ -541,9 +541,11 @@ require_app (){
|
|||||||
error "Could not retrieve app type '$APP', this app type doesn't exist?"
|
error "Could not retrieve app type '$APP', this app type doesn't exist?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cd "$APP_DIR" && checkout_main_or_master
|
||||||
|
|
||||||
if [[ $(cd "$ABRA_DIR/apps/$APP" && git branch --list | wc -l) == "0" ]]; then
|
if [[ $(cd "$ABRA_DIR/apps/$APP" && git branch --list | wc -l) == "0" ]]; then
|
||||||
debug "Failed to clone default branch, guessing alternative is 'main'"
|
debug "Failed to clone default branch, guessing alternative is 'main'"
|
||||||
(cd "$ABRA_DIR/apps/$APP" && git checkout main > /dev/null 2>&1)
|
(cd "$ABRA_DIR/apps/$APP" && git checkout main)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
success "Fetched app configuration via Git"
|
success "Fetched app configuration via Git"
|
||||||
@ -611,6 +613,10 @@ require_yq() {
|
|||||||
vendor_binary "https://github.com/mikefarah/yq" "v4.6.1" "yq_linux_amd64"
|
vendor_binary "https://github.com/mikefarah/yq" "v4.6.1" "yq_linux_amd64"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkout_main_or_master() {
|
||||||
|
git checkout main > /dev/null 2>&1 || git checkout master > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
# FIXME 3wc: update or remove
|
# FIXME 3wc: update or remove
|
||||||
if [ -z "$ABRA_ENV" ] && [ -f .env ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then
|
if [ -z "$ABRA_ENV" ] && [ -f .env ] && type direnv > /dev/null 2>&1 && ! direnv status | grep -q 'Found RC allowed true'; then
|
||||||
error "direnv is blocked, run direnv allow"
|
error "direnv is blocked, run direnv allow"
|
||||||
@ -629,7 +635,7 @@ get_recipe_versions() {
|
|||||||
|
|
||||||
recipe="${1?Recipe not set}"
|
recipe="${1?Recipe not set}"
|
||||||
|
|
||||||
mapfile -t RECIPE_VERSIONS < <($JQ -r ".${recipe}.versions | keys | .[]" "$ABRA_APPS_JSON" | sort)
|
mapfile -t RECIPE_VERSIONS < <($JQ -r ".\"${recipe}\".versions | keys | .[]" "$ABRA_APPS_JSON" | sort)
|
||||||
}
|
}
|
||||||
|
|
||||||
###### Run-time loading
|
###### Run-time loading
|
||||||
@ -1871,7 +1877,7 @@ sub_recipe_versions() {
|
|||||||
printf "%s thrilling versions of $abra__recipe_:\n" "${#RECIPE_VERSIONS[@]}"
|
printf "%s thrilling versions of $abra__recipe_:\n" "${#RECIPE_VERSIONS[@]}"
|
||||||
|
|
||||||
for version in "${RECIPE_VERSIONS[@]}"; do
|
for version in "${RECIPE_VERSIONS[@]}"; do
|
||||||
recipe_version_data=$($JQ -r ".${abra__recipe_}.versions.\"${version}\"" "$ABRA_APPS_JSON")
|
recipe_version_data=$($JQ -r ".\"${abra__recipe_}\".versions.\"${version}\"" "$ABRA_APPS_JSON")
|
||||||
mapfile -t services < <(echo "$recipe_version_data" | $JQ -r ". | keys | .[]" -)
|
mapfile -t services < <(echo "$recipe_version_data" | $JQ -r ". | keys | .[]" -)
|
||||||
printf '%s:\n' "$version"
|
printf '%s:\n' "$version"
|
||||||
for service in "${services[@]}"; do
|
for service in "${services[@]}"; do
|
||||||
@ -1914,7 +1920,7 @@ sub_recipe_release() {
|
|||||||
info "Latest available version: '$latest_version'"
|
info "Latest available version: '$latest_version'"
|
||||||
else
|
else
|
||||||
latest_version=""
|
latest_version=""
|
||||||
latest_version_message=""
|
latest_version_message="Initial tagged release"
|
||||||
info "No previous releases found"
|
info "No previous releases found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1923,6 +1929,14 @@ sub_recipe_release() {
|
|||||||
error "$recipe is already on $current_tag, no release needed"
|
error "$recipe is already on $current_tag, no release needed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$(git rev-parse --abbrev-ref --symbolic-full-name HEAD)" = "HEAD" ]; then
|
||||||
|
warning "It looks like $recipe_dir is in 'detached HEAD' state"
|
||||||
|
read -rp "Check out main/master branch first? [Y/n] "
|
||||||
|
if [ "${choice,,}" != "n" ]; then
|
||||||
|
checkout_main_or_master
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
mapfile -t extra_compose_files < <(ls -- compose.*.yml 2> /dev/null || true)
|
mapfile -t extra_compose_files < <(ls -- compose.*.yml 2> /dev/null || true)
|
||||||
|
|
||||||
compose_files=("compose.yml" "${extra_compose_files[@]}")
|
compose_files=("compose.yml" "${extra_compose_files[@]}")
|
||||||
@ -1948,7 +1962,7 @@ sub_recipe_release() {
|
|||||||
service_tag="${service_image##*:}"
|
service_tag="${service_image##*:}"
|
||||||
|
|
||||||
if [ -n "$latest_version" ]; then
|
if [ -n "$latest_version" ]; then
|
||||||
latest_data=$($JQ ".$recipe.versions.\"$latest_version\".\"$service\"" "$ABRA_APPS_JSON")
|
latest_data=$($JQ ".\"$recipe\".versions.\"$latest_version\".\"$service\"" "$ABRA_APPS_JSON")
|
||||||
latest_tag="$(echo "$latest_data" | $JQ -r ".tag" -)"
|
latest_tag="$(echo "$latest_data" | $JQ -r ".tag" -)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1975,6 +1989,7 @@ sub_recipe_release() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ "$new_version" = "false" ]; then
|
if [ "$new_version" = "false" ]; then
|
||||||
|
|
||||||
# `app` tag hasn't changed, just bump release
|
# `app` tag hasn't changed, just bump release
|
||||||
if echo "$latest_version" | grep -q '_'; then
|
if echo "$latest_version" | grep -q '_'; then
|
||||||
latest_version_minor="${latest_version##*_}"
|
latest_version_minor="${latest_version##*_}"
|
||||||
|
Reference in New Issue
Block a user