11#! /bin/bash
22
3- aws_ecr_list_repos () {
3+ function aws_ecr_list_repos() {
44 aws_run_commandline " aws ecr describe-repositories --query \" *[].repositoryArn\" "
55}
66
7- aws_ecr_login () {
7+ function aws_ecr_login() {
88
99 if [[ -z " ${AWS_ACCOUNT_ID} " ]]; then
1010 aws_assume_role_get_aws_account_id
@@ -21,15 +21,15 @@ aws_ecr_login() {
2121
2222}
2323
24- aws_ecr_logout () {
24+ function aws_ecr_logout() {
2525 if [[ -z " ${AWS_ACCOUNT_ID} " ]]; then
2626 aws_assume_role_get_aws_account_id
2727 fi
2828 aws_run_commandline " docker logout ${AWS_ACCOUNT_ID} .dkr.ecr.${AWS_REGION} .amazonaws.com"
2929
3030}
3131
32- aws_ecr_list_images () {
32+ function aws_ecr_list_images() {
3333 if [[ -z " ${AWS_ACCOUNT_ID} " ]]; then
3434 aws_assume_role_get_aws_account_id
3535 fi
@@ -43,7 +43,7 @@ aws_ecr_list_images() {
4343 aws_run_commandline " aws ecr list-images --repository-name ${aws_ecr_repo_name} --query 'imageIds[].{imageTag:imageTag}'"
4444}
4545
46- aws_ecr_get_latest_image () {
46+ function aws_ecr_get_latest_image() {
4747 if [[ -z " ${AWS_ACCOUNT_ID} " ]]; then
4848 aws_assume_role_get_aws_account_id
4949 fi
@@ -57,17 +57,17 @@ aws_ecr_get_latest_image() {
5757 aws_run_commandline " aws ecr list-images --repository-name ${aws_ecr_repo_name} --query 'imageIds[0].{imageTag:imageTag}'"
5858}
5959
60- aws_ecr_get_latest_image_with_hint () {
60+ function aws_ecr_get_latest_image_with_hint() {
6161 echo " Your repository name >"
6262 aws_ecr_get_latest_image $( peco_create_menu ' peco_aws_ecr_list_repo_names' )
6363}
6464
65- aws_ecr_list_images_with_hint () {
65+ function aws_ecr_list_images_with_hint() {
6666 echo " Your repository name >"
6767 aws_ecr_list_images $( peco_create_menu ' peco_aws_ecr_list_repo_names' )
6868}
6969
70- aws_ecr_get_image () {
70+ function aws_ecr_get_image() {
7171 aws_ecr_repo_name=$1
7272 aws_ecr_repo_image_tag=$2
7373
@@ -80,7 +80,8 @@ aws_ecr_get_image() {
8080 ${AWS_ACCOUNT_ID} .dkr.ecr.${AWS_REGION} .amazonaws.com/${aws_ecr_repo_name:? Repo is not set or empty} :${aws_ecr_repo_image_tag:- latest}
8181}
8282
83- aws_ecr_pull_image_with_hint () {
83+ function aws_ecr_pull_image_with_hint() { # To get the docker image and pull it to local
84+ aws_assume_role_get_aws_account_id
8485 echo " Your repository name >"
8586 aws_ecr_repo_name=$( peco_create_menu ' peco_aws_ecr_list_repo_names' )
8687 echo " Your image tag for ${aws_ecr_repo_name:? ' aws_ecr_repo_name is unset or empty' } >"
0 commit comments