capistrano / capistrano/rails

Not all listed `assets_manifests` are backed up on deploy

Open
#264 9 comments 0 reactions 0 assignees View on GitHub
bug?
Dominant language
Ruby
Stars
901
Forks
262
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

The following paths are added to my `assets_manifest` in `deploy.rb`:

```ruby
desc "define assets manifests files"
task :set_assets_manifests do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
set :assets_manifests, [
release_path.join("public", "vite", ".vite", "manifest*.*"),
release_path.join("public", fetch(:assets_prefix), "manifest*.*"),
release_path.join("public", fetch(:assets_prefix), ".sprockets-manifest*")
]
end
end
end
end
```

Listing the directory contents of these paths on the server yields:

```bash
$ ls -a public/vite/.vite/manifest*.*
public/vite/.vite/manifest-assets.json
public/vite/.vite/manifest-assets.json.gz
public/vite/.vite/manifest.json
public/vite/.vite/manifest.json.gz

$ ls -a public/assets/manifest*.*
public/assets/manifest-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.js
public/assets/manifest.js
public/assets/manifest-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.js.gz
public/assets/manifest.js.gz

$ ls -a public/assets/.sprockets-manifest*
public/assets/.sprockets-manifest-415461b893c1f289238ea242950f61cb.json
```

### Expected behavior

I expect the files in the listed directories to appear in the `assets_manifest_backup` directory after deployment.

### Actual behavior

What happens instead is the files that only match the first path in `assets_manifests` are backed up.

```bash
$ ls -a assets_manifest_backup/
.
..
manifest-assets.json
manifest-assets.json.gz
manifest.json
manifest.json.gz
```

Is the `return` on [L111](https://github.com/capistrano/rails/blob/master/lib/capistrano/tasks/assets.rake) of `assets.rake` the culprit, perhaps?

```ruby
fetch(:assets_manifests).each do |candidate|
return capture(:ls, candidate).strip.gsub(/(\r|\n)/, ' ') if test(:ls, candidate)
end
```

### System configuration

Ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin20]
Rubygems 3.5.11
Rails 7.1.4
Bundler 2.4.5

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lib/capistrano/tasks/assets.rake around line 111 and trace how each configured assets_manifests candidate is handled during backup. Confirm the behavior against the listed Vite, asset, and Sprockets manifest paths; done means files matching every configured path appear in assets_manifest_backup.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.