Skip to content

Commit 7b1d513

Browse files
jeanp413akosyakov
authored andcommitted
Update sync script
1 parent aa1a407 commit 7b1d513

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

scripts/sync-with-upstream.sh

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
echo "Syncing openvscode-server with upstream"
44

5+
upstream_url="https://github.com/microsoft/vscode.git"
6+
upstream_branch=${1:-"upstream/main"}
7+
local_branch=${2:-"next"}
8+
only_sync=${3:-"false"}
9+
base_commit_msg="code web server initial commit"
10+
511
exit_script() {
612
reason=$1
713
echo "Update script ended unsucessfully"
@@ -19,21 +25,14 @@ else
1925
LINUX_EXTRA_ARGS="--disable-dev-shm-usage --use-gl=swiftshader"
2026
fi
2127

22-
cd $ROOT
23-
24-
local_branch="web-server"
25-
upstream_url="https://github.com/microsoft/vscode.git"
26-
upstream_branch="upstream/main"
27-
base_commit_msg="code web server initial commit"
28-
2928
# Checks is there's an upstream remote repository and if not
3029
# set it to $upstream_url
3130
check_upstream() {
3231
git remote -v | grep --quiet upstream
3332
if [[ $? -ne 0 ]]; then
3433
echo "Upstream repository not configured"
3534
echo "Setting upstream URL to ${upstream_url}"
36-
git remote add upstream $upstream_url > /dev/null
35+
git remote add upstream $upstream_url
3736
fi
3837
}
3938

@@ -48,11 +47,11 @@ get_base_commit() {
4847

4948
# Fetch updates from upstream and rebase
5049
sync() {
51-
echo "Fetching upstream..."
52-
git fetch upstream > /dev/null
53-
git checkout --quiet $local_branch > /dev/null
54-
echo "Rebasing $local_branch branch over $upstream_branch branch from upstream"
55-
git rebase --quiet --onto=$upstream_branch $(get_base_commit)^ $local_branch
50+
echo "Shallow fetching upstream..."
51+
git fetch upstream
52+
git checkout $local_branch
53+
echo "Rebasing $local_branch branch onto $upstream_branch from upstream"
54+
git rebase --onto=$upstream_branch $(get_base_commit)^ $local_branch
5655
if [[ $? -ne 0 ]]; then
5756
echo "There are merge conflicts doing the rebase. Reverting changes"
5857
git rebase --abort
@@ -61,17 +60,30 @@ sync() {
6160
echo "$local_branch sucessfully updated"
6261
}
6362

63+
cd $ROOT
64+
6465
# Sync
6566
check_upstream
6667
sync
6768

69+
if [[ "$only_sync" == "true" ]]; then
70+
exit 0
71+
fi
72+
6873
# Clean and build
6974
# git clean -dfx
7075
yarn && yarn server:init
76+
if [[ $? -ne 0 ]]; then
77+
exit_script "There are some errors during compilation"
78+
fi
7179

7280
# Configuration
7381
export NODE_ENV=development
7482
export VSCODE_DEV=1
7583
export VSCODE_CLI=1
7684

77-
yarn smoketest --web --headless --electronArgs=$LINUX_EXTRA_ARGS
85+
# Run smoke tests
86+
yarn smoketest --web --headless --verbose --electronArgs=$LINUX_EXTRA_ARGS
87+
if [[ $? -ne 0 ]]; then
88+
exit_script "Some smoke test are failing"
89+
fi

0 commit comments

Comments
 (0)