Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to install_and_cache_pkgs.sh if restore_pkg.sh fails #144

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions post_cache_action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ test "${debug}" = "true" && set -x
# List of the packages to use.
packages="${@:6}"

if test "${cache_hit}" = "true"; then
${script_dir}/restore_pkgs.sh "${cache_dir}" "${cache_restore_root}" "${execute_install_scripts}" "${debug}"
else
${script_dir}/install_and_cache_pkgs.sh "${cache_dir}" "${debug}" ${packages}
fi
([ "${cache_hit}" = "true" ] && ${script_dir}/restore_pkgs.sh "${cache_dir}" "${cache_restore_root}" "${execute_install_scripts}" "${debug}") || ${script_dir}/install_and_cache_pkgs.sh "${cache_dir}" "${debug}" ${packages}

log_empty_line
6 changes: 4 additions & 2 deletions restore_pkgs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash

# Fail on any error.
set -e
set -eET -o pipefail

trap 'exit -1' ERR

# Debug mode for diagnosing issues.
# Setup first before other operations.
Expand Down Expand Up @@ -50,7 +52,7 @@ for cached_filepath in ${cached_filepaths}; do
sudo tar -xf "${cached_filepath}" -C "${cache_restore_root}" > /dev/null
log " done"

# Execute install scripts if available.
# Execute install scripts if available.
if test ${execute_install_scripts} == "true"; then
# May have to add more handling for extracting pre-install script before extracting all files.
# Keeping it simple for now.
Expand Down