|
To enable calculation of CocoaPods package metadata set CocoaPods to be the Package Type when you create your local CocoaPods repository.
The CocoaPods client does not provide a way to deploy packages and mostly (though not only) relies on a Git repository to host the pod's code.
To deploy a pod into Artifactory, you need to use Artifactory's REST API or the Web UI.
A pod is a simple tar.gz
file which contains your project code as well as a .podspec or .podspec.json file describing the package metadata.
Although more extensions are supported by the client, the Artifactory CocoaPods local repositories currently only support pods that are archived as tar.gz |
The public does not contain any actual binary packages; it is a git repository containing
podspec.json
files pointing from a package name and version to its storage endpoint.
Since the majority of the packages are hosted on GitHub, you need to create a Remote Repository which serves as a caching proxy for . If necessary, you can do the same for
or any other remote repository you want to access.
If your packages are hosted on Bitbucket (formerly Stash), you need to ensure that the Stash Archive Plugin is installed on your Bitbucket server. |
Artifacts (such as tar.gz 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 repository.
To define a remote repository to proxy github.com as well as the public Specs repo follow the steps below:
https://github.com
in the URL field as displayed belowUsually, you will point the Specs Repo URL field at the public Specs repo as displayed above. However, if you are using a private Specs repo - set the URL to be the same as the the one configured in the URL field. If the remote URL is an Artifactory instance you need to append it's url with /api/pods/<repo> i.e. http://art-prod.company.com/artifactory/api/pods/pods-local |
Working with a private Bitbucket server? set the "Git Provider" to be Stash, and not Bitbucket. The public Bitbucket endpoint answers some API calls that a private Bitbucket server doesn't, hence, it is important to set the Git Provider to be Stash when working with a private Bitbucket server. In this case, the URL field should be the root of your Bitbucket server, and the Specs Repo URL should be the full URL to the Specs repo in Bitbucket. |
When accessing a CocoaPods repository through Artifactory, the repository URL must be prefixed with api/pods in the path. This applies to the pod repo-art add command. For example, if you are using Artifactory standalone or as a local service, you would access your CocoaPods repositories using the following URL:
Or, if you are using Artifactory SaaS, the URL would be:
|
Artifactory has been updated to work seamlessly with the latest version of the CocoaPods client from version 0.39.0
In order to use CocoaPods with Artifactory, you need the cocoapods-art plugin which presents Artifactory repositories as Specs repos and pod sources.
You can download the plugin as a Gem, and its sources can be found on
.
To use Artifactory with CocoaPods, execute the following steps:
Install the cocoapods-art plugin:
gem install cocoapods-art |
We recommend installing both the CocoaPods client and the cocoapod-art plugin as gems. Installing with Homebrew may cause issues with the CocoaPods hooks mechanism that the plugin relies on. |
The next step is to add an Artifactory repository by using the pod 'repo-art add' command:
pod repo-art add <local_specs_repo_name> http://localhost:8081/artifactory/api/pods/<repository_key> |
Once the repository is added, add the following in your Podfile:
plugin 'cocoapods-art', :sources => [ '<local_specs_repo_name>' ] |
If you have removed the CocoaPods Master repository from your system, due to a known issue with the CocoaPods stats plugin, you need to add the following to your Podfile, or add the corresponding variable to your environment: ENV['COCOAPODS_DISABLE_STATS'] = 'true' For details, please refer to JFrog Jira |
Where the local repo name is the name you gave the specs repo locally when adding it.
The cocoapods-art plugin exposes most commands that are normally invoked with pod repo (i.e. add, update, list etc.). Use pod repo-art instead of pod repo whenever dealing with Artifactory-backed Specs repositories. |
~/.cocoapods/repos |
Once the pod command line tool is configured, every pod install
command will fetch pods from the CocoaPods repository specified above.
cocoapods-art
Plugin's repositories with ArtifactoryAs opposed to the cocoapods client's default behavior, the cocoapods-art plugin does not automatically update its index whenever you run client commands (such as install). To keep your plugin's index synchronized with your CocoaPods repository, you need to update it by executing the following command:
pod repo-art update |
By default, Artifactory allows anonymous access to CocoaPods repositories. This is defined under Security | General Configuration. For details please refer to Allow Anonymous Access.
If you want to be able to trace how users interact with your repositories you need to uncheck the Allow Anonymous Access setting. This means that users will be required to enter their username and password.
Unfortunately, the pod command line tool does not support authentication against http endpoints. The cocoapods-art plugin solves this by forcing curl (which pod uses for all http requests) to use the .netrc file:
machine art-prod.company.com login admin password password |
Since Artifactory also supports basic authentication using your API key, you could use that instead of your password:
machine art-prod.company.com login admin password AKCp2TfQM58F8FTkXo8qSJ8NymwJivmagefBqoJeEBQLSHCZusEH6Z2dmhS1siSxZTHoPPyUW |
We recommend using an encrypted password instead of clear-text. For details, please refer to Centrally Secure Passwords. |
The pod client saves caches of pods that were downloaded, as well as metadata.
We recommend removing the CocoaPods caches (both packages and metadata responses) before using Artifactory for the first time. This is to ensure that your caches only contain elements that are due to requests from Artifactory and not directly from other Specs repos.
To clear the pod cache use:
pod cache clean |