nextflow.scm
The nextflow.scm package defines the Git provider interface and implements several built-in Git providers. It also manages local pipeline repositories using a Strategy pattern to support different repository management approaches.
Class Diagram
Note
Some classes may be excluded from the above diagram for brevity.
Architecture overview
Repository strategies
The AssetManager uses the Strategy pattern to support different ways of managing local pipeline installations:
LegacyRepositoryStrategy: Traditional approach where each project gets a full git clone in$NXF_HOME/{project}directory. Only one revision can exist at a time per project.MultiRevisionRepositoryStrategy: Modern approach that allows multiple revisions to coexist efficiently by:Maintaining a shared bare repository in
$NXF_HOME/.repos/{project}/bare/Creating lightweight clones for each commit in
$NXF_HOME/.repos/{project}/clones/{commitId}/Sharing git objects between revisions to minimize disk space
Strategy selection
The AssetManager automatically selects the appropriate strategy based on:
Environment variable:
NXF_SCM_LEGACY=trueforces legacy modeRepository status: Detected by checking existing repository structure:
UNINITIALIZED: No repository exists, use Multi-Revision (default)LEGACY_ONLY: Only legacy.gitdirectory exists, use LegacyBARE_ONLY: Only bare repository exists, use Multi-RevisionHYBRID: Both exist, prefer Multi-Revision
Repository provider
The RepositoryProvider class is the base class for all Git providers. It defines how to authenticate with the provider, clone a Git repository, inspect branches and tags, etc. The provider is used by repository strategies to interact with remote Git services.
Key components
AssetManager
Central class that manages pipeline assets. Key responsibilities include:
Project name resolution and validation
Strategy selection and initialization
Provider configuration and authentication
Repository download and checkout operations
Coordination between strategy and provider
RepositoryStrategy
Interface defining for repository management operations:
download(): Download or update a revisioncheckout(): Switch to a specific revisiondrop(): Delete local copiesgetLocalPath(): Get path to working directorygetGit(): Access JGit repository instance