From 9f14f76148637d89a17115caf3ba48ae70c0494b Mon Sep 17 00:00:00 2001 From: John Hill Date: Tue, 8 Aug 2023 08:39:11 -0700 Subject: [PATCH 1/5] Update git-opensource-tests.sh --- tests/git-opensource-tests.sh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/tests/git-opensource-tests.sh b/tests/git-opensource-tests.sh index 0d7d6a20..c0a838c5 100644 --- a/tests/git-opensource-tests.sh +++ b/tests/git-opensource-tests.sh @@ -1,11 +1,14 @@ #!/bin/sh # -# This script can clone/checkout a single folder from git repository -# - Might be used for checking out micro-services from monolithic git repository +# This script is designed copy the necessary e2e framework and test scripts from the Open MCT +# repository. # -# - You can even do checkout into home directory, for example -# git-sparse-clone.sh git@github.com:readdle/fluix-web.git /home/login login +# Usage: +# ./git-opensource-tests.sh [branch-name] # +# If no branch name is provided, the script defaults to the 'master' branch. + +set -e # Exit immediately if a command exits with a nonzero exit value SCRIPT_PATH=${0%/*} # Get the relative path to the script dir from the cwd if [ "$0" != "$SCRIPT_PATH" ] && [ "$SCRIPT_PATH" != "" ]; then @@ -14,28 +17,21 @@ fi rm -rf e2e/opensource -# This will cause the shell to exit immediately if a simple command exits with a nonzero exit value. -set -e - REPO_URL=https://github.com/nasa/openmct.git +REPO_BRANCH=${1:-master} # Use the first argument as the branch, or default to 'master' REPO_PATH=e2e LOCAL_REPO_ROOT="e2e/opensource" +E2E_PATH="opensource/e2e" -git clone --no-checkout --depth 1 $REPO_URL "$LOCAL_REPO_ROOT" +# Cloning the specified or default branch from the repository +git clone --no-checkout --depth 1 --branch $REPO_BRANCH $REPO_URL "$LOCAL_REPO_ROOT" cd "$LOCAL_REPO_ROOT" git config core.sparsecheckout true echo "/$REPO_PATH/**" > .git/info/sparse-checkout git read-tree -m -u HEAD -# moving back to /tests/ dir -cd .. +# Move all required files and folders +mv ../$E2E_PATH/*Fixtures.js ../$E2E_PATH/appActions.js ../$E2E_PATH/* ../$E2E_PATH/.eslintrc.js ../opensource -# Move fixtures and appActions -mv opensource/e2e/*Fixtures.js ./opensource -mv opensource/e2e/appActions.js ./opensource -# Move subfolders -mv opensource/e2e/*/ ./opensource -# Move eslint config -mv opensource/e2e/.eslintrc.js ./opensource # Cleanup -rm -rf opensource/e2e +rm -rf ../$E2E_PATH From 005bfd3e7d37c933857281401f8ff16d5239f163 Mon Sep 17 00:00:00 2001 From: John Hill Date: Wed, 9 Aug 2023 11:03:59 -0700 Subject: [PATCH 2/5] Update git-opensource-tests.sh --- tests/git-opensource-tests.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/git-opensource-tests.sh b/tests/git-opensource-tests.sh index c0a838c5..1a018bb7 100644 --- a/tests/git-opensource-tests.sh +++ b/tests/git-opensource-tests.sh @@ -21,9 +21,8 @@ REPO_URL=https://github.com/nasa/openmct.git REPO_BRANCH=${1:-master} # Use the first argument as the branch, or default to 'master' REPO_PATH=e2e LOCAL_REPO_ROOT="e2e/opensource" -E2E_PATH="opensource/e2e" +E2E_PATH="e2e/opensource/e2e" -# Cloning the specified or default branch from the repository git clone --no-checkout --depth 1 --branch $REPO_BRANCH $REPO_URL "$LOCAL_REPO_ROOT" cd "$LOCAL_REPO_ROOT" git config core.sparsecheckout true @@ -31,7 +30,7 @@ echo "/$REPO_PATH/**" > .git/info/sparse-checkout git read-tree -m -u HEAD # Move all required files and folders -mv ../$E2E_PATH/*Fixtures.js ../$E2E_PATH/appActions.js ../$E2E_PATH/* ../$E2E_PATH/.eslintrc.js ../opensource +mv $E2E_PATH/*Fixtures.js $E2E_PATH/appActions.js $E2E_PATH/* $E2E_PATH/.eslintrc.js ../opensource # Cleanup -rm -rf ../$E2E_PATH +rm -rf $E2E_PATH From 976f9dfeb12f5a865f397531c0985f8a1dd6a718 Mon Sep 17 00:00:00 2001 From: John Hill Date: Wed, 9 Aug 2023 11:09:39 -0700 Subject: [PATCH 3/5] Update git-opensource-tests.sh --- tests/git-opensource-tests.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/git-opensource-tests.sh b/tests/git-opensource-tests.sh index 1a018bb7..bb8ff0f6 100644 --- a/tests/git-opensource-tests.sh +++ b/tests/git-opensource-tests.sh @@ -29,8 +29,13 @@ git config core.sparsecheckout true echo "/$REPO_PATH/**" > .git/info/sparse-checkout git read-tree -m -u HEAD +# Debugging information +echo "Listing contents of $E2E_PATH:" +ls -l $E2E_PATH + # Move all required files and folders mv $E2E_PATH/*Fixtures.js $E2E_PATH/appActions.js $E2E_PATH/* $E2E_PATH/.eslintrc.js ../opensource # Cleanup rm -rf $E2E_PATH + From 576be81b4bcd21a16c6d4dc04106ec07170e3e1c Mon Sep 17 00:00:00 2001 From: John Hill Date: Wed, 9 Aug 2023 11:26:49 -0700 Subject: [PATCH 4/5] Update git-opensource-tests.sh --- tests/git-opensource-tests.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/git-opensource-tests.sh b/tests/git-opensource-tests.sh index bb8ff0f6..98863f37 100644 --- a/tests/git-opensource-tests.sh +++ b/tests/git-opensource-tests.sh @@ -4,24 +4,21 @@ # repository. # # Usage: -# ./git-opensource-tests.sh [branch-name] +# ./tests/git-opensource-tests.sh [branch-name] # # If no branch name is provided, the script defaults to the 'master' branch. set -e # Exit immediately if a command exits with a nonzero exit value -SCRIPT_PATH=${0%/*} # Get the relative path to the script dir from the cwd -if [ "$0" != "$SCRIPT_PATH" ] && [ "$SCRIPT_PATH" != "" ]; then - cd "$SCRIPT_PATH" -fi +SCRIPT_DIR="$(dirname "$0")" # Get the directory of the script +REPO_DIR="$SCRIPT_DIR/.." # Get the root directory of the repository -rm -rf e2e/opensource +rm -rf "$REPO_DIR/e2e/opensource" REPO_URL=https://github.com/nasa/openmct.git REPO_BRANCH=${1:-master} # Use the first argument as the branch, or default to 'master' REPO_PATH=e2e -LOCAL_REPO_ROOT="e2e/opensource" -E2E_PATH="e2e/opensource/e2e" +LOCAL_REPO_ROOT="$REPO_DIR/e2e/opensource" git clone --no-checkout --depth 1 --branch $REPO_BRANCH $REPO_URL "$LOCAL_REPO_ROOT" cd "$LOCAL_REPO_ROOT" @@ -30,12 +27,12 @@ echo "/$REPO_PATH/**" > .git/info/sparse-checkout git read-tree -m -u HEAD # Debugging information -echo "Listing contents of $E2E_PATH:" -ls -l $E2E_PATH +echo "Listing contents of $LOCAL_REPO_ROOT:" +ls -l # Move all required files and folders -mv $E2E_PATH/*Fixtures.js $E2E_PATH/appActions.js $E2E_PATH/* $E2E_PATH/.eslintrc.js ../opensource +mv "$LOCAL_REPO_ROOT/e2e"/*Fixtures.js "$LOCAL_REPO_ROOT/e2e/appActions.js" "$LOCAL_REPO_ROOT/e2e"/* "$LOCAL_REPO_ROOT/e2e/.eslintrc.js" "$REPO_DIR/opensource" # Cleanup -rm -rf $E2E_PATH +rm -rf "$LOCAL_REPO_ROOT/e2e" From 889479dbcc9a162664688e80fd7fb25552cd2510 Mon Sep 17 00:00:00 2001 From: John Hill Date: Wed, 9 Aug 2023 11:40:51 -0700 Subject: [PATCH 5/5] Update git-opensource-tests.sh --- tests/git-opensource-tests.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/git-opensource-tests.sh b/tests/git-opensource-tests.sh index 98863f37..bef4aa85 100644 --- a/tests/git-opensource-tests.sh +++ b/tests/git-opensource-tests.sh @@ -19,6 +19,10 @@ REPO_URL=https://github.com/nasa/openmct.git REPO_BRANCH=${1:-master} # Use the first argument as the branch, or default to 'master' REPO_PATH=e2e LOCAL_REPO_ROOT="$REPO_DIR/e2e/opensource" +TARGET_DIR="$REPO_DIR/opensource" + +# Create target directory if it doesn't exist +mkdir -p "$TARGET_DIR" git clone --no-checkout --depth 1 --branch $REPO_BRANCH $REPO_URL "$LOCAL_REPO_ROOT" cd "$LOCAL_REPO_ROOT" @@ -31,8 +35,7 @@ echo "Listing contents of $LOCAL_REPO_ROOT:" ls -l # Move all required files and folders -mv "$LOCAL_REPO_ROOT/e2e"/*Fixtures.js "$LOCAL_REPO_ROOT/e2e/appActions.js" "$LOCAL_REPO_ROOT/e2e"/* "$LOCAL_REPO_ROOT/e2e/.eslintrc.js" "$REPO_DIR/opensource" +mv "$LOCAL_REPO_ROOT/e2e"/*Fixtures.js "$LOCAL_REPO_ROOT/e2e/appActions.js" "$LOCAL_REPO_ROOT/e2e"/* "$LOCAL_REPO_ROOT/e2e/.eslintrc.js" "$TARGET_DIR" # Cleanup rm -rf "$LOCAL_REPO_ROOT/e2e" -