From b7b9cede80803292d482100e07939307457086d7 Mon Sep 17 00:00:00 2001 From: Christine Seeman Date: Mon, 16 Sep 2024 15:04:28 -0500 Subject: [PATCH 1/5] From working session Working on making the remote relative solution and tests of make relative remote function. This should help with the excludes not working by changing the folder structure. --- Makefile | 3 +- docker-compose.yml | 22 +++++ functions.sh | 33 +++++++ tests/test_functions.sh | 198 +++++++++++++++++++++++++++------------- 4 files changed, 190 insertions(+), 66 deletions(-) create mode 100644 docker-compose.yml diff --git a/Makefile b/Makefile index 6206910..a28060f 100644 --- a/Makefile +++ b/Makefile @@ -23,4 +23,5 @@ version: build docker image tag $(IMAGE) $(IMAGE_NAME):v$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION) test: - ./tests/test_functions.sh + @echo ๐Ÿงช Executing Unit Tests... + docker compose up \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ad2fcf0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +services: + test: + env_file: + - .env + build: + context: . + dockerfile: Dockerfile + image: wpengine/site-deploy:latest + platform: linux/amd64 + entrypoint: /bin/bash -c "/app/tests/test_functions.sh && tail -f /dev/null" + volumes: + - .:/app + depends_on: + - build + working_dir: /app/tests + + build: + image: wpengine/site-deploy:latest + build: + context: . + dockerfile: Dockerfile + command: /bin/true \ No newline at end of file diff --git a/functions.sh b/functions.sh index c2fa82c..ced3914 100644 --- a/functions.sh +++ b/functions.sh @@ -25,3 +25,36 @@ print_deployment_info() { echo -e "\t$flag" done } + +# Function to check REMOTE_PATH and move contents of SRC_PATH +make_relative_remote() { + if [[ -z "$REMOTE_PATH" && "$SRC_PATH" == "." ]]; then + echo "Default usage, no moving relative paths needed ๐Ÿ‘‹" + return + fi + + # Not sure if this check is necessary + if [[ "$SRC_PATH" == "$REMOTE_PATH" ]]; then + echo "SRC_PATH and REMOTE_PATH are the same, no moving relative paths needed ๐Ÿ‘‹" + return + fi + + # Echo the paths for debugging + echo "SRC_PATH: $SRC_PATH" + echo "REMOTE_PATH: $REMOTE_PATH" + mkdir -p "$REMOTE_PATH" + echo "Would have moved contents of SRC_PATH to REMOTE_PATH" + + if [ "$SRC_PATH" == "." ]; then + # Use a temporary directory to avoid moving REMOTE_PATH into itself + TMP_DIR=$(mktemp -d) + mv "$SRC_PATH"/* "$TMP_DIR" + mv "$TMP_DIR"/* "$REMOTE_PATH" + rmdir "$TMP_DIR" + else + mv "$SRC_PATH"/* "$REMOTE_PATH" + fi +} + + + diff --git a/tests/test_functions.sh b/tests/test_functions.sh index 3f1c10c..1f30f1f 100755 --- a/tests/test_functions.sh +++ b/tests/test_functions.sh @@ -6,73 +6,141 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${SCRIPT_DIR}/common.sh" source "${SCRIPT_DIR}/../functions.sh" -# First argument represents the value of the FLAGS variable. -# The rest of the arguments represent the expected values of the FLAGS_ARRAY. -# -# usage: test_parse_flags -test_parse_flags() { - local test_case=$1 - shift - local expected_args=("$@") - - parse_flags "$test_case" - - local actual_count="${#FLAGS_ARRAY[@]}" - local expected_count="${#expected_args[@]}" - - if [[ "$actual_count" -ne "$expected_count" ]]; then - echo -e "${RED}Test failed for FLAGS='$test_case': expected $expected_count arguments, got $actual_count." - echo -e "\tActual arguments: ${FLAGS_ARRAY[*]}${NC}" - return - fi +# # First argument represents the value of the FLAGS variable. +# # The rest of the arguments represent the expected values of the FLAGS_ARRAY. +# # +# # usage: test_parse_flags +# test_parse_flags() { +# local test_case=$1 +# shift +# local expected_args=("$@") + +# parse_flags "$test_case" + +# local actual_count="${#FLAGS_ARRAY[@]}" +# local expected_count="${#expected_args[@]}" + +# if [[ "$actual_count" -ne "$expected_count" ]]; then +# echo -e "${RED}Test failed for FLAGS='$test_case': expected $expected_count arguments, got $actual_count." +# echo -e "\tActual arguments: ${FLAGS_ARRAY[*]}${NC}" +# return +# fi + +# for i in "${!expected_args[@]}"; do +# if [[ "${FLAGS_ARRAY[$i]}" != "${expected_args[$i]}" ]]; then +# echo -e "${RED}Test failed for FLAGS='$test_case': expected '${expected_args[$i]}', got '${FLAGS_ARRAY[$i]}'.${NC}" +# return +# fi +# done + +# echo -e "${GREEN}Test passed for FLAGS=\"$test_case\".${NC}" +# } + +# # Test cases +# test_parse_flags \ +# "-azvr --inplace --exclude='.*'" \ +# "-azvr" \ +# "--inplace" \ +# "--exclude=.*" + +# test_parse_flags \ +# '-azvr --inplace --exclude=".*"' \ +# "-azvr" \ +# "--inplace" \ +# "--exclude=.*" + +# test_parse_flags \ +# "-azvr --filter=':- .gitignore' --exclude='.*'" \ +# "-azvr" \ +# "--filter=:- .gitignore" \ +# "--exclude=.*" + +# test_parse_flags \ +# "-avzr --delete --filter='P /wp-uploads/**'" \ +# "-avzr" \ +# "--delete" \ +# "--filter=P /wp-uploads/**" + +# test_parse_flags \ +# "-avzr --delete --exclude='\$dollar'" \ +# "-avzr" \ +# "--delete" \ +# "--exclude=\$dollar" + +# test_parse_flags \ +# "-avzr --exclude='\`back-ticks\`'" \ +# "-avzr" \ +# "--exclude=\`back-ticks\`" + +# test_parse_flags \ +# "-avzr --exclude='path\\with\\backslash'" \ +# "-avzr" \ +# "--exclude=path\\with\\backslash" - for i in "${!expected_args[@]}"; do - if [[ "${FLAGS_ARRAY[$i]}" != "${expected_args[$i]}" ]]; then - echo -e "${RED}Test failed for FLAGS='$test_case': expected '${expected_args[$i]}', got '${FLAGS_ARRAY[$i]}'.${NC}" +# Test resulting directory structure from calling make_relative_remote +# Expected output is the directory structure after moving the contents of SRC_PATH to REMOTE_PATH +# e.g. make_relative_remote "/home/user/website" "/var/www/html" should return "/var/www/html/website" +# 1st argument: SRC_PATH, 2nd argument: REMOTE_PATH, 3rd argument: EXPECTED_REMOTE_PATH +test_make_relative_remote() { + setup + REMOTE_PATH=$1 + SRC_PATH=$2 + EXPECTED_REMOTE_PATH=$3 + + echo -e "${GREEN}REMOTE_PATH='$REMOTE_PATH' SRC_PATH='$SRC_PATH' EXPECTED_REMOTE_PATH='$EXPECTED_REMOTE_PATH'" + # Should I cd into the test_dir? + make_relative_remote + + if [[ "$REMOTE_PATH" != "$EXPECTED_REMOTE_PATH" ]]; then + echo -e "${RED}Test failed for SRC_PATH='$SRC_PATH' and REMOTE_PATH='$REMOTE_PATH': expected '$EXPECTED_REMOTE_PATH', got '$REMOTE_PATH'.${NC}" return - fi - done + fi +} + +setup() { + mkdir -p "test_dir/wp-content" + mkdir -p "test_dir/local/wp-content/uploads" + mkdir -p "test_dir/local/wp-content/plugins/mu-plugins" + mkdir -p "test_dir/local/wp-content/themes" + + mkdir -p "test_dir/remote/" - echo -e "${GREEN}Test passed for FLAGS=\"$test_case\".${NC}" + echo "Sample upload file" > "test_dir/local/wp-content/uploads/sample_upload.txt" + echo "Sample plugin file" > "test_dir/local/wp-content/plugins/sample_plugin.txt" + touch "test_dir/local/wp-content/plugins/mu-plugins/.gitkeep" + echo "Sample theme file" > "test_dir/local/wp-content/themes/sample_theme.txt" + + echo "Created test_dir with wp-content structure and sample files." +} + +cleanup() { + rm -rf ./test_dir } -# Test cases -test_parse_flags \ - "-azvr --inplace --exclude='.*'" \ - "-azvr" \ - "--inplace" \ - "--exclude=.*" - -test_parse_flags \ - '-azvr --inplace --exclude=".*"' \ - "-azvr" \ - "--inplace" \ - "--exclude=.*" - -test_parse_flags \ - "-azvr --filter=':- .gitignore' --exclude='.*'" \ - "-azvr" \ - "--filter=:- .gitignore" \ - "--exclude=.*" - -test_parse_flags \ - "-avzr --delete --filter='P /wp-uploads/**'" \ - "-avzr" \ - "--delete" \ - "--filter=P /wp-uploads/**" - -test_parse_flags \ - "-avzr --delete --exclude='\$dollar'" \ - "-avzr" \ - "--delete" \ - "--exclude=\$dollar" - -test_parse_flags \ - "-avzr --exclude='\`back-ticks\`'" \ - "-avzr" \ - "--exclude=\`back-ticks\`" - -test_parse_flags \ - "-avzr --exclude='path\\with\\backslash'" \ - "-avzr" \ - "--exclude=path\\with\\backslash" +# Test cases, make remote directory relative to to the tests directory +test_make_relative_remote "" "." "" +test_make_relative_remote "./wp-content" "./wp-content" "./wp-content" +# Ok, I think I am still not understanding how to use make relative remote. I need to test the following scenarios: +# Need to walk through the actual scenerio seen, with the source being . +# REMOTE_PATH=/wp-content +#SRC_PATH=. +#remote = ./wp-content +#source (where I am at locally)= . (current folder), and aim is to make sure excludes goes from the base wp-content/uploads/ +# but can't test this... because it will start with top-level folder +test_make_relative_remote "/wp-content" "." "/wp-content" +#test_make_relative_remote "./test_dir/remote/wp-content" ".test_dir/local/wp-content" "./test_dir/remote/wp-content" + +# Just deploying out wp-content, need to make sure the resulting folder structure matched expected excludes layout. But what is the difference? +# REMOTE_PATH=/wp-content +# SRC_PATH=. +# EXPECTED_REMOTE_PATH= create wp-content, copy all contents of wp-content into it + +# Default: No movement happens +# REMOTE_PATH= +# SRC_PATH=. +# EXPECTED_REMOTE_PATH= nothing changed + +# Individual theme, need to make sure resulting folder structure matches expected excludes +# REMOTE_PATH=/wp-content/themes/beautiful-pro +# SRC_PATH=. +# EXPECTED_REMOTE_PATH=create wp-content/themes/beautiful-pro, copy all contents of beautiful-pro into the folder. \ No newline at end of file From c210a89524a568fbb552d8be113aafdd824ae7d9 Mon Sep 17 00:00:00 2001 From: Andrew Matthews Date: Thu, 3 Oct 2024 16:05:27 -0400 Subject: [PATCH 2/5] Isolate test data and workdir from local machine; fix function bug --- Dockerfile | 5 +- docker-compose.yml | 11 +- functions.sh | 4 +- tests/.gitignore | 1 + .../data/repository-3/mu-plugins/.gitkeep | 0 .../repository-3/plugins/sample_plugin.txt | 1 + .../data/repository-3/themes/sample_theme.txt | 1 + .../repository-3/uploads/sample_upload.txt | 1 + tests/test-make-relative-remote/test.sh | 64 ++++++ tests/test_functions.sh | 198 ++++++------------ 10 files changed, 145 insertions(+), 141 deletions(-) create mode 100644 tests/.gitignore create mode 100644 tests/test-make-relative-remote/data/repository-3/mu-plugins/.gitkeep create mode 100644 tests/test-make-relative-remote/data/repository-3/plugins/sample_plugin.txt create mode 100644 tests/test-make-relative-remote/data/repository-3/themes/sample_theme.txt create mode 100644 tests/test-make-relative-remote/data/repository-3/uploads/sample_upload.txt create mode 100755 tests/test-make-relative-remote/test.sh diff --git a/Dockerfile b/Dockerfile index d2939ed..c0d02ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM instrumentisto/rsync-ssh:alpine3.20 +FROM instrumentisto/rsync-ssh:alpine3.20 AS build # Intsall dependencies RUN apk update \ && apk upgrade \ @@ -11,3 +11,6 @@ ADD functions.sh /functions.sh ADD entrypoint.sh /entrypoint.sh ADD exclude.txt /exclude.txt ENTRYPOINT ["/entrypoint.sh"] + +FROM build AS test +COPY tests /tests diff --git a/docker-compose.yml b/docker-compose.yml index ad2fcf0..bee7c35 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,21 @@ services: test: - env_file: - - .env build: context: . dockerfile: Dockerfile + target: test image: wpengine/site-deploy:latest platform: linux/amd64 - entrypoint: /bin/bash -c "/app/tests/test_functions.sh && tail -f /dev/null" + entrypoint: /tests/test-make-relative-remote/test.sh volumes: - - .:/app + - ./tests/workspace:/workspace depends_on: - build - working_dir: /app/tests build: image: wpengine/site-deploy:latest build: context: . dockerfile: Dockerfile - command: /bin/true \ No newline at end of file + target: build + command: /bin/true diff --git a/functions.sh b/functions.sh index ced3914..a436d84 100644 --- a/functions.sh +++ b/functions.sh @@ -42,16 +42,18 @@ make_relative_remote() { # Echo the paths for debugging echo "SRC_PATH: $SRC_PATH" echo "REMOTE_PATH: $REMOTE_PATH" - mkdir -p "$REMOTE_PATH" echo "Would have moved contents of SRC_PATH to REMOTE_PATH" if [ "$SRC_PATH" == "." ]; then # Use a temporary directory to avoid moving REMOTE_PATH into itself TMP_DIR=$(mktemp -d) + ls -la "$SRC_PATH" mv "$SRC_PATH"/* "$TMP_DIR" + mkdir -p "$REMOTE_PATH" mv "$TMP_DIR"/* "$REMOTE_PATH" rmdir "$TMP_DIR" else + mkdir -p "$REMOTE_PATH" mv "$SRC_PATH"/* "$REMOTE_PATH" fi } diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..b39f5aa --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +workspace/**/* diff --git a/tests/test-make-relative-remote/data/repository-3/mu-plugins/.gitkeep b/tests/test-make-relative-remote/data/repository-3/mu-plugins/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/test-make-relative-remote/data/repository-3/plugins/sample_plugin.txt b/tests/test-make-relative-remote/data/repository-3/plugins/sample_plugin.txt new file mode 100644 index 0000000..34404e5 --- /dev/null +++ b/tests/test-make-relative-remote/data/repository-3/plugins/sample_plugin.txt @@ -0,0 +1 @@ +Sample plugin file diff --git a/tests/test-make-relative-remote/data/repository-3/themes/sample_theme.txt b/tests/test-make-relative-remote/data/repository-3/themes/sample_theme.txt new file mode 100644 index 0000000..b8ed081 --- /dev/null +++ b/tests/test-make-relative-remote/data/repository-3/themes/sample_theme.txt @@ -0,0 +1 @@ +Sample theme file diff --git a/tests/test-make-relative-remote/data/repository-3/uploads/sample_upload.txt b/tests/test-make-relative-remote/data/repository-3/uploads/sample_upload.txt new file mode 100644 index 0000000..e946a2e --- /dev/null +++ b/tests/test-make-relative-remote/data/repository-3/uploads/sample_upload.txt @@ -0,0 +1 @@ +Sample upload file diff --git a/tests/test-make-relative-remote/test.sh b/tests/test-make-relative-remote/test.sh new file mode 100755 index 0000000..5c1390c --- /dev/null +++ b/tests/test-make-relative-remote/test.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +# Get the directory of the current script +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${SCRIPT_DIR}/../common.sh" +source "${SCRIPT_DIR}/../../functions.sh" + +setup() { + rm -rf /workspace/* + local test_data_dir="${SCRIPT_DIR}/data/repository-${1}/" + if [[ -d "${test_data_dir}" ]]; then + cp -r "${test_data_dir}"* /workspace/ + fi + cd /workspace +} + +# Test resulting directory structure from calling make_relative_remote +# Expected output is the directory structure after moving the contents of SRC_PATH to REMOTE_PATH +# e.g. make_relative_remote "/home/user/website" "/var/www/html" should return "/var/www/html/website" +# 1st argument: SRC_PATH, 2nd argument: REMOTE_PATH, 3rd argument: EXPECTED_REMOTE_PATH +test_make_relative_remote() { + setup "$1" + SRC_PATH=$2 + REMOTE_PATH=$3 + EXPECTED_REMOTE_PATH=$4 + + echo -e "${GREEN}REMOTE_PATH='$REMOTE_PATH' SRC_PATH='$SRC_PATH' EXPECTED_REMOTE_PATH='$EXPECTED_REMOTE_PATH'" + # Should I cd into the test_dir? + make_relative_remote + + if [[ "$REMOTE_PATH" != "$EXPECTED_REMOTE_PATH" ]]; then + echo -e "${RED}Test failed for SRC_PATH='$SRC_PATH' and REMOTE_PATH='$REMOTE_PATH': expected '$EXPECTED_REMOTE_PATH', got '$REMOTE_PATH'.${NC}" + return + fi +} + +# Test cases, make remote directory relative to to the tests directory +test_make_relative_remote "1" "." "" "" +test_make_relative_remote "2" "./wp-content" "./wp-content" "./wp-content" +# Ok, I think I am still not understanding how to use make relative remote. I need to test the following scenarios: +# Need to walk through the actual scenerio seen, with the source being . +# REMOTE_PATH=/wp-content +#SRC_PATH=. +#remote = ./wp-content +#source (where I am at locally)= . (current folder), and aim is to make sure excludes goes from the base wp-content/uploads/ +# but can't test this... because it will start with top-level folder +test_make_relative_remote "3" "." "wp-content/" "wp-content/" +#test_make_relative_remote "./test_dir/remote/wp-content" ".test_dir/local/wp-content" "./test_dir/remote/wp-content" + +# Just deploying out wp-content, need to make sure the resulting folder structure matched expected excludes layout. But what is the difference? +# REMOTE_PATH=/wp-content +# SRC_PATH=. +# EXPECTED_REMOTE_PATH= create wp-content, copy all contents of wp-content into it + +# Default: No movement happens +# REMOTE_PATH= +# SRC_PATH=. +# EXPECTED_REMOTE_PATH= nothing changed + +# Individual theme, need to make sure resulting folder structure matches expected excludes +# REMOTE_PATH=/wp-content/themes/beautiful-pro +# SRC_PATH=. +# EXPECTED_REMOTE_PATH=create wp-content/themes/beautiful-pro, copy all contents of beautiful-pro into the folder. diff --git a/tests/test_functions.sh b/tests/test_functions.sh index 1f30f1f..3f1c10c 100755 --- a/tests/test_functions.sh +++ b/tests/test_functions.sh @@ -6,141 +6,73 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${SCRIPT_DIR}/common.sh" source "${SCRIPT_DIR}/../functions.sh" -# # First argument represents the value of the FLAGS variable. -# # The rest of the arguments represent the expected values of the FLAGS_ARRAY. -# # -# # usage: test_parse_flags -# test_parse_flags() { -# local test_case=$1 -# shift -# local expected_args=("$@") - -# parse_flags "$test_case" - -# local actual_count="${#FLAGS_ARRAY[@]}" -# local expected_count="${#expected_args[@]}" - -# if [[ "$actual_count" -ne "$expected_count" ]]; then -# echo -e "${RED}Test failed for FLAGS='$test_case': expected $expected_count arguments, got $actual_count." -# echo -e "\tActual arguments: ${FLAGS_ARRAY[*]}${NC}" -# return -# fi - -# for i in "${!expected_args[@]}"; do -# if [[ "${FLAGS_ARRAY[$i]}" != "${expected_args[$i]}" ]]; then -# echo -e "${RED}Test failed for FLAGS='$test_case': expected '${expected_args[$i]}', got '${FLAGS_ARRAY[$i]}'.${NC}" -# return -# fi -# done - -# echo -e "${GREEN}Test passed for FLAGS=\"$test_case\".${NC}" -# } - -# # Test cases -# test_parse_flags \ -# "-azvr --inplace --exclude='.*'" \ -# "-azvr" \ -# "--inplace" \ -# "--exclude=.*" - -# test_parse_flags \ -# '-azvr --inplace --exclude=".*"' \ -# "-azvr" \ -# "--inplace" \ -# "--exclude=.*" - -# test_parse_flags \ -# "-azvr --filter=':- .gitignore' --exclude='.*'" \ -# "-azvr" \ -# "--filter=:- .gitignore" \ -# "--exclude=.*" - -# test_parse_flags \ -# "-avzr --delete --filter='P /wp-uploads/**'" \ -# "-avzr" \ -# "--delete" \ -# "--filter=P /wp-uploads/**" - -# test_parse_flags \ -# "-avzr --delete --exclude='\$dollar'" \ -# "-avzr" \ -# "--delete" \ -# "--exclude=\$dollar" - -# test_parse_flags \ -# "-avzr --exclude='\`back-ticks\`'" \ -# "-avzr" \ -# "--exclude=\`back-ticks\`" - -# test_parse_flags \ -# "-avzr --exclude='path\\with\\backslash'" \ -# "-avzr" \ -# "--exclude=path\\with\\backslash" - -# Test resulting directory structure from calling make_relative_remote -# Expected output is the directory structure after moving the contents of SRC_PATH to REMOTE_PATH -# e.g. make_relative_remote "/home/user/website" "/var/www/html" should return "/var/www/html/website" -# 1st argument: SRC_PATH, 2nd argument: REMOTE_PATH, 3rd argument: EXPECTED_REMOTE_PATH -test_make_relative_remote() { - setup - REMOTE_PATH=$1 - SRC_PATH=$2 - EXPECTED_REMOTE_PATH=$3 - - echo -e "${GREEN}REMOTE_PATH='$REMOTE_PATH' SRC_PATH='$SRC_PATH' EXPECTED_REMOTE_PATH='$EXPECTED_REMOTE_PATH'" - # Should I cd into the test_dir? - make_relative_remote - - if [[ "$REMOTE_PATH" != "$EXPECTED_REMOTE_PATH" ]]; then - echo -e "${RED}Test failed for SRC_PATH='$SRC_PATH' and REMOTE_PATH='$REMOTE_PATH': expected '$EXPECTED_REMOTE_PATH', got '$REMOTE_PATH'.${NC}" - return +# First argument represents the value of the FLAGS variable. +# The rest of the arguments represent the expected values of the FLAGS_ARRAY. +# +# usage: test_parse_flags +test_parse_flags() { + local test_case=$1 + shift + local expected_args=("$@") + + parse_flags "$test_case" + + local actual_count="${#FLAGS_ARRAY[@]}" + local expected_count="${#expected_args[@]}" + + if [[ "$actual_count" -ne "$expected_count" ]]; then + echo -e "${RED}Test failed for FLAGS='$test_case': expected $expected_count arguments, got $actual_count." + echo -e "\tActual arguments: ${FLAGS_ARRAY[*]}${NC}" + return fi -} - -setup() { - mkdir -p "test_dir/wp-content" - mkdir -p "test_dir/local/wp-content/uploads" - mkdir -p "test_dir/local/wp-content/plugins/mu-plugins" - mkdir -p "test_dir/local/wp-content/themes" - - mkdir -p "test_dir/remote/" - echo "Sample upload file" > "test_dir/local/wp-content/uploads/sample_upload.txt" - echo "Sample plugin file" > "test_dir/local/wp-content/plugins/sample_plugin.txt" - touch "test_dir/local/wp-content/plugins/mu-plugins/.gitkeep" - echo "Sample theme file" > "test_dir/local/wp-content/themes/sample_theme.txt" - - echo "Created test_dir with wp-content structure and sample files." -} + for i in "${!expected_args[@]}"; do + if [[ "${FLAGS_ARRAY[$i]}" != "${expected_args[$i]}" ]]; then + echo -e "${RED}Test failed for FLAGS='$test_case': expected '${expected_args[$i]}', got '${FLAGS_ARRAY[$i]}'.${NC}" + return + fi + done -cleanup() { - rm -rf ./test_dir + echo -e "${GREEN}Test passed for FLAGS=\"$test_case\".${NC}" } -# Test cases, make remote directory relative to to the tests directory -test_make_relative_remote "" "." "" -test_make_relative_remote "./wp-content" "./wp-content" "./wp-content" -# Ok, I think I am still not understanding how to use make relative remote. I need to test the following scenarios: -# Need to walk through the actual scenerio seen, with the source being . -# REMOTE_PATH=/wp-content -#SRC_PATH=. -#remote = ./wp-content -#source (where I am at locally)= . (current folder), and aim is to make sure excludes goes from the base wp-content/uploads/ -# but can't test this... because it will start with top-level folder -test_make_relative_remote "/wp-content" "." "/wp-content" -#test_make_relative_remote "./test_dir/remote/wp-content" ".test_dir/local/wp-content" "./test_dir/remote/wp-content" - -# Just deploying out wp-content, need to make sure the resulting folder structure matched expected excludes layout. But what is the difference? -# REMOTE_PATH=/wp-content -# SRC_PATH=. -# EXPECTED_REMOTE_PATH= create wp-content, copy all contents of wp-content into it - -# Default: No movement happens -# REMOTE_PATH= -# SRC_PATH=. -# EXPECTED_REMOTE_PATH= nothing changed - -# Individual theme, need to make sure resulting folder structure matches expected excludes -# REMOTE_PATH=/wp-content/themes/beautiful-pro -# SRC_PATH=. -# EXPECTED_REMOTE_PATH=create wp-content/themes/beautiful-pro, copy all contents of beautiful-pro into the folder. \ No newline at end of file +# Test cases +test_parse_flags \ + "-azvr --inplace --exclude='.*'" \ + "-azvr" \ + "--inplace" \ + "--exclude=.*" + +test_parse_flags \ + '-azvr --inplace --exclude=".*"' \ + "-azvr" \ + "--inplace" \ + "--exclude=.*" + +test_parse_flags \ + "-azvr --filter=':- .gitignore' --exclude='.*'" \ + "-azvr" \ + "--filter=:- .gitignore" \ + "--exclude=.*" + +test_parse_flags \ + "-avzr --delete --filter='P /wp-uploads/**'" \ + "-avzr" \ + "--delete" \ + "--filter=P /wp-uploads/**" + +test_parse_flags \ + "-avzr --delete --exclude='\$dollar'" \ + "-avzr" \ + "--delete" \ + "--exclude=\$dollar" + +test_parse_flags \ + "-avzr --exclude='\`back-ticks\`'" \ + "-avzr" \ + "--exclude=\`back-ticks\`" + +test_parse_flags \ + "-avzr --exclude='path\\with\\backslash'" \ + "-avzr" \ + "--exclude=path\\with\\backslash" From c137d4c66b03ee82da12953b3d9a9597cd2494f7 Mon Sep 17 00:00:00 2001 From: Christine Seeman Date: Thu, 3 Oct 2024 15:55:46 -0500 Subject: [PATCH 3/5] [CICD-761] Updated Docker Removed out the extra targets in the Docker file. Also outlines next testing steps for scenerios and better checks for the workspace folder structure. Co-authored-By: Michael Day Co-authored-By: Andrew Matthews --- Dockerfile | 4 +- Makefile | 9 ++- docker-compose.yml | 4 +- entrypoint.sh | 5 ++ functions.sh | 33 ++++------ .../themes/beautiful-pro/sample_theme.txt | 1 + .../elwood-plugin/dry-white-toast.txt | 0 .../jake-plugin/four-whole-fried-chickens.txt | 0 .../elwood-plugin/dry-white-toast.txt | 0 .../jake-plugin/four-whole-fried-chickens.txt | 0 tests/test-make-relative-remote/test.sh | 64 +++++++++---------- 11 files changed, 59 insertions(+), 61 deletions(-) create mode 100644 tests/test-make-relative-remote/data/repository-4/themes/beautiful-pro/sample_theme.txt create mode 100644 tests/test-make-relative-remote/data/repository-5/my-awesome-plugins/elwood-plugin/dry-white-toast.txt create mode 100644 tests/test-make-relative-remote/data/repository-5/my-awesome-plugins/jake-plugin/four-whole-fried-chickens.txt create mode 100644 tests/test-make-relative-remote/data/repository-6/my-awesome-plugins/blues-brothers/elwood-plugin/dry-white-toast.txt create mode 100644 tests/test-make-relative-remote/data/repository-6/my-awesome-plugins/blues-brothers/jake-plugin/four-whole-fried-chickens.txt diff --git a/Dockerfile b/Dockerfile index c0d02ae..c12b5f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM instrumentisto/rsync-ssh:alpine3.20 AS build +FROM instrumentisto/rsync-ssh:alpine3.20 # Intsall dependencies RUN apk update \ && apk upgrade \ @@ -12,5 +12,3 @@ ADD entrypoint.sh /entrypoint.sh ADD exclude.txt /exclude.txt ENTRYPOINT ["/entrypoint.sh"] -FROM build AS test -COPY tests /tests diff --git a/Makefile b/Makefile index a28060f..0ba5101 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,9 @@ version: build docker image tag $(IMAGE) $(IMAGE_NAME):v$(MAJOR_VERSION).$(MINOR_VERSION) && \ docker image tag $(IMAGE) $(IMAGE_NAME):v$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION) -test: - @echo ๐Ÿงช Executing Unit Tests... - docker compose up \ No newline at end of file +test-unit: + ./tests/test_functions.sh + +test-integration: + @echo ๐Ÿงช Executing Relative Remote Tests... + docker compose up test \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index bee7c35..f48c92e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,12 +3,13 @@ services: build: context: . dockerfile: Dockerfile - target: test image: wpengine/site-deploy:latest platform: linux/amd64 entrypoint: /tests/test-make-relative-remote/test.sh + #connects local directory to container directory volumes: - ./tests/workspace:/workspace + - ./tests:/tests depends_on: - build @@ -17,5 +18,4 @@ services: build: context: . dockerfile: Dockerfile - target: build command: /bin/true diff --git a/entrypoint.sh b/entrypoint.sh index 90edf79..c479367 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -106,6 +106,10 @@ check_cache() { fi } +check_folder() { + make_relative_remote "$SRC_PATH" "$REMOTE_PATH" +} + sync_files() { #create multiplex connection ssh -nNf -v -i "${WPE_SSHG_KEY_PRIVATE_PATH}" -o StrictHostKeyChecking=no -o ControlMaster=yes -o ControlPath="$SSH_PATH/ctl/%C" "$WPE_FULL_HOST" @@ -146,4 +150,5 @@ setup_env setup_ssh_dir check_lint check_cache +check_folder sync_files diff --git a/functions.sh b/functions.sh index a436d84..51e9246 100644 --- a/functions.sh +++ b/functions.sh @@ -33,29 +33,22 @@ make_relative_remote() { return fi - # Not sure if this check is necessary if [[ "$SRC_PATH" == "$REMOTE_PATH" ]]; then - echo "SRC_PATH and REMOTE_PATH are the same, no moving relative paths needed ๐Ÿ‘‹" - return + echo "SRC_PATH and REMOTE_PATH are the same, no moving relative paths needed ๐Ÿ‘‹" + return fi - # Echo the paths for debugging - echo "SRC_PATH: $SRC_PATH" - echo "REMOTE_PATH: $REMOTE_PATH" - echo "Would have moved contents of SRC_PATH to REMOTE_PATH" - - if [ "$SRC_PATH" == "." ]; then - # Use a temporary directory to avoid moving REMOTE_PATH into itself - TMP_DIR=$(mktemp -d) - ls -la "$SRC_PATH" - mv "$SRC_PATH"/* "$TMP_DIR" - mkdir -p "$REMOTE_PATH" - mv "$TMP_DIR"/* "$REMOTE_PATH" - rmdir "$TMP_DIR" - else - mkdir -p "$REMOTE_PATH" - mv "$SRC_PATH"/* "$REMOTE_PATH" - fi + if [ "$SRC_PATH" == "." ]; then + # Use a temporary directory to avoid moving REMOTE_PATH into itself + TMP_DIR=$(mktemp -d) + mv "$SRC_PATH"/* "$TMP_DIR" + mkdir -p "$REMOTE_PATH" + mv "$TMP_DIR"/* "$REMOTE_PATH" + rmdir "$TMP_DIR" + else + mkdir -p "$REMOTE_PATH" + mv "$SRC_PATH"/* "$REMOTE_PATH" + fi } diff --git a/tests/test-make-relative-remote/data/repository-4/themes/beautiful-pro/sample_theme.txt b/tests/test-make-relative-remote/data/repository-4/themes/beautiful-pro/sample_theme.txt new file mode 100644 index 0000000..b8ed081 --- /dev/null +++ b/tests/test-make-relative-remote/data/repository-4/themes/beautiful-pro/sample_theme.txt @@ -0,0 +1 @@ +Sample theme file diff --git a/tests/test-make-relative-remote/data/repository-5/my-awesome-plugins/elwood-plugin/dry-white-toast.txt b/tests/test-make-relative-remote/data/repository-5/my-awesome-plugins/elwood-plugin/dry-white-toast.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/test-make-relative-remote/data/repository-5/my-awesome-plugins/jake-plugin/four-whole-fried-chickens.txt b/tests/test-make-relative-remote/data/repository-5/my-awesome-plugins/jake-plugin/four-whole-fried-chickens.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/test-make-relative-remote/data/repository-6/my-awesome-plugins/blues-brothers/elwood-plugin/dry-white-toast.txt b/tests/test-make-relative-remote/data/repository-6/my-awesome-plugins/blues-brothers/elwood-plugin/dry-white-toast.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/test-make-relative-remote/data/repository-6/my-awesome-plugins/blues-brothers/jake-plugin/four-whole-fried-chickens.txt b/tests/test-make-relative-remote/data/repository-6/my-awesome-plugins/blues-brothers/jake-plugin/four-whole-fried-chickens.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/test-make-relative-remote/test.sh b/tests/test-make-relative-remote/test.sh index 5c1390c..cfa49c6 100755 --- a/tests/test-make-relative-remote/test.sh +++ b/tests/test-make-relative-remote/test.sh @@ -10,6 +10,7 @@ setup() { rm -rf /workspace/* local test_data_dir="${SCRIPT_DIR}/data/repository-${1}/" if [[ -d "${test_data_dir}" ]]; then + # Works like GitHub action, checking out the workspace directory cp -r "${test_data_dir}"* /workspace/ fi cd /workspace @@ -18,47 +19,44 @@ setup() { # Test resulting directory structure from calling make_relative_remote # Expected output is the directory structure after moving the contents of SRC_PATH to REMOTE_PATH # e.g. make_relative_remote "/home/user/website" "/var/www/html" should return "/var/www/html/website" -# 1st argument: SRC_PATH, 2nd argument: REMOTE_PATH, 3rd argument: EXPECTED_REMOTE_PATH +# 1st argument: SRC_PATH, 2nd argument: REMOTE_PATH +# How can I make sure the make test is not caching the docker and creating it fresh test_make_relative_remote() { setup "$1" SRC_PATH=$2 REMOTE_PATH=$3 - EXPECTED_REMOTE_PATH=$4 - echo -e "${GREEN}REMOTE_PATH='$REMOTE_PATH' SRC_PATH='$SRC_PATH' EXPECTED_REMOTE_PATH='$EXPECTED_REMOTE_PATH'" - # Should I cd into the test_dir? + echo -e "${GREEN}REMOTE_PATH='$REMOTE_PATH' SRC_PATH='$SRC_PATH'${NC}" make_relative_remote - if [[ "$REMOTE_PATH" != "$EXPECTED_REMOTE_PATH" ]]; then - echo -e "${RED}Test failed for SRC_PATH='$SRC_PATH' and REMOTE_PATH='$REMOTE_PATH': expected '$EXPECTED_REMOTE_PATH', got '$REMOTE_PATH'.${NC}" - return + # Only compare the expected directory structure if REMOTE_PATH is not empty and REMOTE_PATH is not equal to SRC_PATH + if [[ -n "$REMOTE_PATH" && "$REMOTE_PATH" != "$SRC_PATH" ]]; then + # Verify that REMOTE_PATH and its folders exist in /workspace + if [ -d "/workspace/$REMOTE_PATH" ]; then + echo -e "${GREEN}REMOTE_PATH exists in /workspace${NC}" + + # Compare the contents of the moved REMOTE_PATH to the corresponding files in the data directory + EXPECTED_PATH="${SCRIPT_DIR}/data/repository-${1}/$SRC_PATH" + diff -r "/workspace/$REMOTE_PATH" "$EXPECTED_PATH" + + # Check the result of the diff command + if [[ $? -ne 0 ]]; then + echo -e "${RED}Verification failed: expected structure does not match.${NC}" + else + echo -e "${GREEN}Verification passed: expected structure matches.${NC}" + fi + else + echo -e "${RED}Verification failed: REMOTE_PATH does not exist in /workspace.${NC}" + fi + else + echo -e "${YELLOW}REMOTE_PATH is empty or equal to SRC_PATH, skipping comparison.${NC}" fi } # Test cases, make remote directory relative to to the tests directory -test_make_relative_remote "1" "." "" "" -test_make_relative_remote "2" "./wp-content" "./wp-content" "./wp-content" -# Ok, I think I am still not understanding how to use make relative remote. I need to test the following scenarios: -# Need to walk through the actual scenerio seen, with the source being . -# REMOTE_PATH=/wp-content -#SRC_PATH=. -#remote = ./wp-content -#source (where I am at locally)= . (current folder), and aim is to make sure excludes goes from the base wp-content/uploads/ -# but can't test this... because it will start with top-level folder -test_make_relative_remote "3" "." "wp-content/" "wp-content/" -#test_make_relative_remote "./test_dir/remote/wp-content" ".test_dir/local/wp-content" "./test_dir/remote/wp-content" - -# Just deploying out wp-content, need to make sure the resulting folder structure matched expected excludes layout. But what is the difference? -# REMOTE_PATH=/wp-content -# SRC_PATH=. -# EXPECTED_REMOTE_PATH= create wp-content, copy all contents of wp-content into it - -# Default: No movement happens -# REMOTE_PATH= -# SRC_PATH=. -# EXPECTED_REMOTE_PATH= nothing changed - -# Individual theme, need to make sure resulting folder structure matches expected excludes -# REMOTE_PATH=/wp-content/themes/beautiful-pro -# SRC_PATH=. -# EXPECTED_REMOTE_PATH=create wp-content/themes/beautiful-pro, copy all contents of beautiful-pro into the folder. +test_make_relative_remote "1" "." "" +test_make_relative_remote "2" "./wp-content" "./wp-content" +test_make_relative_remote "3" "." "wp-content/" +test_make_relative_remote "4" "." "wp-content/themes/beautiful-pro" +test_make_relative_remote "5" "my-awesome-plugins" "wp-content/plugins" +test_make_relative_remote "6" "my-awesome-plugins/blues-brothers" "wp-content/plugins" \ No newline at end of file From 10723ddbe67f7b189cf18085199a3a571451d97d Mon Sep 17 00:00:00 2001 From: Christine Seeman Date: Tue, 26 Nov 2024 14:21:21 -0600 Subject: [PATCH 4/5] [CICD-761] Removing make remote relative method With the help of Michael, it was determined that the easiest way to make sure that the excludes files is fully used for the rsynch command, is to make sure to use the file name, but not the full file path. This will make sure the files are excluded, no matter which folder location you attempt to deploy to. So default base of the wordpress install will work, or if you use within wp-content or other folder locations. Removing out the testing calls for now too, until we can get a better mocking framework in place to make sure synch_files can be full tested. Co-authored-By: Michael Day --- Dockerfile | 1 - Makefile | 6 ++-- entrypoint.sh | 5 --- exclude.txt | 48 ++++++++++++------------- functions.sh | 28 --------------- tests/test-make-relative-remote/test.sh | 38 +++++++++++++------- 6 files changed, 53 insertions(+), 73 deletions(-) diff --git a/Dockerfile b/Dockerfile index c12b5f4..d2939ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,3 @@ ADD functions.sh /functions.sh ADD entrypoint.sh /entrypoint.sh ADD exclude.txt /exclude.txt ENTRYPOINT ["/entrypoint.sh"] - diff --git a/Makefile b/Makefile index 0ba5101..2f785df 100644 --- a/Makefile +++ b/Makefile @@ -26,5 +26,7 @@ test-unit: ./tests/test_functions.sh test-integration: - @echo ๐Ÿงช Executing Relative Remote Tests... - docker compose up test \ No newline at end of file + # TODO: Currently commenting out the integration tests as they are not ready yet + # this was setup for the relative remote work, and is not currently working with + # testing sync_files function. + # docker compose up test diff --git a/entrypoint.sh b/entrypoint.sh index c479367..90edf79 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -106,10 +106,6 @@ check_cache() { fi } -check_folder() { - make_relative_remote "$SRC_PATH" "$REMOTE_PATH" -} - sync_files() { #create multiplex connection ssh -nNf -v -i "${WPE_SSHG_KEY_PRIVATE_PATH}" -o StrictHostKeyChecking=no -o ControlMaster=yes -o ControlPath="$SSH_PATH/ctl/%C" "$WPE_FULL_HOST" @@ -150,5 +146,4 @@ setup_env setup_ssh_dir check_lint check_cache -check_folder sync_files diff --git a/exclude.txt b/exclude.txt index 9d376d4..ddc9548 100644 --- a/exclude.txt +++ b/exclude.txt @@ -18,17 +18,17 @@ Thumbs.db # NOTE: # These files are excluded from the deploy so as to prevent unwanted errors from occurring, # such as accidentally deploying a local version of wp-config.php or accidentally deleting -# wp-content/uploads/ if a --delete flag is passed while deploying root. Most paths here +# uploads/ if a --delete flag is passed while deploying root. Most paths here # are ingnored in the WPE sample .gitignore per best practice. wp-config.php -wp-content/uploads/ -wp-content/blogs.dir/ -wp-content/upgrade/* -wp-content/backup-db/* -wp-content/advanced-cache.php -wp-content/wp-cache-config.php -wp-content/cache/* -wp-content/cache/supercache/* +uploads/ +blogs.dir/ +upgrade/* +backup-db/* +advanced-cache.php +wp-cache-config.php +cache/* +cache/supercache/* # WP Engine specific files # NOTE: @@ -44,20 +44,20 @@ wp-content/cache/supercache/* .wpe-devkit/ .wpengine-conf/ _wpeprivate -wp-content/object-cache.php -wp-content/mu-plugins/mu-plugin.php -wp-content/mu-plugins/slt-force-strong-passwords.php -wp-content/mu-plugins/wpengine-security-auditor.php -wp-content/mu-plugins/stop-long-comments.php -wp-content/mu-plugins/force-strong-passwords* -wp-content/mu-plugins/wpengine-common* -wp-content/mu-plugins/wpe-wp-sign-on-plugin* -wp-content/mu-plugins/wpe-elasticpress-autosuggest-logger* -wp-content/mu-plugins/wpe-cache-plugin* -wp-content/mu-plugins/wp-cache-memcached* -wp-content/drop-ins/ -wp-content/drop-ins/wp-cache-memcached* -wp-content/mysql.sql +object-cache.php +mu-plugin.php +slt-force-strong-passwords.php +wpengine-security-auditor.php +stop-long-comments.php +force-strong-passwords* +wpengine-common* +wpe-wp-sign-on-plugin* +wpe-elasticpress-autosuggest-logger* +wpe-cache-plugin* +wp-cache-memcached* +drop-ins/ +drop-ins/wp-cache-memcached* +mysql.sql # Local specific -wp-content/mu-plugins/local-by-flywheel-live-link-helper.php +local-by-flywheel-live-link-helper.php diff --git a/functions.sh b/functions.sh index 51e9246..c2fa82c 100644 --- a/functions.sh +++ b/functions.sh @@ -25,31 +25,3 @@ print_deployment_info() { echo -e "\t$flag" done } - -# Function to check REMOTE_PATH and move contents of SRC_PATH -make_relative_remote() { - if [[ -z "$REMOTE_PATH" && "$SRC_PATH" == "." ]]; then - echo "Default usage, no moving relative paths needed ๐Ÿ‘‹" - return - fi - - if [[ "$SRC_PATH" == "$REMOTE_PATH" ]]; then - echo "SRC_PATH and REMOTE_PATH are the same, no moving relative paths needed ๐Ÿ‘‹" - return - fi - - if [ "$SRC_PATH" == "." ]; then - # Use a temporary directory to avoid moving REMOTE_PATH into itself - TMP_DIR=$(mktemp -d) - mv "$SRC_PATH"/* "$TMP_DIR" - mkdir -p "$REMOTE_PATH" - mv "$TMP_DIR"/* "$REMOTE_PATH" - rmdir "$TMP_DIR" - else - mkdir -p "$REMOTE_PATH" - mv "$SRC_PATH"/* "$REMOTE_PATH" - fi -} - - - diff --git a/tests/test-make-relative-remote/test.sh b/tests/test-make-relative-remote/test.sh index cfa49c6..7889511 100755 --- a/tests/test-make-relative-remote/test.sh +++ b/tests/test-make-relative-remote/test.sh @@ -5,6 +5,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${SCRIPT_DIR}/../common.sh" source "${SCRIPT_DIR}/../../functions.sh" +source "${SCRIPT_DIR}/../../entrypoint.sh" setup() { rm -rf /workspace/* @@ -13,21 +14,32 @@ setup() { # Works like GitHub action, checking out the workspace directory cp -r "${test_data_dir}"* /workspace/ fi + ssh-keygen -t rsa -b 2048 -f /workspace/mock_ssh_key -N "" + chmod 600 /workspace/mock_ssh_key + cd /workspace } -# Test resulting directory structure from calling make_relative_remote -# Expected output is the directory structure after moving the contents of SRC_PATH to REMOTE_PATH -# e.g. make_relative_remote "/home/user/website" "/var/www/html" should return "/var/www/html/website" -# 1st argument: SRC_PATH, 2nd argument: REMOTE_PATH -# How can I make sure the make test is not caching the docker and creating it fresh -test_make_relative_remote() { +# Test resulting directory structure from calling sync_files +test_sync_files() { setup "$1" SRC_PATH=$2 REMOTE_PATH=$3 + WPE_SSHG_KEY_PRIVATE=$(cat /workspace/mock_ssh_key) + echo -e "${GREEN}REMOTE_PATH='$REMOTE_PATH' SRC_PATH='$SRC_PATH'${NC}" - make_relative_remote + + # Assign flag values to FLAGS_ARRAY + FLAGS_ARRAY=("-azvr" "--dry-run" "--inplace" "--exclude='.*'") + + # Print the flags for debugging + echo "Using the following rsync flags:" + for flag in "${FLAGS_ARRAY[@]}"; do + echo "$flag" + done + + sync_files # Only compare the expected directory structure if REMOTE_PATH is not empty and REMOTE_PATH is not equal to SRC_PATH if [[ -n "$REMOTE_PATH" && "$REMOTE_PATH" != "$SRC_PATH" ]]; then @@ -54,9 +66,9 @@ test_make_relative_remote() { } # Test cases, make remote directory relative to to the tests directory -test_make_relative_remote "1" "." "" -test_make_relative_remote "2" "./wp-content" "./wp-content" -test_make_relative_remote "3" "." "wp-content/" -test_make_relative_remote "4" "." "wp-content/themes/beautiful-pro" -test_make_relative_remote "5" "my-awesome-plugins" "wp-content/plugins" -test_make_relative_remote "6" "my-awesome-plugins/blues-brothers" "wp-content/plugins" \ No newline at end of file +#test_sync_files "1" "." "" +#test_sync_files "2" "./wp-content" "./wp-content" +#test_sync_files "3" "." "wp-content/" +#test_sync_files "4" "." "wp-content/themes/beautiful-pro" +#test_sync_files "5" "my-awesome-plugins" "wp-content/plugins" +#test_sync_files "6" "my-awesome-plugins/blues-brothers" "wp-content/plugins" From 1786fbca78ed699d98d7b73082d956d0afe2a3c4 Mon Sep 17 00:00:00 2001 From: Christine Seeman <39634128+cseeman@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:06:56 -0600 Subject: [PATCH 5/5] Adding changeset Adding in changeset through the GItHub UI. Locally kept on having npm dependency issues running `npx changeset` --- .changeset/cool-shirts-reflect.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cool-shirts-reflect.md diff --git a/.changeset/cool-shirts-reflect.md b/.changeset/cool-shirts-reflect.md new file mode 100644 index 0000000..b8879ad --- /dev/null +++ b/.changeset/cool-shirts-reflect.md @@ -0,0 +1,5 @@ +--- +"@wpengine/site-deploy": patch +--- + +[CICD-761] Actually fix excludes.txt, removes out relative folder pathing