Closed yourcelf closed 3 days ago
One more data-point: excluding using --exclude-from=<file>
rather than --exclude=<pattern>
works as expected. Looks like there may be something in the way rsync is invoked with the flags that causes --exclude
flags to get ignored/pre-empted.
But only if you don't wrap the filename in double-quotes. Wrap it in doulequotes and this breaks. :(
Thanks for the report! I was able to reproduce the behavior you're seeing and traced it back to the quotes around the default --exclude=".*"
flag.
I'm not sure when it will be released, but I plan on working on the fix today. In the meantime, you can override the default flags by setting your own - just remove the double quotes that were in the --exclude
flag and the dotfile exclusion should work.
- name: GitHub Action Deploy to WP Engine
uses: wpengine/github-action-wpe-site-deploy@v3
with:
WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
WPE_ENV: ${{ inputs.wpe-env }}
SRC_PATH: ${{ inputs.src-path }}
REMOTE_PATH: ${{ inputs.remote-path }}
PHP_LINT: TRUE
FLAGS: -azvr --inplace --exclude=.*
Has this been fixed, or do we still need to remove the double quotes that were in the --exclude
flag?
This should be fixed. I've spent a literal day to just figure out that all my --exclude
rules do not work because of the quotes. Also, it looks like both double- and single-quotes are broken. I've made several --include
and one --exclude
rules with quotes but my pipeline just ignored everything, until I removed them.
A workaround I've used: instead of using --exclude
directly within FLAGS, use --exclude-from
with a filename. That helps avoid all the quoting issues for the excluded globs themselves, since they're isolated to the file. For convenience, you can write the contents of that file in the pipeline. Example:
jobs:
deploy:
steps:
- name: Write excludes file
run: |
cat << EOF > .deploy-wpengine-ignore
.*
package.*
tests
README.md
EOF
- name: Deploy to WPEngine
uses: wpengine/github-action-wpe-site-deploy@v3
with:
FLAGS: -azvr --inplace --exclude-from=.deploy-wpengine-ignore
Well, yeah, this is a way to do it. The main problem here is a documentation showing the examples with quotes. That's a little bit misleading.
In addition to the docs update in #94, a complete fix for this issue was released in v1.0.4 of the wpengine/site-deploy
image. It has been released in v3.2.6 of this action. You will get this automatically if you're running wpengine/github-action-wpe-site-deploy@v3
.
Quotes (both single and double) are now automatically stripped from FLAGS. Only use them when you have a flag that contains whitespace in its value.
For example, you need single quotes for the --filter
flag in the following:
- name: Deploy to WPEngine
uses: wpengine/github-action-wpe-site-deploy@v3
with:
...
FLAGS: -azvr --inplace --delete --exclude=.* --filter=':- .gitignore'
Full details of the fix are available in https://github.com/wpengine/site-deploy/pull/32.
More documentation updates coming in #105.
The debug output shows the command rsync --server -vlogDtprze.iLsfxClvu --inplace is being called. if that's the rsync call that is transferring files from the action runner to WPE, it is not including the flags in FLAGS.
This is not the call that transfers files from the action runner to WPE. It's something rsync does under the hood to start the rsync process on the receiving end.
The command that's responsible for initiating the sync wasn't previously available in the action's output. However, it has been added in v3.2.6 of the action. You should now see a line in your action's output that starts with + rsync
. That's the full rsync command as the action runner sees it.
+ rsync '--rsh=ssh -v -p 22 -i /github/home/.ssh/wpe_id_rsa -o StrictHostKeyChecking=no -o '\''ControlPath=/github/home/.ssh/ctl/%C'\''' -azvr --inplace --delete '--exclude=.*' --exclude-from=/exclude.txt --chmod=D775,F664 tests/data/plugins/test-plugin wpe_gha+myenv@myenv.ssh.wpengine.net:sites/myenv/wp-content/plugins/
Additionally, we've added some more information to the action log to help with debugging flags. It looks something like this:
Deploying your code to:
myenv
with the following 4 rsync argument(s):
-azvr
--inplace
--delete
--exclude=.*
It appears that the action is not honoring "--exclude" flags in the
FLAGS
value. Neither the default--exclude=".*"
, nor custom patterns defined with--exclude
in aFLAGS
override are excluding any files.Using this workflow step:
and providing no override for
FLAGS
, here is snipped output from the workflow in github actions. (I've replaced the environment and plugin names here):Note that:
FLAGS
value as-azvr --inplace --exclude=".*"
. This should exclude all files starting with a dot.rsync --server -vlogDtprze.iLsfxClvu --inplace
is being called. if that's the rsync call that is transferring files from the action runner to WPE, it is not including the flags inFLAGS
.--exclude=".*"
(including.eslintrc
,.prettierignore
, etc).Those files are indeed transferred to the WPE host; so even if that debug output is misleading and describes some other rsync operation that is happening, one way or the other the files that should be excluded are included.
To reproduce
Define a github actions workflow to deploy a particular source directory to a particular destination. Either define a
FLAGS
value with custom--exclude
flags, or leave it as the default value. Note that files in the repository that should be excluded are sent to the WPE host.Expected behavior
Including an
--exclude=<pattern>
flag inFLAGS
should prevent files matching the pattern from being sent to WPE.Version information