R (CRAN)
Use an CRAN registry to host private R packages that follow the CRAN package format, and optionally cache packages from public CRAN mirrors through an upstream proxy.
Before you begin
Ensure you have R installed on your local machine, including the standard package tools (
install.packages).Access to a Harness account with appropriate permissions to create registries and connectors.
Create a CRAN artifact registry
Go to the Artifact Registry module in your Harness project.
Click New Artifact Registry.
In the Registry Type list, select CRAN.
Enter a Registry Name.
Optionally, add a Description and Labels for better organization.
Choose visibility between Public and Private. By default, the visibility is set to Private.
Select Create Registry to finalize.
Configure an upstream proxy (optional)
An upstream proxy allows your registry to fetch R packages from external CRAN-compatible repositories when they are not available locally. The default upstream is https://cran.r-project.org.
Create an upstream proxy
In the Artifact Registry module, select the dropdown next to New Artifact Registry and select Upstream Proxy.
Select CRAN as the proxy type.
Enter an Upstream Proxy Key.
Optionally, add a Description and Labels.
Select your Source:
CRAN
Custom
If you choose Custom, enter your Remote Registry URL (for example,
https://cran.r-project.org).Choose your Authentication method (
Anonymousby default for public CRAN mirrors).Click Create Upstream Proxy to establish the connection.
Configure the upstream proxy in your registry
In the Artifact Registry module, select an existing R (CRAN) Artifact Registry.
Go to the Configuration tab.
In the Advanced (Optional) section, click Configure Upstream.
Select from the list of compatible proxies to add them to your registry.
Select Save to save the configuration.
Set up the CRAN Package client
In your Harness CRAN Artifact Registry, click Set Up Client and follow the instructions to install or use R packages from the registry.
1. Generate identity token
In your Harness CRAN Artifact Registry, click Set Up Client.
Click Generate Token to generate an identity token.
2. Configure R
Point R at this registry as a CRAN-like repository.
Set the repository for the current R session:
Persist across sessions by appending the same line to ~/.Rprofile:
Route downloads through libcurl and attach the identity token:
3. Install a package
4. Install an archived (older) version
The live index only lists the latest version of a package. Superseded source versions are still downloadable from the Archive/ path.
Install a specific version using the 'remotes' package:
OR
install directly from the archived source tarball:
5. Upload a package
Upload an R source or binary archive to the registry using the CRAN repository layout.
Upload a source package to src/contrib (produced by 'R CMD build'):
Upload a Windows binary to
bin/windows/contrib/<R_MINOR_VERSION>(for example,4.4):
Upload a macOS binary to
bin/macosx/<FLAVOR>/contrib/<R_MINOR_VERSION>(for example,big-sur-arm64,4.4):
Troubleshooting
Last updated
Was this helpful?