Files
nocodb/scripts/sync/sync_ee_to_ce.sh
Mert E 8d9921407d feat: clean-up job (#2893)
* feat: clean-up job

Signed-off-by: mertmit <mertmit99@gmail.com>

* feat: source cleanup

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: remove unused method

Signed-off-by: mertmit <mertmit99@gmail.com>

* feat: move jobs-redis to a static class

Signed-off-by: mertmit <mertmit99@gmail.com>

* feat: release sources from in-memory db on update & delete

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: skip calls if job redis not available

Signed-off-by: mertmit <mertmit99@gmail.com>

* chore: remove out-of-date comment

Signed-off-by: mertmit <mertmit99@gmail.com>

* chore: sync issue

Signed-off-by: mertmit <mertmit99@gmail.com>

* fix: error handling on connection delete

Signed-off-by: mertmit <mertmit99@gmail.com>

---------

Signed-off-by: mertmit <mertmit99@gmail.com>
2024-05-23 14:42:49 +03:00

56 lines
1.5 KiB
Bash
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
ACTIVE_BRANCH=$(git rev-parse --abbrev-ref HEAD)
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# cd to the root of the nocohub repo
cd "$SCRIPT_DIR/../.."
commit_data=$(git log --reverse --format="%H|%an|%ae|%s" --no-merges develop.."$ACTIVE_BRANCH")
# Split the commit data into an array
IFS=$'\n' read -rd '' -a commit_data <<<"$commit_data"
# cd to the root of the nocodb repo
cd "$SCRIPT_DIR/../../../nocodb"
git remote add ee ../nocohub
git fetch ee "$ACTIVE_BRANCH"
# create sync branch
git checkout -b "nc-$ACTIVE_BRANCH"
# reset the branch to develop
git reset --hard origin/develop
old_user=$(git config user.name)
old_email=$(git config user.email)
# Iterate over the commit data
for commit_info in "${commit_data[@]}"; do
# Get the commit date, author, and SHA
commit_sha=$(echo "$commit_info" | cut -d'|' -f1)
commit_author=$(echo "$commit_info" | cut -d'|' -f2)
commit_author_mail=$(echo "$commit_info" | cut -d'|' -f3)
commit_message=$(echo "$commit_info" | cut -d'|' -f4)
git -c merge.renames=false cherry-pick -X theirs "$commit_sha" --no-commit
git add .
cat ../nocohub/scripts/sync/exclude-list.txt | sed 's/^/":/;s/$/"/' | tr '\n' ' ' | xargs git reset --
git config user.name "$commit_author"
git config user.email "$commit_author_mail"
git commit -m "$commit_message" --author="$commit_author <$commit_author_mail>"
git reset --hard
git clean -fd
done
git config user.name "$old_user"
git config user.email "$old_email"