From f25a888dd4924273921f42b994ddc1efb2876fe0 Mon Sep 17 00:00:00 2001 From: satya-prakash-modi Date: Thu, 26 Aug 2021 13:23:39 -0700 Subject: [PATCH 1/2] Script to create ECR repo --- .../aws/scripts/create-ecr-repo.sh | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 selfmanaged-openshift/aws/scripts/create-ecr-repo.sh diff --git a/selfmanaged-openshift/aws/scripts/create-ecr-repo.sh b/selfmanaged-openshift/aws/scripts/create-ecr-repo.sh new file mode 100755 index 00000000..8f4f4219 --- /dev/null +++ b/selfmanaged-openshift/aws/scripts/create-ecr-repo.sh @@ -0,0 +1,39 @@ +##################################################################################################################### +# Execution command: +# +# ./create-ecr-repo.sh +##################################################################################################################### + +#!/bin/bash + +ACCESS_KEY_ID=$1 +SECRET_ACCESS_KEY=$2 +AWS_REGION=$3 +AWS_ACCOUNT_ID=$4 +FILE_PATH=$5 + +# Install unzip and docker +sudo yum -y install unzip +sudo yum -y install docker + +# Install AWS Cli +rm -rf "awscliv2.zip" +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" > /dev/null +unzip -o awscliv2.zip > /dev/null +sudo ./aws/install + +# AWS Configure +aws configure set aws_access_key_id $ACCESS_KEY_ID; aws configure set aws_secret_access_key $SECRET_ACCESS_KEY; aws configure set default.region $AWS_REGION + +# Authenticate to your default registry +aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com + +for repo_name in $(awk -F',' '{print $2}' $FILE_PATH | awk 'NR!=1 {print}' | awk '{print $NF}' FS=/) +do +echo $repo_name +aws ecr create-repository \ + --repository-name $repo_name \ + --image-scanning-configuration scanOnPush=true \ + --region $AWS_REGION +done + From 88b835ac1543797752f50a33bad1fa6627e72a83 Mon Sep 17 00:00:00 2001 From: satya-prakash-modi Date: Fri, 27 Aug 2021 09:34:36 -0700 Subject: [PATCH 2/2] create ecr repo script changes --- .../aws/scripts/create-ecr-repo.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/selfmanaged-openshift/aws/scripts/create-ecr-repo.sh b/selfmanaged-openshift/aws/scripts/create-ecr-repo.sh index 8f4f4219..5363ee22 100755 --- a/selfmanaged-openshift/aws/scripts/create-ecr-repo.sh +++ b/selfmanaged-openshift/aws/scripts/create-ecr-repo.sh @@ -1,7 +1,17 @@ ##################################################################################################################### -# Execution command: # -# ./create-ecr-repo.sh +# Command to generate CSV file: +# ----------------------------- +# export OFFLINEDIR=$HOME/offline +# export CASE_REPO_PATH=https://github.com/IBM/cloud-pak/raw/master/repo/case +# cloudctl case save \ +# --case ${CASE_REPO_PATH}/ \ +# --outputdir ${OFFLINEDIR} +# +# Comand to execute script: +# ------------------------- +# ./create-ecr-repo.sh +# ##################################################################################################################### #!/bin/bash