-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65f42fb
commit 7b65862
Showing
17 changed files
with
572 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,167 @@ | ||
# typescript-library-skeleton | ||
# @jcoreio/aws-ecr-utils | ||
|
||
[![CircleCI](https://circleci.com/gh/jedwards1211/typescript-library-skeleton.svg?style=svg)](https://circleci.com/gh/jedwards1211/typescript-library-skeleton) | ||
[![Coverage Status](https://codecov.io/gh/jedwards1211/typescript-library-skeleton/branch/master/graph/badge.svg)](https://codecov.io/gh/jedwards1211/typescript-library-skeleton) | ||
[![CircleCI](https://circleci.com/gh/jcoreio/aws-ecr-utils.svg?style=svg)](https://circleci.com/gh/jcoreio/aws-ecr-utils) | ||
[![Coverage Status](https://codecov.io/gh/jcoreio/aws-ecr-utils/branch/master/graph/badge.svg)](https://codecov.io/gh/jcoreio/aws-ecr-utils) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
[![npm version](https://badge.fury.io/js/typescript-library-skeleton.svg)](https://badge.fury.io/js/typescript-library-skeleton) | ||
[![npm version](https://badge.fury.io/js/%40jcoreio%2Faws-ecr-utils.svg)](https://badge.fury.io/js/%40jcoreio%2Faws-ecr-utils) | ||
|
||
This is my personal skeleton for creating an typescript library npm package. You are welcome to use it. | ||
# Table of Contents | ||
|
||
## Quick start | ||
- [@jcoreio/aws-ecr-utils](#jcoreioaws-ecr-utils) | ||
- [Table of Contents](#table-of-contents) | ||
- [`copyECRImage(options)`](#copyecrimageoptions) | ||
- [Options](#options) | ||
- [`options.from.imageUri`, `options.to.imageUri` (`string`, **required**)](#optionsfromimageuri-optionstoimageuri-string-required) | ||
- [`options.from.ecr`, `options.to.ecr` (`AWS.ECR`, _optional_)](#optionsfromecr-optionstoecr-awsecr-optional) | ||
- [`options.from.awsConfig`, `options.to.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsfromawsconfig-optionstoawsconfig-awsconfigurationoptions-optional) | ||
- [Returns (`Promise<void>`)](#returns-promisevoid) | ||
- [`ecrImageExists(options)`](#ecrimageexistsoptions) | ||
- [Options](#options-1) | ||
- [`options.ecr` (`AWS.ECR`, _optional_)](#optionsecr-awsecr-optional) | ||
- [`options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsawsconfig-awsconfigurationoptions-optional) | ||
- [`options.imageUri` (`string`, _optional_)](#optionsimageuri-string-optional) | ||
- [`options.registryId` (`string`, _optional_)](#optionsregistryid-string-optional) | ||
- [`options.repositoryName` (`string`, _optional_)](#optionsrepositoryname-string-optional) | ||
- [`options.imageTag` (`string`, _optional_)](#optionsimagetag-string-optional) | ||
- [Returns (`Promise<boolean>`)](#returns-promiseboolean) | ||
- [`loginToECR(options)`](#logintoecroptions) | ||
- [Options](#options-2) | ||
- [`options.ecr` (`AWS.ECR`, _optional_)](#optionsecr-awsecr-optional-1) | ||
- [`options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsawsconfig-awsconfigurationoptions-optional-1) | ||
- [Returns (`Promise<void>`)](#returns-promisevoid-1) | ||
- [`parseECRImageUri(imageUri)`](#parseecrimageuriimageuri) | ||
- [Options](#options-3) | ||
- [`imageUri` (`string`, **required**)](#imageuri-string-required) | ||
- [Returns (`object`)](#returns-object) | ||
- [`tagECRImage(options)`](#tagecrimageoptions) | ||
- [Options](#options-4) | ||
- [`options.ecr` (`AWS.ECR`, _optional_)](#optionsecr-awsecr-optional-2) | ||
- [`options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsawsconfig-awsconfigurationoptions-optional-2) | ||
- [`options.imageUri` (`string`, **required**)](#optionsimageuri-string-required) | ||
- [`options.tags` (`string[]`, **required**)](#optionstags-string-required) | ||
- [Returns (`Promise<void>`)](#returns-promisevoid-2) | ||
|
||
```sh | ||
npx 0-60 clone https://github.com/jedwards1211/typescript-library-skeleton.git | ||
## `copyECRImage(options)` | ||
|
||
Copies an image between ECRs (potentially between accounts). Requires Docker to be installed and the `docker` command to be on your path. | ||
|
||
### Options | ||
|
||
#### `options.from.imageUri`, `options.to.imageUri` (`string`, **required**) | ||
|
||
The URIs of the source and destination ECR images | ||
|
||
#### `options.from.ecr`, `options.to.ecr` (`AWS.ECR`, _optional_) | ||
|
||
The ECR clients to use for the source and destination images | ||
|
||
#### `options.from.awsConfig`, `options.to.awsConfig` (`AWS.ConfigurationOptions`, _optional_) | ||
|
||
The AWS service options to use if `options.from.ecr` and `options.to.ecr` aren't provided | ||
|
||
### Returns (`Promise<void>`) | ||
|
||
A promise that will resolve once the image has been pulled from the source repository and pushed to the destination repository. | ||
|
||
## `ecrImageExists(options)` | ||
|
||
Determines if an ECR image exists. | ||
|
||
### Options | ||
|
||
#### `options.ecr` (`AWS.ECR`, _optional_) | ||
|
||
The ECR client to use | ||
|
||
#### `options.awsConfig` (`AWS.ConfigurationOptions`, _optional_) | ||
|
||
The AWS service options to use if `options.ecr` isn't provided | ||
|
||
#### `options.imageUri` (`string`, _optional_) | ||
|
||
The URI of the image to look for. You must provide either this or `options.registryId`, | ||
`options.repositoryName`, or `imageTag`. | ||
|
||
#### `options.registryId` (`string`, _optional_) | ||
|
||
The ID of the ECR (same as your AWS account number?) | ||
|
||
#### `options.repositoryName` (`string`, _optional_) | ||
|
||
The name of the ECR repository | ||
|
||
#### `options.imageTag` (`string`, _optional_) | ||
|
||
The ECR image tag | ||
|
||
### Returns (`Promise<boolean>`) | ||
|
||
A promise that will resolve to true if the image exists and false otherwise. | ||
|
||
## `loginToECR(options)` | ||
|
||
Logs the local Docker client into the given ECR. Requires Docker to be installed and the `docker` command to be on your path. | ||
|
||
### Options | ||
|
||
#### `options.ecr` (`AWS.ECR`, _optional_) | ||
|
||
The ECR client to use | ||
|
||
#### `options.awsConfig` (`AWS.ConfigurationOptions`, _optional_) | ||
|
||
The AWS service options to use if `options.ecr` isn't provided | ||
|
||
### Returns (`Promise<void>`) | ||
|
||
A promise that will resolve once logged in. | ||
|
||
## `parseECRImageUri(imageUri)` | ||
|
||
Parses the given ECR image URI. | ||
|
||
### Options | ||
|
||
#### `imageUri` (`string`, **required**) | ||
|
||
The URI of the ECR image to parse. | ||
|
||
### Returns (`object`) | ||
|
||
An object with the following properties: | ||
|
||
```ts | ||
{ | ||
registryId: string | ||
region: string | ||
repositoryName: string | ||
imageTag: string | ||
} | ||
``` | ||
|
||
## Tools used | ||
|
||
- babel 7 | ||
- typescript | ||
- mocha | ||
- chai | ||
- istanbul | ||
- nyc | ||
- eslint | ||
- prettier | ||
- husky | ||
- semantic-release | ||
- renovate | ||
- Circle CI | ||
- Codecov.io | ||
## `tagECRImage(options)` | ||
|
||
Adds additional tags to an existing ECR image. | ||
|
||
### Options | ||
|
||
#### `options.ecr` (`AWS.ECR`, _optional_) | ||
|
||
The ECR client to use | ||
|
||
#### `options.awsConfig` (`AWS.ConfigurationOptions`, _optional_) | ||
|
||
The AWS service options to use if `options.ecr` isn't provided | ||
|
||
#### `options.imageUri` (`string`, **required**) | ||
|
||
The URI of the ECR image to add tags to | ||
|
||
#### `options.tags` (`string[]`, **required**) | ||
|
||
The tags to add to the ECR image | ||
|
||
### Returns (`Promise<void>`) | ||
|
||
A promise that will resolve once the tags have been added. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.