Skip to content

Commit

Permalink
Pull from upstream edx/devstack
Browse files Browse the repository at this point in the history
Pull from upstream
  • Loading branch information
NIXKnight committed Nov 1, 2018
2 parents 1ff539a + da48689 commit 5848f75
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -65,7 +65,7 @@ dev.provision.xqueue: | check-memory dev.provision.xqueue.run stop stop.xqueue
dev.provision.xqueue.run:
DOCKER_COMPOSE_FILES="-f docker-compose.yml -f docker-compose-xqueue.yml" $(WINPTY) bash ./provision-xqueue.sh

dev.reset: | down dev.repo.reset pull dev.up static update-db ## Attempts to reset the local devstack to a the master working state
dev.reset: | down dev.repo.reset pull dev.up static update-db ## Attempts to reset the local devstack to the master working state

dev.status: ## Prints the status of all git repositories
$(WINPTY) bash ./repo.sh status
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Expand Up @@ -688,9 +688,9 @@ you can connect to the container running it via VNC.
| Chrome (via Selenium) | vnc://0.0.0.0:15900 |
+------------------------+----------------------+

On macOS, enter the VNC connection string in Safari to connect via VNC. The VNC
passwords for both browsers are randomly generated and logged at container
startup, and can be found by running ``make vnc-passwords``.
On macOS, enter the VNC connection string in the address bar in Safari to
connect via VNC. The VNC passwords for both browsers are randomly generated and
logged at container startup, and can be found by running ``make vnc-passwords``.

Most tests are run in Firefox by default. To use Chrome for tests that normally
use Firefox instead, prefix the test command with
Expand Down
4 changes: 3 additions & 1 deletion appveyor.yml
Expand Up @@ -20,7 +20,9 @@ build_script:
#
# Switching Docker to Linux for the first time takes around a minute. This is
# the time required to start the "MobyLinuxVM" VM:
- docker-switch-linux
# This won't work until we switch back to a paid AppVeyor plan after resolving
# https://openedx.atlassian.net/browse/TE-2761
#- docker-switch-linux
- md X:\devstack
- "\"%ProgramFiles%/Git/bin/bash.exe\" -c \"make dev.clone\""
# Stop here until we get provisioning to finish reliably
Expand Down
44 changes: 28 additions & 16 deletions repo.sh
Expand Up @@ -17,6 +17,12 @@ else
exit 1
fi

if [ -n "${OPENEDX_RELEASE}" ]; then
OPENEDX_GIT_BRANCH=open-release/${OPENEDX_RELEASE}
else
OPENEDX_GIT_BRANCH=master
fi

repos=(
"https://github.com/edx/course-discovery.git"
"https://github.com/edx/credentials.git"
Expand All @@ -40,11 +46,6 @@ _checkout ()
{
repos_to_checkout=("$@")

if [ -z "$OPENEDX_RELEASE" ]; then
branch="master"
else
branch="open-release/${OPENEDX_RELEASE}"
fi
for repo in "${repos_to_checkout[@]}"
do
# Use Bash's regex match operator to capture the name of the repo.
Expand All @@ -54,10 +55,9 @@ _checkout ()

# If a directory exists and it is nonempty, assume the repo has been cloned.
if [ -d "$name" -a -n "$(ls -A "$name" 2>/dev/null)" ]; then
echo "Checking out branch ${OPENEDX_GIT_BRANCH} of $name"
cd $name
echo "Checking out branch $branch of $name"
git pull
git checkout "$branch"
_checkout_and_update_branch
cd ..
fi
done
Expand All @@ -72,31 +72,43 @@ _clone ()
{
# for repo in ${repos[*]}
repos_to_clone=("$@")

for repo in "${repos_to_clone[@]}"
do
# Use Bash's regex match operator to capture the name of the repo.
# Results of the match are saved to an array called $BASH_REMATCH.
[[ $repo =~ $name_pattern ]]
name="${BASH_REMATCH[1]}"

# If a directory exists and it is nonempty, assume the repo has been checked out.
# If a directory exists and it is nonempty, assume the repo has been checked out
# and only make sure it's on the required branch
if [ -d "$name" -a -n "$(ls -A "$name" 2>/dev/null)" ]; then
printf "The [%s] repo is already checked out. Continuing.\n" $name
printf "The [%s] repo is already checked out. Checking for updates.\n" $name
cd ${DEVSTACK_WORKSPACE}/${name}
_checkout_and_update_branch
cd ..
else
if [ "${SHALLOW_CLONE}" == "1" ]; then
git clone -c core.symlinks=true --depth=1 $repo
git clone --single-branch -b ${OPENEDX_GIT_BRANCH} -c core.symlinks=true --depth=1 ${repo}
else
git clone -c core.symlinks=true $repo
fi
if [ -n "${OPENEDX_RELEASE}" ]; then
git checkout open-release/${OPENEDX_RELEASE}
git clone --single-branch -b ${OPENEDX_GIT_BRANCH} -c core.symlinks=true ${repo}
fi
fi
done
cd - &> /dev/null
}

_checkout_and_update_branch ()
{
GIT_SYMBOLIC_REF="$(git symbolic-ref HEAD 2>/dev/null)"
BRANCH_NAME=${GIT_SYMBOLIC_REF##refs/heads/}
if [ "${BRANCH_NAME}" == "${OPENEDX_GIT_BRANCH}" ]; then
git pull origin ${OPENEDX_GIT_BRANCH}
else
git fetch origin ${OPENEDX_GIT_BRANCH}:${OPENEDX_GIT_BRANCH}
git checkout ${OPENEDX_GIT_BRANCH}
fi
}

clone ()
{
_clone "${repos[@]}"
Expand Down

0 comments on commit 5848f75

Please sign in to comment.