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

check that config file exists before move #713

Merged
merged 1 commit into from
Oct 20, 2022
Merged
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
15 changes: 9 additions & 6 deletions scripts/sync-to-aws-eks-charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,21 @@ gh_client_config_dir="${HOME}/.config/gh"
gh_client_config_path="${gh_client_config_dir}/config.yml"
gh_client_config_backup_path="${gh_client_config_dir}/config.yml.backup"

mkdir -p "${gh_client_config_dir}"

restore_gh_config() {
if [[ -f "${gh_client_config_backup_path}" ]]; then
echo -e "🥑 Restore gh cli configuration"
mv -f "${gh_client_config_backup_path}" "${gh_client_config_path}" || :
fi
}

trap restore_gh_config EXIT

echo "Backing up existing configuration"
mkdir -p "${gh_client_config_dir}"
mv -f "${gh_client_config_path}" "${gh_client_config_backup_path}"
if [[ -e "${gh_client_config_path}" ]]; then
echo "Backing up existing configuration"
mv -f "${gh_client_config_path}" "${gh_client_config_backup_path}"
trap restore_gh_config EXIT
fi

echo "Writing custom configuration"
cat << EOF > "${gh_client_config_path}"
Expand Down Expand Up @@ -133,8 +136,8 @@ echo -e "🥑 Check whether chart is in sync"

eks_charts_nth_path="${eks_charts_repo_path}/stable/${helm_chart_name}"
if diff -x ".*" -r "${helm_chart_path}/" "${eks_charts_nth_path}/" &>/dev/null ; then
echo " ✅ Charts already in sync; no updates needed"
exit
echo " ✅ Charts already in sync; no updates needed"
exit
fi

echo -e "🚨 Charts are NOT in sync"
Expand Down