Swift Repository Structure
The Swift package structure is as follows.
|
Deployment Structure
所有部署迅速包s into Artifactory can be deployed under the following structures:
structure./ / - .zip
: Based on the followingSwift Publish API./ /
Note that the packages have to be deployed according this structure, otherwise they will not be included in the index file.
Setting up a Swift Registry
Youcan set up the following repository types:
Follow the steps according to each repository type below.
You can download packages from a local, remote, or virtual Swift registry.
Setting up a Local Repository
Local repositories enable you to deploy Swift (.swift
) packages. Artifactory calculates the metadata for all packages and indexes them to allow users to download these packages through the Swift client.
Prerequisite
Artifactory allows you to define any layout for your Swift registries. In order to upload packages according to your custom layout, you need to package your Swift files using the Swift source archive. This creates the.zip
file for your package which you can then upload to any path within your local Swift repository.
To create a Swift local repository:
- Navigate to theAdministrationmodule, go toRepositories|Repositories|Local|New Local Repository.
- SelectSwiftas thePackage Type.
Setting up a Remote Repository
A Remote Repository defined in Artifactory serves as a caching proxy for a registry managed at a remote URL. Artifacts (such as .zip files) requested from a remote repository are cached on demand. You can remove downloaded artifacts from the remote repository cache, however, you can not manually deploy artifacts to a remote swift registry.
Remote Repositories enable you to proxy and cache Swift packages.
To define a remote repository to proxy a remote swift registry:
- In theAdministrationmodule, underRepositories|Repositories|Remote, clickNew Remote Repository.
- In the New Remote Repository page:
- Set the Package Type to Swift and the Repository Key value.
- Specify the URL to the remote registry in the URL field.
- ClickSave & Finish.
Setting up a Virtual Repository
A Virtual Repository defined in Artifactory aggregates packages from both local and remote repositories.
This allows you to access both locally hosted Swift packages and remote proxied Swift repositories from a single URL defined for the Virtual Repository.
定义一个虚拟迅速库,following:
- In theAdministrationmodule, underRepositories|Repositories|Virtual, clickNew Virtual Repository.
- In the New Virtual Repository dialog, set the Package Type toSwift.
- Select the underlying local and remote Swift registries to include in the Basic settings tab.
- ClickSave & Finishto create the repository.
Configuring the Swift Client to work Opposite Artifactory
To use Artifactory with your Swift CLI, you will need to generate an access token. Then you can proceed to resolve and deploy the relevant Swift package.
- Navigate toApplication Module | Artifactory | Artifacts.
- Select the desired repository.
- SelectSet Me Upand follow the instructions.
Searching for Swift Packages
You can search for Swift Packages, using theArtifact Package Search.
Re-Indexing a Swift Repository
You can trigger an asynchronous re-indexing of a local Swift repository either through the UI or using the REST API.
This will also reindex the git index and, as a result, will also index the remote repositories.
In theArtifact Tree Browser, select your Swift repository, right-click and selectRecalculate Indexfrom the list. Requires Admin privileges.
To reindex a Swift repository through the REST API refer to the following REST API.
Calculate a Swift Index
Description: Calculates a Swift index for the specified repository.
Notes: Requires Artifactory Pro.
Security: Requires a valid admin user.
Usage: POST /api/swift/{repoKey}/reindex
Produces: application/text
Since: 7.39.4
Sample Output:
|