Virtual Repositories
To simplify access to different repositories, Artifactory allows you to define a virtual repository. A virtual repository is a collection of local, remote, and other virtual repositories with the same package type accessed through a single logical URL.
A virtual repository hides the access details of the underlying repositories, letting users work with a single, well-known URL. The underlying participating repositories and their access rules may be changed without requiring any client-side changes.
Generic Virtual Repositories
By their nature, Virtual Repositories whose package type has been specified as Generic can aggregate repositories of any type. However, generic virtual repositories do not maintain any metadata.
Configure a Virtual Repository
The procedure for configuring a virtual repository includes tabs for mandatory basic settings and a tab for advanced settings.
To configure a virtual repository:
-
In the Administration module, select Repositories.
-
Click Create a Repository and select Virtual from the list.
-
In the Select Package Type window, click the icon for the desired package type.
Note
Once you select the package type, it cannot be changed.
The Basic tab for virtual repositories is displayed.
- In the Basic tab, enter the basic settings for the virtual repository. For details, see Basic Settings for Virtual Repositories and Select Repositories to Include in a Virtual Repository.
- Optional: In the Advanced tab, enter the advanced settings for the virtual repository.
- When you have finished configuring the repository, click Create Virtual Repository.
Configure a Virtual Repository using the API
Use the Create Repository REST API to create a virtual repository. For more information, see Create Repository API and Repository Configuration JSON.
Basic Settings for Virtual Repositories
The following basic settings are common for all package types.
Setting | Description |
|---|---|
Package Type | The package type must be specified when the repository is created, and once set, cannot be changed. |
Repository Key | The repository key is a mandatory, unique identifier for the repository. It cannot begin with a number or contain spaces or special characters. |
Stage | Defines one or more stages in which this repository will reside. Stages aggregate project resources (repositories, Pipeline sources, etc.) to simplify their management. For more information, see Stages & Lifecycle. Note: Defining a stage is mandatory when creating a repository within a specific project. The default selection is DEV. |
Repository Layout | Sets the layout that the repository should use for storing and identifying modules. A recommended layout that corresponds to the package type defined is suggested. |
Public Description | A free text field that describes the content and purpose of the repository. This description can be viewed by all users with access to the repository. |
Internal Description | A free text field to add additional notes about the repository. These notes are visible only to the administrator. |
Include and Exclude Patterns | The Include Patterns and Exclude Patterns fields provide a way to filter out specific repositories when resolving the location of different artifacts. In each field, you can specify a list of Ant-like patterns to filter in and filter out artifact queries. Filtering works by subtracting the excluded patterns (default is none) from the included patterns (default is all). Example: Consider that the Include Patterns and Exclude Patterns for a repository are as follows: Include Patterns: Exclude Patterns:
In this example, the repository is searched for
|
Remote Requests Can Retrieve Remote Artifacts | When set, remote Artifactory instances can retrieve artifacts from remote repositories aggregated under this virtual repository, even if the artifacts are not cached. When not set, artifacts can be retrieved from the caches only (default). Relevant for all package types except Swift, Terraform, and Composer. |
Included Repositories | |
Default Deployment Repository | Defines the default repository when deploying artifacts to a virtual repository. For more information, see Configure Virtual Repositories for Deployment. |
Important
For information about specific settings for particular package types, see Additional Virtual Repository Settings for Specific Package Types.
Using Include and Exclude Patterns
The ability to define an Include Pattern and an Exclude Pattern for virtual repositories (especially when nesting is used) provides a powerful tool you can use to manage artifact requests in your organization.
For example, your organization may have its own artifacts which are hosted both internally in a local repository and also in a remote repository. For optimal performance, you would want these artifacts to be accessed from the local repository rather than from the remote one. To enforce this policy, you can define a virtual repository called "remote-repos" which includes the full set of remote repositories accessed by your organization, and then specify an Excludes Pattern with your organization's groupID. In this way, any attempt to access your internal artifact from a remote repository would be rejected.
Consider another example in which you wish to define a virtual repository for your developers, however, you wish to keep certain artifacts hidden from them. This could be achieved by defining an Excludes Pattern based on groupId, source, or version.
Select Repositories to Include in a Virtual Repository
When creating a virtual repository, you must select the local and remote repositories that will be included. The process is identical for all package types, except for P2 repositories.
To select repositories to include in a virtual repository:
-
In the Administration module, select Repositories.
-
Click Create a Repository and select Virtual from the list.
-
In the Select Package Type window, click the icon for the desired package type. The Basic tab for virtual repositories is displayed.
-
Select the Available Repositories you want to include in the new virtual repository and move them to the Selected Repositories list.
The Selected Repositories section displays the effective list of actual repositories included in this virtual repository. If any of the available repositories you have selected are themselves virtual repositories, then the Selected Repositories section will display the local and remote repositories included within them. The Selected Repositories list is automatically updated if any of the nested virtual repositories change.
Tip
This list can be re-ordered by dragging and dropping within the Selected Repositories list. This is important as it sets the resolution order.
The search/resolution order when requesting artifacts from a virtual repository is always:
- Local repositories
- Remote repository caches
- Remote repositories themselves
The order within these categories is controlled by the order in which they are presented in the Selected Repositories list.
When fulfilling a request for the latest version of an artifact from a virtual repository, Artifactory will search all the included repositories to ensure it retrieves the latest version. This means that Artifactory will still search the remote repository even if it finds a version of the artifact in a local or cache repository, to be certain of returning the most current one. If the remote repository is found to have the latest version, Artifactory will download it and update the remote repository cache.
Virtual Repositories and Projects
Like other resources, a virtual repository can be assigned to a specific project and optionally shared with additional projects. If there are selected local and remote repositories that are not assigned to, or shared with, the same project as the virtual repository, the following message appears in the UI:
Click View to see a list of conflicting repositories. Click the export icon to export the list to a CSV file.
Administrators should be aware of possible repository conflicts to avoid a situation where a user with access to the virtual repository cannot access an aggregated repository because they do not have access to that repository's project.
Nesting
Nesting is a unique feature in Artifactory and facilitates more flexibility in using virtual repositories.
Note
Be careful not to create an "infinite loop" of nested repositories. Artifactory analyzes the internal composition of virtual repositories and will issue a warning if the virtual repository cannot be resolved due to invalid nesting.
Virtual Resolution Order
When an artifact is requested from a virtual repository, the order in which repositories are searched or resolved is local repositories first, then remote repository caches, and finally remote repositories themselves.
Within each of these, the order by which repositories are queried is determined by the order in which they are listed in the configuration, as described in General Resolution Order.
For a virtual repository, you can see the effective search and resolution order in the Included Repositories list view in the Basic settings tab. This is particularly helpful when nesting virtual repositories. For more details, see Configure a Virtual Repository.
Additional Virtual Repository Settings for Specific Package Types
Virtual repositories may have additional settings depending on the package type, as described in the following topics:
- Additional Settings for Alpine Virtual Repositories
- Additional Settings for Bower Virtual Repositories
- Additional Settings for Chef Virtual Repositories
- Additional Settings for Conan Virtual Repositories
- Additional Settings for Conda Virtual Repositories
- Additional Settings for CRAN Virtual Repositories
- Additional Settings for Debian Virtual Repositories
- Additional Settings for Docker Virtual Repositories
- Additional Settings for Go Virtual Repositories
- Additional Settings for Maven/Gradle/Ivy/SBT Virtual Repositories
- Additional Settings for npm Virtual Repositories
- Additional Settings for NuGet Virtual Repositories
- Additional Settings for OCI Virtual Repositories
- Additional Settings for P2 Virtual Repositories
Additional Settings for Alpine Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring Alpine repositories.
| Field | Description |
|---|---|
| Metadata Retrieval Cache Period (sec) | Defines the length of time (in seconds) to cache metadata files before checking for newer versions on aggregated repositories. A value of 0 indicates no caching. The default is 7200 seconds. |
Additional Settings for Bower Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring Bower repositories.
Field | Description |
|---|---|
Enable Dependency Rewrite | When selected, external dependencies are rewritten. |
Remote Repository for Cache | Defines the remote repository aggregated by this virtual repository in which the external dependency will be cached. |
Patterns Allow List | Defines an Allow List of Ant-style path expressions that specify where external dependencies may be downloaded from. By default, this is set to **, which means that dependencies may be downloaded from any external source. For example, if you wish to limit external dependencies to be downloaded only from github.com, you should add _github.com**_ (and remove the default ** expression). |
Additional Settings for Chef Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring Chef repositories.
| Field | Description |
|---|---|
| Metadata Retrieval Cache Period (sec) | Defines the length of time (in seconds) to cache metadata files before checking for newer versions on aggregated repositories. A value of 0 indicates no caching. The default is 7200 seconds. |
Additional Settings for Conan Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring Conan repositories.
| Field | Description |
|---|---|
| Metadata Retrieval Cache Period (sec) | Defines the length of time (in seconds) to cache metadata files before checking for newer versions on aggregated repositories. A value of 0 indicates no caching. The default is 7200 seconds. |
| Force Authentication | Select this option to require the use of basic authentication credentials to use this repository. |
Additional Settings for Conda Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring Conda repositories.
| Field | Description |
|---|---|
| Metadata Retrieval Cache Period (sec) | Defines the length of time (in seconds) to cache metadata files before checking for newer versions on aggregated repositories. A value of 0 indicates no caching. The default is 7200 seconds. |
Additional Settings for CRAN Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring CRAN repositories.
| Field | Description |
|---|---|
| Metadata Retrieval Cache Period (sec) | Defines the length of time (in seconds) to cache metadata files before checking for newer versions on aggregated repositories. A value of 0 indicates no caching. The default is 7200 seconds. |
Additional Settings for Debian Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring Debian repositories.
Field | Description |
|---|---|
Metadata Retrieval Cache Period (sec) | Defines how long before Artifactory checks for a newer version of a requested artifact in the repository. A value of 0 means that Artifactory will always check for a newer version.
|
Indexed Remote Architectures | Specifies the architectures that will be indexed for the included remote repositories. Specifying these architectures will speed up Artifactory's initial metadata indexing process. The default architecture values are amd64 and i386. |
Optional Index Compression Formats | Used for selecting the index file formats to create in addition to the default Gzip (.gzip extension) format, which is created for every Debian repository and cannot be disabled. |
Enable indexing with debug symbols (.ddeb) | When set, it enables the indexing of debug symbols for more efficient debugging. |
Primary Key Name | The name of the GPG primary key used by the repository. |
Secondary Key Name | The name of the GPG secondary key used by the repository |
Additional Settings for Docker Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring Docker repositories.
Additional Advanced Settings
| Field | Description |
|---|---|
| Resolve Docker Tags By Latest Timestamp | When enabled, in cases where the same Docker tag exists in two or more of the aggregated repositories, Artifactory will return the tag that has the latest timestamp. |
Additional Settings for Go Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring Go repositories.
Field | Description |
|---|---|
Enable 'go-import' Meta Tags | When selected (default), Artifactory will automatically follow remote VCS roots in go-import meta tags to download remote modules. |
go-import Allow List | Defines an Allow List of Ant-style path expressions that specify where external dependencies may be downloaded from. By default, this is set to ******, which means that dependencies may be downloaded from any external source. For example, if you wish to limit external dependencies to be downloaded only from github.com, you should add github.com (and remove the default ** expression). |
Additional Settings for Maven/Gradle/Ivy/sbt Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, there are specific settings for the following package types;
Field | Description |
|---|---|
Cleanup Repository References in POMs | This setting provides the ability to ensure Artifactory is the sole provider of artifacts in the system by automatically cleaning up the POM (Project Object Model) file. The POM is the XML file that contains configuration and build information about a Maven project. Available options include:
|
Key-Pair | Defines a named key-pair to use for signing artifacts automatically. |
Force Authentication | Select this option to require the use of basic authentication credentials to use this repository. This setting is relevant for Maven virtual repositories only. |
Additional Settings for npm Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring npm repositories.
Basic Settings
| Field | Description |
|---|---|
| Metadata Retrieval Cache Period (sec) | Defines the length of time (in seconds) to cache metadata files before checking for newer versions on aggregated repositories. A value of 0 indicates no caching. The default is 7200 seconds. |
Advanced Settings
Field | Description |
|---|---|
Enable Dependency Rewrite | When selected, external dependencies are rewritten. |
Remote Repository for Cache | Defines the remote repository aggregated by this virtual repository in which the external dependency will be cached. |
Patterns Allow List | Defines an Allow List of Ant-style path expressions that specify where external dependencies may be downloaded from. By default, this is set to **, which means that dependencies may be downloaded from any external source. For example, if you wish to limit external dependencies to be downloaded only from github.com, you should add github.com (and remove the default ** expression). |
Additional Settings for NuGet Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring NuGet repositories.
| Field | Description |
|---|---|
| Force Authentication | Select this option to require the use of basic authentication credentials to use this repository. |
Additional Settings for OCI Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring OCI repositories.
| Field | Description |
|---|---|
| Metadata Retrieval Cache Period (sec) | Defines the length of time (in seconds) to cache metadata files before checking for newer versions on aggregated repositories. A value of 0 indicates no caching. The default is 7200 seconds. |
Additional Settings for P2 Virtual Repositories
In addition to the basic settings that are common for all virtual repositories, the following settings are available when configuring P2 repositories.
Field | Description |
|---|---|
Force Authentication | Select this option to require the use of basic authentication credentials to use this repository. |
Local Repository | Select the local repository to include in the virtual repository. Typically this will be either a Maven or a Generic repository. |
Path Suffix | Defines an optional sub-path inside the local repository where P2 metadata files reside. When left empty, P2 metadata files (content, artifacts, compositeContent, etc.) are assumed to reside directly in the repository root directory. If you have a Tycho repository deployed as a single archive, specify the archive's root path. For example: 'eclipse-repository.zip!'. |
P2 Repository URL | Defines the URL of the remote repository that contains the P2 metadata files.
|
Updated about 1 month ago
