Aptly supports mirroring Debian packages from Google Artifact Registry with automatic authentication using the special ar+https:// URL scheme.
Google Artifact Registry is a universal package manager that can host Debian packages. When using the ar+https:// scheme, aptly automatically obtains OAuth2 access tokens and handles authentication transparently.
Prerequisites:
To use this feature, you need to have Google Cloud credentials configured. Aptly uses Application Default Credentials (ADC). For details on how to set up authentication, see the Application Default Credentials documentation.
GPG Key Setup:
Google Artifact Registry repositories are signed with Google’s GPG key. You need to import this key before creating a mirror.
Option 1: Import into aptly’s default keyring
Import Google’s GPG key into trustedkeys.gpg:
$ wget -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
Option 2: Use a custom keyring
If you prefer to use a separate keyring, create and use it with the -keyring flag:
$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/google-artifact-registry-repository-signer.gpg > /dev/null
$ aptly mirror create -keyring=/etc/apt/keyrings/google-artifact-registry-repository-signer.gpg <name> ar+https://...
$ aptly mirror update -keyring=/etc/apt/keyrings/google-artifact-registry-repository-signer.gpg <name>
Usage:
To create a mirror of a repository hosted on Google Artifact Registry, use the ar+https:// URL scheme.
Create a mirror from Google Artifact Registry:
$ aptly mirror create <name> ar+https://<location>-apt.pkg.dev/projects/<project_id> <repository> main
Params are:
name is a name that would be used in aptly to reference this mirrorlocation is the regional or multi-regional location of the repositoryproject_id is the project ID of the repositoryrepository is the name of the Artifact Registry repositoryUpdate the mirror:
$ aptly mirror update <name>
Authentication Details:
When using the ar+https:// scheme:
Authorization: Bearer headerar+https:// scheme is transparently converted to https:// for the actual requestPermissions Required:
The service account or user account needs the following IAM permissions:
artifactregistry.repositories.downloadArtifactsartifactregistry.repositories.getartifactregistry.repositories.listThese are included in the roles/artifactregistry.reader role.
Troubleshooting:
If you get a 403 error:
See Also: