Add pull:files-archive command - #2036
Conversation
Adds a pull:files-archive command that copies Drupal public files from a Cloud Platform environment by streaming a gzipped tarball over SSH and extracting it locally. Unlike pull:files, it does not require a local rsync binary (only ssh and tar), which makes it usable on Windows and in minimal CI containers, and it issues a single fixed remote command with straightforward failure modes: the download process exit code is the remote tar's, and extraction is a separate, separately-reported step.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2036 +/- ##
============================================
+ Coverage 92.49% 92.51% +0.01%
- Complexity 1995 2002 +7
============================================
Files 123 124 +1
Lines 7238 7280 +42
============================================
+ Hits 6695 6735 +40
- Misses 543 545 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/2036/acli.phar |
- Assert production environments are offered (kills the TrueValue mutant on determineEnvironment's allowProduction argument). - Mock the Filesystem and require mkdir and temp-tarball removal (kills the mkdir MethodCallRemoval, the finally-block remove MethodCallRemoval, and the UnwrapFinally mutants). - Assert the interpolated exception message (kills the ArrayItem and ArrayItemRemoval mutants on the error context array). - Ignore Checklist addItem/completePreviousItem in Infection: they only render via the spinner, which is disabled without a TTY, so they are not observable in a unit test (same rationale as the existing logger ignore).
tempnam() truncates the prefix to three characters on Windows, so the temp tarball path cannot be matched by prefix; match any string. Assert temp-tarball cleanup in the failure test as well, since the finally block is only observable when the download throws.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please remove the |
Motivation
pull:filesrequires a localrsyncbinary. That's a real friction point on Windows (no rsync out of the box) and in minimal CI containers, and rsync behavior varies across the client versions in the wild (rsync 2.x on older macOS, rsync 3.x, and Apple's openrsync all differ). This adds an alternative that needs onlysshandtarlocally.Proposed changes
Adds a new
pull:files-archivecommand. It accepts the same arguments aspull:files(environment, site, site instance) and copies the environment's public files to the local files directory by:tar -C <files-dir> -czf - .— and redirecting the streamed tarball to a local temp file. The process exit code is the remote tar's, so download failures are reported directly.docroot/sites/<site>/fileswith the localtar, as a separate, separately-reported step.The temp tarball is removed in a
finallyblock either way. Dynamic values (SSH URL, remote path, temp path) are passed via Symfony Process"${:VAR}"placeholders rather than string interpolation.pull:filesis unchanged; this is purely additive.Alternatives considered
ssh ... | tar -xzf -directly: loses the remote exit code withoutpipefail, which/bin/shdoesn't support portably. The two-step download-then-extract keeps error reporting exact.Testing steps
./bin/acli ckcacli pull:filesagainst an environment and confirm it still syncs files.acli pull:files-archive, choose an application/environment/site, and confirm the files land indocroot/sites/<site>/files. Delete a local file and re-run to confirm it's restored.