-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update voedger version with empty cherry-pick
- Loading branch information
Showing
1 changed file
with
52 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,38 +8,50 @@ if [ -z "$branch" ]; then | |
fi | ||
echo "https://github.com/$org/$repo" | ||
|
||
if [ -z "$branch" ]; then | ||
commit_hashes_arr="$commit_list" | ||
for word in $commit_hashes_arr; do | ||
# Append word to the list | ||
commit_hashes="$commit_hashes $word" | ||
done | ||
echo "commit_hashes: $commit_hashes" | ||
|
||
if [[ "$branch" == "rc" ]]; then | ||
orig_branch="main" | ||
else | ||
orig_branch="rc" | ||
fi | ||
echo "original branch: $orig_branch" | ||
trimmedsha=$(echo "$commit_hashes" | sed 's/^[ \t]*//;s/[ \t]*$//') | ||
lengthsha=${#trimmedsha} | ||
if [ $lengthsha -eq 0 ]; then | ||
if [[ "$repo" == "airs-bp3" ]]; then | ||
echo "No commits are required to cherry-pick. Will upgrade voedger version." | ||
else | ||
echo "List of commits to cherry-pick is empty" | ||
exit 1 | ||
fi | ||
else | ||
if [[ "$branch" == "rc" ]]; then | ||
orig_branch="main" | ||
else | ||
orig_branch="rc" | ||
fi | ||
echo "original branch: $orig_branch" | ||
|
||
git fetch --all | ||
for commit_hash in $commit_hashes; do | ||
# Check if commit exists in current branch | ||
cmt=$(git branch -r --contains $commit_hash | sed 's/origin\///') | ||
cmt=$(echo "$cmt" | sed 's/^[ \t]*//;s/[ \t]*$//') | ||
echo "cmt2=$cmt" | ||
if [ -z "$cmt" ]; then | ||
echo "Commit $commit_hash does not exists" | ||
exit 1 | ||
fi | ||
if [[ $cmt != $orig_branch ]]; then | ||
echo "Commit $commit_hash does not belong to original branch $orig_branch" | ||
exit 1 | ||
fi | ||
done | ||
git fetch --all | ||
for commit_hash in $commit_hashes; do | ||
# Check if commit exists in current branch | ||
cmt=$(git branch -r --contains $commit_hash | sed 's/origin\///') | ||
cmt=$(echo "$cmt" | sed 's/^[ \t]*//;s/[ \t]*$//') | ||
echo "cmt2=$cmt" | ||
if [ -z "$cmt" ]; then | ||
echo "Commit $commit_hash does not exists" | ||
exit 1 | ||
fi | ||
if [[ $cmt != $orig_branch ]]; then | ||
echo "Commit $commit_hash does not belong to original branch $orig_branch" | ||
exit 1 | ||
fi | ||
done | ||
fi | ||
|
||
git clone -b $branch "https://github.com/$org/$repo" chp || { | ||
echo "Something wnet wrong with clone branch" | ||
echo "Something went wrong with clone branch" | ||
exit 1 | ||
} | ||
cd chp | ||
|
@@ -53,16 +65,24 @@ if [ "$rc" = "main" ]; then | |
echo "Please go to git branch and run script from there. It does not in main." | ||
exit 1 | ||
fi | ||
|
||
echo "Current branch: $rc" | ||
|
||
|
||
# Check if commit hashes were provided | ||
if [ -z "$commit_hashes" ]; then | ||
echo "Usage: $0 <comma-separated list of commit hashes>" | ||
exit 1 | ||
if [ $lengthsha -eq 0 ]; then # Means pb3 wans to update voedger version | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "upload-robot" | ||
git config --global url.https://$github_token@github.com/.insteadOf https://github.com/ | ||
if [[ "$branch" == "rc" ]]; then | ||
go get github.com/voedger/voedger@rc | ||
else | ||
go get github.com/voedger/voedger@release | ||
go mod tidy | ||
git commit -am "Cherry-pick auto-create" --allow-empty | ||
git push origin $rc | ||
exit 0 | ||
fi | ||
|
||
|
||
# Initialize a space-separated string to hold sorted commit hashes | ||
sorted_commits="" | ||
# Loop through the hashes, get their commit dates, and sort them | ||
|
@@ -89,6 +109,11 @@ for commit_hash in $sorted_commits; do | |
} | ||
done | ||
git config --global url.https://$github_token@github.com/.insteadOf https://github.com/ | ||
if [[ "$branch" == "rc" ]]; then | ||
go get github.com/voedger/voedger@rc | ||
else | ||
go get github.com/voedger/voedger@release | ||
go mod tidy | ||
git commit -am "Cherry-pick auto-create" --allow-empty | ||
git push origin $rc | ||
|
||
|