Skip to content

Conversation

@jorgee
Copy link
Contributor

@jorgee jorgee commented Dec 1, 2025

Summary

This PR implements Git multi-revision asset management, enabling concurrent execution of different pipeline revisions (e.g., production on v1.0, testing on v2.0-dev) while maintaining efficient disk usage through object sharing.

Closes #2870. Alternative for #5089.

Solution

The implementation uses a bare repository + shared clones approach with the Strategy pattern for backward compatibility:

~/.nextflow/assets/.repos/<org>/<project>/
├── bare/                    # Bare repository (shared objects)
│   ├── objects/             # All Git objects stored here
│   ├── refs/
│   └── config
│
└── clones/                  # Revision-specific clones
    ├── <commit-sha-1>/      # Clone using JGit alternates
    └── <commit-sha-2>/      # (points to bare/objects)

Key mechanisms:

  • Bare repository as source of truth: Fetched/updated from remote, keeping refs current
  • Dynamic resolution: Revisions resolved to commit SHAs using bare repo refs
  • Object sharing: Clones use JGit alternates to reference bare repo objects, avoiding duplication
  • Atomic operations: Each clone is independent; downloading new revisions doesn't affect running pipelines
  • Lazy creation: Clones created on-demand when a specific revision is requested

Backward Compatibility

Uses the Strategy pattern to maintain compatibility with existing repositories:

  • RepositoryStrategy interface with LegacyRepositoryStrategy and MultiRevisionRepositoryStrategy implementations
  • AssetManager acts as facade with unchanged public API
  • Strategy selection: NXF_SCM_LEGACY=true forces legacy mode, otherwise auto-detected based on repository state
  • Existing legacy repositories continue to work without migration

Changes

Core Implementation

  • Added RepositoryStrategy interface and AbstractRepositoryStrategy base class
  • Implemented MultiRevisionRepositoryStrategy for bare repo + shared clones
  • Implemented LegacyRepositoryStrategy preserving original behavior
  • Refactored AssetManager to delegate to strategy implementations

CLI Updates

  • Changed -a, --all-revisions flag to -a, --all in CmdDrop
  • Updated nf-info command output to show clones with revision indicators

Concurrency & Reliability

  • Added FileMutex for safe concurrent clone operations
  • Improved error handling with cleanup of incomplete clones

Documentation

  • ADR: adr/20251205-git-multi-revision-asset-management.md

marcodelapierre and others added 30 commits January 15, 2024 17:29
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
… operation

Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
…f "master"

Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Dr Marco De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
@pditommaso
Copy link
Member

Little glitch, but likely there isn't much it can be done here

» nextflow list
nextflow-io/rnaseq-nf
nf-core/modules
pditommaso/hello
.repos/nextflow-io

@jorgee
Copy link
Contributor Author

jorgee commented Dec 15, 2025

Little glitch, but likely there isn't much it can be done here

» nextflow list
nextflow-io/rnaseq-nf
nf-core/modules
pditommaso/hello
.repos/nextflow-io

Is this when runninglistwith the previous version?

@pditommaso
Copy link
Member

Yes

Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Jorge Ejarque <jorgee@users.noreply.github.com>
@jorgee
Copy link
Contributor Author

jorgee commented Dec 15, 2025

I can create another PR with a patch ignoring the path to backport to stable releases.

pditommaso and others added 2 commits December 15, 2025 11:27
…) [ci skip]

Update the multi-revision asset management ADR:

- Fix directory structure to match implementation:
  - bare/ instead of .nextflow/bare_repo/
  - commits/ instead of .nextflow/commits/
  - Legacy repo at separate location ~/.nextflow/assets/<project>/

- Merge Option 4 (Strategy Pattern) into Option 3 since the Strategy
  Pattern is an implementation detail of the multi-revision approach,
  not a standalone option

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@pditommaso pditommaso changed the title Implementation of multiple revisions without revisions map Implementation of Git multiple revisions Dec 15, 2025
jorgee and others added 8 commits December 15, 2025 17:09
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Jorge Ejarque <jorgee@users.noreply.github.com>
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Jorge Ejarque <jorgee@users.noreply.github.com>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@jorgee
Copy link
Contributor Author

jorgee commented Dec 17, 2025

Addressed the last review comments.
I have also double check the other two issues linked to the PR, and they do not happen when using multi-revision. Still happening when using legacy strategy. Users must migrate to fix these issues.

@jorgee jorgee requested a review from pditommaso December 17, 2025 12:40
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso
Copy link
Member

Just replaced the • with > because i'm quite not all terminal can support it

pditommaso and others added 2 commits December 17, 2025 14:26
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@jorgee
Copy link
Contributor Author

jorgee commented Dec 17, 2025

Changing the symbol in docs

@bentsherman bentsherman merged commit ce9d7b5 into master Dec 17, 2025
12 checks passed
@bentsherman bentsherman deleted the mult_revisions_no_map branch December 17, 2025 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

6 participants