-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CICD-761] Actually fix excludes #39
Open
cseeman
wants to merge
5
commits into
main
Choose a base branch
from
CICD-761/apm-fix-excludes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b7b9ced
From working session
cseeman c210a89
Isolate test data and workdir from local machine; fix function bug
apmatthews c137d4c
[CICD-761] Updated Docker
cseeman 10723dd
[CICD-761] Removing make remote relative method
cseeman 1786fbc
Adding changeset
cseeman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@wpengine/site-deploy": patch | ||
--- | ||
|
||
[CICD-761] Actually fix excludes.txt, removes out relative folder pathing |
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
services: | ||
test: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
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 | ||
|
||
build: | ||
image: wpengine/site-deploy:latest | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
command: /bin/true |
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
workspace/**/* |
Empty file.
1 change: 1 addition & 0 deletions
1
tests/test-make-relative-remote/data/repository-3/plugins/sample_plugin.txt
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Sample plugin file |
1 change: 1 addition & 0 deletions
1
tests/test-make-relative-remote/data/repository-3/themes/sample_theme.txt
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Sample theme file |
1 change: 1 addition & 0 deletions
1
tests/test-make-relative-remote/data/repository-3/uploads/sample_upload.txt
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Sample upload file |
1 change: 1 addition & 0 deletions
1
tests/test-make-relative-remote/data/repository-4/themes/beautiful-pro/sample_theme.txt
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Sample theme file |
Empty file.
Empty file.
Empty file.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/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" | ||
source "${SCRIPT_DIR}/../../entrypoint.sh" | ||
|
||
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 | ||
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 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}" | ||
|
||
# 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 | ||
# 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_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" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try removing this commit, delete tests/ structure and integration test and add the removal commit on a graveyward.md for future reference, including docker compose file.