ecresolve

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 5 Imported by: 0

README

ecresolve

Resolves AWS ECR images with prioritized tag-based lookup

Installation

You can install ecresolve using Homebrew, from source, or by downloading the binary.

In case you're using Homebrew:

brew install ebi-yade/tap/ecresolve
Other ways
From Source
go install github.com/ebi-yade/ecresolve@latest
Downloading the Binary

You can download the binary from the releases page,

Usage

Let's say you have a repository named <your-repository> with only two tags: latest and stable.

If you run a query with three tags like this:

ecresolve foo latest stable --repository-name <your-repository-name>

The latest image will be returned since it's the first matching tag found in the list of provided candidates:

{
  "imageId": {
    "imageDigest": "sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "imageTag": "latest"
  },
  "imageManifest": " <abbreviated escaped JSON string>",
  "imageManifestMediaType": "application/vnd.oci.image.index.v1+json",
  "registryId": "<your-aws-account-id>",
  "repositoryName": "<your-repository-name>"
}

Note: The response is compatible with the Image object from the AWS ECR API.

If none of the specified tags exist, the command will fail with the following error and exit with code 1:

ecresolve foo bar --repository-name <your-repository-name>
# stderr -> "2024/10/24 18:15:02 ERROR error Resolve: no matching images found"

Specifying --format=tag-only will be helpful if you just want to get the tag name:

ecresolve foo latest stable --repository-name <your-repository-name> --format=tag-only
# stdout -> "latest"

Contributing

Feel free to open an issue or a pull request if you have any suggestions or improvements in mind.

日本語でのIssueやPRも歓迎です!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatchingImages = errors.New("no matching images found")

Functions

func Resolve

func Resolve(ctx context.Context, input Input) (*types.Image, error)

Types

type Input

type Input struct {
	Tags           []string `arg:"" help:"Image tags to search for, in order of preference (e.g. :latest :dev :main)" required:""`
	RepositoryName string   `help:"The repository that contains the images to describe." required:""`
	RegistryId     string   `help:"The AWS account ID associated with the registry containing the images." optional:""`
	Region         string   `help:"AWS region to use." optional:""`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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