Environment variables
Reference for every environment variable used with Harness Artifacts: authentication, CLI, pipeline context, package managers, and Terraform.
Environment variables let you configure Harness Artifacts clients and tooling without hard-coding credentials or account identifiers in scripts. This page lists every variable used across the CLI, package manager clients, CI integrations, and Terraform provider.
Core authentication variables
These variables authenticate you or a service account to Harness. Set them before running any hc CLI command, docker login, package manager configuration, or REST API call.
HARNESS_API_KEY
Harness personal access token (PAT) or service account token. Used as the password for all package manager clients (Docker, Helm, npm, Maven, pip, Cargo, NuGet) and as the x-api-key header for REST API calls.
Yes
HARNESS_ACCOUNT_ID
Your Harness account identifier. Appears in every registry URL (pkg.harness.io/pkg/<ACCOUNT_ID>/...) and in Terraform resource references.
Yes
HARNESS_EMAIL
The email address associated with your Harness account. Used as the username when authenticating Docker, Helm, Maven, pip, and similar clients.
Yes (for client auth)
HARNESS_URL
Base URL of the Harness platform. Defaults to https://app.harness.io for SaaS; set to your on-prem hostname for self-managed deployments.
Yes (for CLI and GitHub Actions)
Example: set core auth variables in a shell session
export HARNESS_ACCOUNT_ID="<your-account-id>"
export HARNESS_EMAIL="user@example.com"
export HARNESS_API_KEY="<your-pat>"
export HARNESS_URL="https://app.harness.io"Example: GitHub Actions secrets
- uses: harness/artifacts-action@v1
with:
api-url: ${{ secrets.HARNESS_URL }}
account: ${{ secrets.HARNESS_ACCOUNT_ID }}
token: ${{ secrets.HARNESS_PAT_TOKEN }}Store HARNESS_API_KEY (sometimes named HARNESS_PAT_TOKEN in GitHub Actions workflows) as a secret, not as a plain environment variable. Go to Authentication and identity tokens for guidance on token types and scopes.
hc CLI variables
The hc CLI reads these variables automatically when they are set. Command-line flags override them when both are present.
HARNESS_API_TOKEN
--api-key
API token for all hc commands. Equivalent to HARNESS_API_KEY.
HARNESS_ACCOUNT_ID
--account-id
Account identifier.
HARNESS_URL
--url
Harness platform base URL.
Go to CLI reference for a full list of commands and flags.
Dependency Firewall: pipeline context variables
When hc runs inside a Harness CI pipeline, it reads these variables automatically to link the dependency audit to the pipeline execution. The Dependency Firewall uses this context to populate the Affected Pipelines view.
HARNESS_PIPELINE_ID
Pipeline identifier
The pipeline that triggered the build.
HARNESS_BUILD_ID
Execution identifier
The specific run of the pipeline.
HARNESS_STAGE_ID
Stage identifier
The stage inside the pipeline where hc fw audit runs.
ORG_IDENTIFIER
Organization
The Harness organization the pipeline belongs to.
PROJECT_IDENTIFIER
Project
The Harness project the pipeline belongs to.
Harness CI injects all five variables automatically. If you run hc fw audit outside a Harness CI pipeline (for example, in a local shell or a third-party CI system), set them manually so the firewall report is attributed correctly.
Example: Jenkins declarative pipeline
Package manager variables
These variables configure individual package manager clients to route traffic through Harness.
Go modules
GOPROXY
Go module proxy URL. Set to your Harness registry Go endpoint to route go get and go mod download through Harness.
Example:
Hugging Face
HF_ENDPOINT
Overrides the default huggingface.co endpoint. Set to your Harness registry Hugging Face URL.
HF_TOKEN
Hugging Face authentication token. Set to your Harness identity token (from Set Up Client).
HF_HUB_ETAG_TIMEOUT
Seconds before the Hub ETag check times out. Increase for large models on slow connections.
HF_HUB_DOWNLOAD_TIMEOUT
Seconds before a model download times out. Increase for large files.
Example:
Maven plugin
The Harness Maven plugin reads these variables instead of requiring credentials in ~/.m2/settings.xml.
DEPLOY_REPO_URL
Maven repository URL for mvn deploy.
Yes (deploy)
DEPLOY_USERNAME
Username for deployment.
Yes (deploy)
DEPLOY_TOKEN
Token or password for deployment.
Yes (deploy)
DEPLOY_THREAD_COUNT
Number of threads for parallel artifact upload. Defaults to the number of CPU cores.
No
RESOLVER_REPO_URL
Repository URL for mvn harness:enforce-resolution.
Yes (resolution)
RESOLVER_USERNAME
Username for resolution.
Yes (resolution)
RESOLVER_TOKEN
Token or password for resolution.
Yes (resolution)
Example:
Go to Maven client setup for the full plugin configuration.
Migration variables
These variables are referenced in migration configuration files. They follow standard shell-substitution syntax (${VAR}) when used in YAML migration configs.
HARNESS_TOKEN
Migration config YAML
Same as HARNESS_API_KEY; some migration tool examples use this alias.
HARNESS_USER
Migration config YAML
Same as HARNESS_EMAIL; used as the username in migration tool authentication.
SOURCE_PASSWORD
Migration config YAML
The token or password for the source registry (JFrog, ECR, etc.) being migrated from.
Example migration config fragment:
Go to Migrate to Harness Artifacts for step-by-step migration guides.
Terraform provider variables
The Harness Terraform provider reads these TF_VAR_* variables automatically when they correspond to declared input variables in your configuration.
TF_VAR_harness_platform_api_key
harness_platform_api_key input var
API key passed to the provider's platform_api_key argument.
TF_VAR_harness_account_id
harness_account_id input var
Account ID passed to the provider's account_id argument.
TF_VAR_space_ref
space_ref input var
Registry scope reference (account, org, or project path).
Example: provider configuration using env vars
Go to Terraform provider reference for full resource documentation.
Troubleshooting
Last updated
Was this helpful?