raw-file-quickstart
Use a Raw File registry to store and retrieve arbitrary files by path (for example, archives, reports, or configuration files). You upload, download, inspect, and delete files with HTTP requests and curl.
Prerequisites
- Access to a Harness account with appropriate permissions to create registries and connectors.
Create a Raw File Artifact Registry
- Interactive Guide
- Step-by-Step
- Navigate to the Artifact Registry module in your Harness project.
- Click on New Artifact Registry.
- In the Registry Type dropdown, select Raw File registry (or Raw File).
- Provide a Registry Name.
- Optionally, add a Description and Labels for better organization.
- Choose visibility between Public and Private.
- Click Create Registry to finalize.
Your registry name must start with a letter and can include lowercase alphanumerics, _, . and -.
Configure an Upstream Proxy (Optional)
An upstream proxy allows your registry to fetch artifacts from external sources if they are not available locally.
- Interactive Guides
- Step-by-Step
Create an upstream proxy
Configure the upstream proxy in your registry
Create an upstream proxy
- In the Artifact Registry module, click the dropdown next to New Artifact Registry and select Upstream Proxy.
- Choose Raw File registry (or Raw File) as the proxy type.
- Click Create Proxy to establish the connection.
For remote URL, authentication, and other options, go to Create an upstream proxy.
Configure the upstream proxy in your registry
- In the Artifact Registry module, select an existing Raw File Artifact Registry.
- Select the Configuration tab.
- Under Advanced (Optional), select Configure Upstream.
- Select from the list of compatible proxies to add them to your registry.
- Click Save to save the configuration.
Raw File Client Setup
Follow these instructions to upload, download, and manage files in your Raw File registry using curl commands.
Generate Identity Token
An identity token will serve as the password for uploading and downloading artifacts.
- Navigate to your Harness project.
- Go to Artifact Registry and select your Raw File registry.
- Click on Setup Client or Authentication.
- Generate an identity token (API key) that you'll use in the commands below.
File Operations
These operations support both nested and flat file paths, allowing you to organize files using directory structures in the path.
The placeholders below apply to every command unless noted.
Parameters:
<ACCOUNT_ID>: Your account identifier<REGISTRY_NAME>: Name of your registry<FILE_PATH>: Path of the file in the registry (supports nested paths, for exampleconfig/prod/settings.json)<API_KEY>: Your generated identity token<LOCAL_FILE_PATH>: Local path to the file you upload (upload command only)
Upload a file to a specific path
Use this curl command to upload a file:
curl -XPUT 'https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/files/<FILE_PATH>' \
--header 'x-api-key: <API_KEY>' -T '<LOCAL_FILE_PATH>'
Download a file from a specific path
Use this curl command to download a file:
curl --location 'https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/files/<FILE_PATH>' \
--header 'x-api-key: <API_KEY>' -J -O
Get file metadata
Retrieve file metadata using a HEAD request:
curl --location --head 'https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/files/<FILE_PATH>' \
--header 'x-api-key: <API_KEY>'
Delete a file
Delete a file from a specific path in the registry:
curl --location --request DELETE 'https://pkg.harness.io/pkg/<ACCOUNT_ID>/<REGISTRY_NAME>/files/<FILE_PATH>' \
--header 'x-api-key: <API_KEY>'
File operations support both nested paths (for example, config/prod/settings.json) and flat paths (for example, settings.json), giving you flexibility in how you organize your files.
Use the exact URL pattern shown in Setup Client for your registry if it differs from the examples (for example, cluster-specific hostnames). For paths that contain special characters, use the commands from Setup Client or URL-encode path segments as needed.
To complete the in-product flow, click Done in Setup Client.