Skip to content

Commit

Permalink
feat: always update development images
Browse files Browse the repository at this point in the history
- new option to force download of an image and override the cache
- never use the cached image for in-development versions
  (*-trunk | *-alpha)
  • Loading branch information
theseion committed Dec 23, 2023
1 parent 3f608f0 commit e9b2469
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
9 changes: 8 additions & 1 deletion gtoolkit/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ gtoolkit::prepare_gt() {
download_name="$(basename "${gtoolkit_image_url}")"
target="${SMALLTALK_CI_CACHE}/${download_name}"

if ! is_file "${target}"; then
if "${config_update_image}" && is_dir "${target}"; then
print_info "Removing cached image resources for ${smalltalk_name} (update forced)"
rm -r "${target}"
fi
if ! is_dir "${target}"; then
mkdir "${target}"
fi
if ! is_file "${target}"/*.image; then
fold_start download_image "Downloading ${smalltalk_name} image..."
download_file "${gtoolkit_image_url}" "${target}"
fold_end download_image
Expand Down
10 changes: 8 additions & 2 deletions pharo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,20 @@ pharo::prepare_image() {
local target="${SMALLTALK_CI_CACHE}/${smalltalk_name}"
local pharo_zeroconf="${target}/zeroconfig"

if "${config_update_image}" && is_dir "${target}"; then
print_info "Removing cached image resources for ${smalltalk_name} (update forced)"
rm -r "${target}"
fi
if ! is_dir "${target}"; then
mkdir "${target}"
pushd "${target}" > /dev/null
fi
if ! is_file "${target}"/*.image; then
pushd "${target}" >/dev/null
fold_start download_image "Downloading ${smalltalk_name} image..."
download_file "${pharo_image_url}" "${pharo_zeroconf}"
retry 3 "bash ${pharo_zeroconf}"
fold_end download_image
popd > /dev/null
popd >/dev/null
fi

print_info "Preparing Pharo image..."
Expand Down
24 changes: 23 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,29 @@ validate_configuration() {
fi
}

################################################################################
# Set options that depend on the contex, i.e., the input values and selections
# performed so far.
################################################################################
set_context_options() {
case "${config_smalltalk}" in
*-alpha | *-trunk)
print_info "Forcing image update for in-development version"
config_update_image="true"
;;
*)
;;
esac
}

################################################################################
# Handle user-defined options.
# Locals:
# config_clean
# config_debug
# config_headless
# config_smalltalk
# config_update_image
# config_verbose
# Arguments:
# All positional parameters
Expand Down Expand Up @@ -344,6 +360,10 @@ parse_options() {
fi
shift 2
;;
-u | --update-image)
config_update_image="true"
shift
;;
-v | --verbose)
config_verbose="true"
shift
Expand Down Expand Up @@ -529,10 +549,11 @@ main() {
local config_clean="false"
local config_debug="false"
local config_first_arg_or_empty=""
local config_headless="true"
export config_headless="true"
local config_image=""
local config_colorful="true"
export config_tracking="true"
export config_update_image="false"
local config_verbose="false"
local config_vm=""
local config_vm_dir
Expand All @@ -544,6 +565,7 @@ main() {
ensure_ston_config_exists "${config_first_arg_or_empty}"
select_smalltalk
validate_configuration
set_context_options
config_vm_dir="${SMALLTALK_CI_VMS}/${config_smalltalk}"
prepare_folders
export_coveralls_data
Expand Down
4 changes: 4 additions & 0 deletions squeak/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ squeak::download_prepared_image() {
local git_tag=$2
local target="${SMALLTALK_CI_CACHE}/${download_name}"

if "${config_update_image}" && is_file "${target}"; then
print_info "Removing cached image resources for ${smalltalk_name} (update forced)"
rm "${target}"
fi
if ! is_file "${target}"; then
fold_start download_image "Downloading '${download_name}' testing image..."
download_file "${BASE_DOWNLOAD}/${git_tag}/${download_name}" "${target}"
Expand Down

0 comments on commit e9b2469

Please sign in to comment.