Mirror Remote Repositories
Space Packages support two mirroring scenarios:
Pull-through cache: When a package is requested from a repository mirror, Space will take it from the associated remote repository and save it locally for future use.
Publishing packages to a remote repository: you can manually publish a package from a local repository to a remote repository.
Supported repository types
Pull-through cache | Publishing to remote repos | |
---|---|---|
Cargo (Rust) | ||
Container | ||
Composer | ||
Dart | ||
Maven | ||
NuGet | ||
npm | ||
Python Package Index |
Pull-through cache mirror
A pull-through cache mirror lets you:
Simplify referencing packages from remote repositories: One local mirror repository can mirror multiple remote repositories. Note that a remote repository doesn't necessarily represent an external repository. This could also be a local repository hosted in Space. For example, you can create a mirror that aggregates data from Maven Central and a local repository with private artifacts.
Optimize network traffic: For example, a mirror can speed up Space Automation builds as all external packages will be available locally.
When a user references a package from a repository mirror, Space checks if the package is available locally. If the package is not available, Space will download it from the associated remote repository and save it locally in the mirror.
Note that you cannot publish packages to pull-through cache mirrors: You will receive the 405 status code from the server: Method Not Allowed
.
To create a pull-through cache mirror
Navigate to the project where you want to create a mirror.
On the project sidebar, choose Packages.
On the Packages page, click New repository.
In the New Package Repository window, specify repository settings: Type, Name, and Description.
Choose Mirror an existing repository.
In the mirror properties, specify the URL of the remote repository and Authentication type.
Depending on the Authentication type, specify required authentication settings.
The Artifact name patterns option lets you specify which packages from the remote repository will be available in the mirror. Specify the required exclude or include patterns with
+
or-
correspondingly. The asterisk*
wildcard is allowed. For example, to include only packages related to Kotlin:+com.jetbrains.kotlin.*
After you create the mirror, click the Get Started button to see the command-line snippets that will help you get started: connect to the repository and get images. Here you can also Generate personal token for accessing the mirror.
To associate a mirror with additional remote repositories
Open the Packages page for a required project.
Open the required mirror and click Settings.
Switch to the Remote Repositories tab.
Click New remote repository and specify repository settings:
Type: Choose a repository type.
Remote: a repository that is external to Space.
Space: a local repository hosted in Space Packages.
For a Remote repository, specify its URL and authentication credentials.
For a repository hosted in Space, specify the project the repository belongs to and the repository itself.
Prevent dependency hijacking: Enable/disable protection from dependency hijacking. Learn more
Click Create.
To disable package caching for a particular remote repository
Open the Packages page for a required project.
Open the required mirror and click Settings.
Switch to the Remote Repositories tab.
Click
next to the required repository and choose Edit.
Clear the Enable package downloading checkbox and click Save.
Preventing dependency hijacking
Mirrors in Packages provide built-in protection from dependency hijacking. By default, if a mirror downloads a package from a remote repository once, it will use only this remote repository for all further package updates. If you disable Prevent dependency hijacking for this repository, Space will look for the updates in all associated remote repositories.
To disable protection from hijacking for a remote repository
Open the Packages page for a required project.
Open the required mirror and click Settings.
Switch to the Remote Repositories tab.
Click
next to the required repository and choose Edit.
Clear the Prevent dependency hijacking checkbox and click Save.
To change a remote repository used for package updates
Click Versions.
Choose a new remote repository in the Look for new versions in list.
After this, Space will look for new package versions only in the newly specified repository.
Publishing packages to remote repositories
In some cases, you might need to publish a package stored in a Space Packages repository to a remote repository, for example, Maven Central. For each local repository, you can specify a list of related remote repositories. After this, you can publish packages from the local repository to any of these remote repositories.
To associate a local repository with remote repositories
Navigate to the project which contains the required local repository.
On the project sidebar, choose Packages.
Find the required repository and click
Settings.
In the repository settings, open the Remote Repositories tab.
Add at least one remote repository by clicking New remote repository.
In the mirror properties, specify the URL of the remote repository and Authentication type.
Depending on the Authentication type, specify required authentication settings.
To publish packages to a remote repository from a local repository
In the package menu, choose Publish to remote repository.
In the list, select a required mirror and click Publish.