Add pull:files-archive command - #2036
Open
grasmash wants to merge 3 commits into
Open
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 file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.