Harness Artifact Registry provides support for Conda packages, allowing you to host private Python and R packages in the Conda format.
Overview
Conda registry features:
- Standard Conda repository protocol
- Support for
.tar.bz2 package format
- Multi-platform support (linux-64, osx-64, win-64, noarch)
- Version and build number management
- Integration with conda and mamba
Pushing Conda packages
Use the hc artifact push conda command:
hc artifact push conda <registry-name> <conda-package-path> \
--pkg-url <pkg-url>
Conda packages are typically .tar.bz2 files created with conda build
Building Conda packages
Create meta.yaml
Define your package recipe:package:
name: mypackage
version: "1.0.0"
source:
path: ..
build:
number: 0
script: python -m pip install . -vv
requirements:
host:
- python
- pip
run:
- python
about:
home: https://github.com/myorg/mypackage
summary: My awesome package
license: MIT
Build the package
Use conda-build:conda install conda-build
conda build .
This creates a package like:~/anaconda3/conda-bld/linux-64/mypackage-1.0.0-py39_0.tar.bz2
Upload to registry
Push the package:hc artifact push conda my-registry \
~/anaconda3/conda-bld/linux-64/mypackage-1.0.0-py39_0.tar.bz2 \
--pkg-url https://app.harness.io/registry/pkg
Installing Conda packages
Configure conda to use your Harness registry:
Add channel
conda config --add channels https://<registry-url>/
conda config --set channel_priority strict
Authentication
Set credentials in .condarc:
channels:
- https://<username>:<token>@<registry-url>/
- defaults
channel_priority: strict
Install packages
conda install mypackage
# Or with specific version
conda install mypackage=1.0.0
Examples
# Build and push for Linux
conda build . --platform linux-64
hc artifact push conda my-registry \
~/anaconda3/conda-bld/linux-64/mypackage-1.0.0-py39_0.tar.bz2 \
--pkg-url https://app.harness.io/registry/pkg
Package naming convention
Conda packages follow this pattern:
name-version-buildstring.tar.bz2
Examples:
mypackage-1.0.0-py39_0.tar.bz2
mylib-2.1.0-py38h1234567_0.tar.bz2
tool-1.0.0-0.tar.bz2 (noarch)
Using with Mamba
Mamba is a faster alternative to conda:
# Install mamba
conda install mamba -c conda-forge
# Add channel
mamba config --add channels https://<registry-url>/
# Install packages
mamba install mypackage
CI/CD integration
- name: Build and publish
run: |
conda install conda-build
conda build .
hc artifact push conda my-registry \
~/anaconda3/conda-bld/*/*.tar.bz2 \
--pkg-url https://app.harness.io/registry/pkg
env:
HARNESS_API_KEY: ${{ secrets.HARNESS_API_KEY }}
publish:
image: continuumio/miniconda3
script:
- conda install conda-build
- conda build .
- hc artifact push conda my-registry ~/anaconda3/conda-bld/*/*.tar.bz2 --pkg-url $PKG_URL
variables:
HARNESS_API_KEY: $HARNESS_TOKEN
Troubleshooting
Package validation failed
Ensure your package was built correctly:# Verify package contents
tar -tjf mypackage-1.0.0-py39_0.tar.bz2 | head
Check your conda configuration:conda config --show channels
Verify credentials in .condarc:
See also