Pulling a binary artifact from a registry
-
Create the following environment variables depending on the authentication method:
IAM tokenAPI key-
Get an IAM token for the Yandex account or service account you are going to use for authentication.
-
Create the
REGISTRY_USERNAMEandREGISTRY_PASSWORDenvironment variables:export REGISTRY_USERNAME="iam" export REGISTRY_PASSWORD="<IAM_token>"Where:
REGISTRY_USERNAME: Authentication method.REGISTRY_PASSWORD: Body of the previously obtained IAM token.
Note
The IAM token's lifetime is limited to 12 hours.
-
Create an API key for the service account you are going to use for authentication.
When creating a key, specify its scope:
yc.cloud-registry.artifacts.pull: To pull artifacts from the registry.yc.cloud-registry.artifacts.push: To push artifacts to the registry.
-
Create the
REGISTRY_USERNAMEandREGISTRY_PASSWORDenvironment variables:export REGISTRY_USERNAME="api_key" export REGISTRY_PASSWORD="<API_key>"Where:
REGISTRY_USERNAME: Authentication method.REGISTRY_PASSWORD: Body of the previously created API key.
Note
The API key maximum lifetime is set manually when you create the key.
-
-
To pull a binary artifact, use a GET HTTP
request:curl \ --request GET \ --user "$REGISTRY_USERNAME:$REGISTRY_PASSWORD" \ --location \ --output <local_path_to_file> \ https://registry.yandexcloud.net/binaries/<registry_ID>/<artifact_name>/<artifact_version>Where:
-
--request: Method. -
--user: Authentication data. -
--output: Local path and name of the file to pull the artifact to. -
The request URL contains the registry URL as well as the artifact name and version. Here is an example:
https://registry.yandexcloud.net/binaries/cn15fqbr806r********/sample-package/3.5.4
-
Scope is an API key parameter that restricts the key's use to specific operations in addition to the service account's access permissions. For details, see API keys with scope and validity limits.