Skip to content

Commit

Permalink
fix: don't fail immediately on push error
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Dec 31, 2024
1 parent 06be3c5 commit b3e139a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion scripts/sync.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash
set -Eexuo pipefail # abort the script on error

# Array to collect errors
declare -a errors

# replicate shared data from this repo into all repositories at Ory
function replicate_all {
# verify arguments
Expand Down Expand Up @@ -119,6 +122,15 @@ function replicate_all {
repo_type=${type_map[$repo_name]:-library}
replicate "ory/$repo_name" "$repo_type" "$human_name" "$workspace" "$persist"
done

# Check for errors and exit with a non-zero status if any errors were collected
if [ ${#errors[@]} -ne 0 ]; then
echo "Errors occurred during git push:"
for error in "${errors[@]}"; do
echo "$error"
done
exit 1
fi
}

# replicates the info in this repository into the given target repository
Expand Down Expand Up @@ -304,7 +316,9 @@ function push_changes {
local -r repo_path=$1
(
cd "$repo_path"
git push
if ! git push; then
errors+=("Failed to push changes for $repo_path")
fi
)
}

Expand Down

0 comments on commit b3e139a

Please sign in to comment.