Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.
ArtifactsRegistry TypesCi Cd

Debian

Create a Debian or APT registry, generate an identity token, then configure APT, publish .deb packages, and install them from Harness Artifacts.

Use a Debian / APT registry to host, proxy, and distribute .deb packages for Debian and Ubuntu systems using APT.

What you will learn from this topic

By the end of this quickstart guide, you will be able to:

  • Create a registry in Harness Artifacts.

  • Publish a package to the registry.

  • Install the package from the registry, and confirm that it works.

Before you begin

  • Install the APT package manager on your local machine. APT is available by default on Debian and Ubuntu systems.

  • Install curl. You use it to publish .deb files and Debian source files to your registry.

  • Make sure you have access to a Harness account with permission to create registries and connectors.

Create a Debian registry

To create a Debian / APT registry, perform the following steps:

  1. In Artifact Registry, select Registries.

  2. Select + Create Registry.

  3. Specify the Registry name.

Registry name criteria

The registry name must start with a letter, can only contain lowercase alphanumerics, _, ., and -, and must be unique to your Harness account.

  1. Optionally, add a Description.

  2. Choose visibility between Public and Private. The default is Private.

Private Debian registry

A private Debian / APT registry in Harness Artifacts hosts and distributes packages only to authenticated clients.

  1. Select Debian as the Registry type.

  2. Optionally, in the Debian Configuration section, set the Indexed Remote Architectures and Index Compression Formats.

Indexed remote architectures

Indexed Remote Architectures lists the architectures Harness indexes from remote repositories on this registry. The defaults are amd64, i386, and arm64. Select from these defaults, or enter a custom architecture name to index additional architectures from remote repositories. If you leave the field empty, Harness indexes every available architecture, which increases cold-start index generation time and cost.

Index compression formats

Harness generates a .gz index for your registry by default. Optionally, select XZ (.xz extension) in Index Compression Formats for a smaller index; doing so increases cold-start index generation time and cost.

  1. Select Save.

  2. Select Create to finalize.

GPG signing key

Optionally, attach a GPG signing key to your registry so Harness signs repository metadata and clients can verify packages with apt update. To create or import a key and configure your registry and clients, go to Set up signing keys to configure package signing.

Configure an upstream proxy (optional)

An upstream proxy allows your registry to fetch Debian packages from external repositories, such as official Debian or Ubuntu mirrors, when they are not available locally.

Create upstream proxy

To create an upstream proxy, perform the following steps:

  1. In Artifact Registry, select Registries.

  2. Select the drop-down next to + Create Registry, then select Upstream Proxy.

  3. Specify the Registry name.

  4. Optionally, add a Description.

  5. Choose visibility between Public and Private. The default is Private.

  6. Select Debian as the Registry type.

  7. Select Custom as the Source, then specify the Remote registry URL (for example, http://deb.debian.org/debian).

Remote registry URL format

The remote registry URL must point to the parent directory of the dists folder for that repository. For example, http://deb.debian.org/debian is correct, because http://deb.debian.org/debian/dists/ contains the release metadata. If you use another Debian mirror or a private repository, confirm the URL ends at that parent level, not at a distribution or component subdirectory.

  1. Select the Authentication method.

    • Username and password: Specify the username and password. Use an existing secret, or create a new secret by specifying the Name and entering the Secret text.

    • Anonymous: No credentials required. This works for public Debian repositories.

  2. Select Create to finalize.

Configure the upstream proxy in your registry

To configure the upstream proxy in your registry, perform the following steps:

  1. In Artifact Registry, select an existing Debian / APT Artifact.

  2. Navigate to the Configuration tab.

  3. Select Edit in the Upstream proxy section.

  4. Click + Add upstream proxy.

  5. Select the required proxy from the list.

  6. Click Apply.

  7. Select Update to finalize.

Upstream proxy caching

If a package is not found in your Harness registry, the upstream proxy fetches it from the remote repository and caches it locally. Subsequent installs for the same package version are served from the cache.

Debian metadata regeneration

Harness regenerates Debian registry metadata when you upload or delete a package, or when you add or remove an upstream proxy from a registry. This operation can take a few minutes, so your changes might not appear in APT metadata immediately.

Debian / APT client setup

In your Debian / APT Artifact, select Set Up Client. The dialog gives you an identity token, then instructions to configure APT, publish packages, and install packages.

Generate an identity token

An identity token serves as the password for authenticating with the registry.

  1. In your Debian / APT Artifact, select Set Up Client.

  2. Select Generate Token.

  3. Select an Expiration for the token:

    • 30 Days

    • 90 Days

    • 180 Days

    • Custom

  4. Copy the token. You use it in the following steps in place of <IDENTITY_TOKEN>.

Token expiration

The identity token stops working after the expiration you select. Generate a new token and update your client configuration before the current token expires.

Configure the client

In the code samples, replace the values in angle brackets with your own values.

1. Configure APT

Add the Debian repository to your APT sources. The [trusted=yes] option bypasses GPG signature verification for this repository. If you attached a signing key to your registry, go to Set up signing keys to configure a signed repository entry instead, and omit [trusted=yes].

Create or edit the auth config file:

Add the following content. Use your Harness account email address as <USERNAME>.

Update the APT cache:

2. Publish the package

Upload a .deb file to the registry:

Optionally, upload the Debian source files for the package. Upload a .dsc file:

Upload the source tarball. For an upstream source tarball, specify the upstream version:

3. Use the package

Install a package with APT:

Setup verification

Confirm that your registry serves the package you published. To verify your setup, perform the following steps:

  1. On a system with no cached APT package lists for this repository, run sudo apt-get update, then install the package you published.

  2. Confirm that APT downloaded the package from your Harness registry address, which is shown in Set Up Client.

  3. In Harness, open your registry and confirm that the package and version appear in the package list.

If a step fails, go to Troubleshooting to resolve common authentication and resolution issues before you retry.

Pipeline automation (optional)

Publishing from a pipeline gives you a repeatable release process. Run the publish step when you create a version tag, so each release maps to one version in the registry.

The following Run step shows the shape of a publish step. Store the identity token as a Harness secret, and do not write it into the pipeline YAML.

Troubleshooting

`apt-get update` fails with `401 Unauthorized` or `403 Forbidden`

Check that /etc/apt/auth.conf.d/harness-<REGISTRY_NAME>.conf contains the correct machine, login, and password values, and that the identity token has not expired or been revoked. Generate a new token in Set Up Client, then update the auth config file.

A `.deb` upload returns `409 Conflict`

Debian package versions are immutable after publish. Increment the version in the package's control file, or delete the existing version only if your registry retention and lifecycle policies allow it.

`apt-get install` cannot find the package, or installs an old version

Run sudo apt-get update to refresh the local package index, and check that the package name, version, distribution, and component match the values you used to publish the package. Harness can take a few minutes to regenerate registry metadata after a publish.

Set Up Client omits upload instructions for an upstream proxy registry

An upstream proxy registry only caches packages from the remote repository, so it does not accept direct uploads, and Set Up Client does not show upload steps. Publish new packages to a standalone Debian / APT registry instead, or let clients pull them through the upstream proxy.

`apt-get install` fails signature verification

If you attached a GPG signing key to your registry, confirm the public key is imported on the client and has not expired before you retry the install.

Next steps

Last updated

Was this helpful?