ecr

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ecr lists Amazon ECR registries through the ECR API instead of the distribution API. One DescribeImages page covers up to 1,000 manifests with their tags, push time and last pull time, so a re-crawl costs one call per thousand images rather than one request per tag, and BatchGetImage fetches up to 100 manifests per call, so a first crawl fetches only image configs one by one. It also signs registry requests with the AWS credential chain, so no Docker credential helper is needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseHost

func ParseHost(host string) (account, region string, ok bool)

ParseHost returns the account and region of an ECR registry host.

Types

type API

API is the part of the ECR client strata uses.

type Credentials added in v0.3.1

type Credentials struct {
	// Profile is a named profile from the shared AWS config, such as an
	// SSO profile for the account that owns the registry.
	Profile string
	// RoleARN is a role to assume, starting from the profile or the
	// default chain, such as a read-only role in the registry's account.
	RoleARN string
	// ExternalID is passed when assuming RoleARN, if the role requires it.
	ExternalID string
}

Credentials pick the AWS identity for one registry, so registries in different accounts can each use their own. Empty fields use the default AWS credential chain.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is one ECR registry. It is a crawl.Lister and an authn.Keychain.

func New

func New(ctx context.Context, host string, creds Credentials, opts ...func(*awsconfig.LoadOptions) error) (*Registry, error)

New returns a client for an ECR registry host. Credentials come from creds, falling back to the default AWS credential chain: environment, shared config and SSO profiles, web identity (EKS) and instance roles. The region comes from the host.

func NewWithAPI

func NewWithAPI(ctx context.Context, host, account string, api API) *Registry

NewWithAPI returns a client that calls api, for tests and custom clients.

func (*Registry) Calls added in v0.3.0

func (r *Registry) Calls() int64

Calls returns how many ECR API calls the client has made.

func (*Registry) Images

func (r *Registry) Images(ctx context.Context, repo string) ([]crawl.Listed, error)

Images lists every active manifest in a repository. Archived images cannot be pulled, so they are left out.

func (*Registry) Manifests added in v0.3.0

func (r *Registry) Manifests(ctx context.Context, repo string, digests []string) (map[string][]byte, error)

Manifests fetches the manifests of digests in one BatchGetImage call; ECR takes up to 100 per call. A manifest whose bytes do not hash to the digest asked for, or that ECR could not return, is left out, and the crawl fetches it the usual way.

func (*Registry) Repos

func (r *Registry) Repos(ctx context.Context) ([]string, error)

Repos lists every repository in the registry.

func (*Registry) Resolve

func (r *Registry) Resolve(target authn.Resource) (authn.Authenticator, error)

Resolve returns credentials for this registry and anonymous for every other host, so it composes with other keychains.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL