|
2 | 2 | ORB_STR_REGION="$(circleci env subst "${ORB_STR_REGION}")"
|
3 | 3 | ORB_STR_REPO="$(circleci env subst "${ORB_STR_REPO}")"
|
4 | 4 | ORB_STR_PROFILE_NAME="$(circleci env subst "${ORB_STR_PROFILE_NAME}")"
|
| 5 | +ORB_STR_ENCRYPTION_KMS_KEY="$(circleci env subst "${ORB_STR_ENCRYPTION_KMS_KEY}")" |
5 | 6 |
|
6 | 7 | if [ "$ORB_BOOL_PUBLIC_REGISTRY" == "1" ]; then
|
7 | 8 | aws ecr-public describe-repositories --profile "${ORB_STR_PROFILE_NAME}" --region us-east-1 --repository-names "${ORB_STR_REPO}" >/dev/null 2>&1 ||
|
8 | 9 | aws ecr-public create-repository --profile "${ORB_STR_PROFILE_NAME}" --region us-east-1 --repository-name "${ORB_STR_REPO}"
|
9 | 10 | else
|
10 |
| - aws ecr describe-repositories --profile "${ORB_STR_PROFILE_NAME}" --region "${ORB_STR_REGION}" --repository-names "${ORB_STR_REPO}" >/dev/null 2>&1 || |
11 |
| - if [ "$ORB_BOOL_REPO_SCAN_ON_PUSH" == "1" ]; then |
12 |
| - aws ecr create-repository --profile "${ORB_STR_PROFILE_NAME}" --region "${ORB_STR_REGION}" --repository-name "${ORB_STR_REPO}" --image-scanning-configuration scanOnPush=true |
13 |
| - else |
14 |
| - aws ecr create-repository --profile "${ORB_STR_PROFILE_NAME}" --region "${ORB_STR_REGION}" --repository-name "${ORB_STR_REPO}" --image-scanning-configuration scanOnPush=false |
15 |
| - fi |
| 11 | + |
| 12 | + IMAGE_SCANNING_CONFIGURATION="scanOnPush=true" |
| 13 | + if [ "$ORB_BOOL_REPO_SCAN_ON_PUSH" -ne "1" ]; then |
| 14 | + IMAGE_SCANNING_CONFIGURATION="scanOnPush=false" |
| 15 | + fi |
| 16 | + |
| 17 | + ENCRYPTION_CONFIGURATION="encryptionType=${ORB_ENUM_ENCRYPTION_TYPE}" |
| 18 | + if [ "$ORB_ENUM_ENCRYPTION_TYPE" == "KMS" ]; then |
| 19 | + ENCRYPTION_CONFIGURATION+=",kmsKey=${ORB_STR_ENCRYPTION_KMS_KEY}" |
| 20 | + fi |
| 21 | + |
| 22 | + aws ecr describe-repositories \ |
| 23 | + --profile "${ORB_STR_PROFILE_NAME}" \ |
| 24 | + --region "${ORB_STR_REGION}" \ |
| 25 | + --repository-names "${ORB_STR_REPO}" >/dev/null 2>&1 || |
| 26 | + aws ecr create-repository \ |
| 27 | + --profile "${ORB_STR_PROFILE_NAME}" \ |
| 28 | + --region "${ORB_STR_REGION}" \ |
| 29 | + --repository-name "${ORB_STR_REPO}" \ |
| 30 | + --image-scanning-configuration "${IMAGE_SCANNING_CONFIGURATION}" \ |
| 31 | + --encryption-configuration "${ENCRYPTION_CONFIGURATION}" |
16 | 32 | fi
|
0 commit comments