Skip to content

Commit dbc2ccb

Browse files
brivudunnjt
andauthored
feat: aws_url paramater (#288)
* chore: commit to create new remote branch * feat: aws_domain parameter (#286) * fix: add aws_domain parameter to job * refactor: env subst --------- Co-authored-by: John <[email protected]>
1 parent 34f5a2b commit dbc2ccb

File tree

8 files changed

+40
-3
lines changed

8 files changed

+40
-3
lines changed

src/commands/build_and_push_image.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ parameters:
179179
default: ""
180180
description: |
181181
The path to the .json file containing the repository policy to be applied to a specified repository in AWS ECR.
182+
aws_domain:
183+
type: string
184+
default: "amazonaws.com"
185+
description: >
186+
The AWS domain for your region, e.g in China, the AWS domain is amazonaws.com.cn
187+
The default value is amazonaws.com
188+
182189
auth:
183190
description: |
184191
The authentication method used to access your AWS account. Import the aws-cli orb in your config and
@@ -255,3 +262,4 @@ steps:
255262
lifecycle_policy_path: <<parameters.lifecycle_policy_path>>
256263
public_registry_alias: <<parameters.public_registry_alias>>
257264
build_path: <<parameters.build_path>>
265+
aws_domain: <<parameters.aws_domain>>

src/commands/build_image.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ parameters:
9898
buildx builders to be saved with Docker Layer Caching, the builder must explicitly be named.
9999
Specify the a builder name with this parameter. This parameter defaults to "default-builder" if none is provided.
100100
101+
aws_domain:
102+
type: string
103+
default: "amazonaws.com"
104+
description: >
105+
The AWS domain for your region, e.g in China, the AWS domain is amazonaws.com.cn
106+
The default value is amazonaws.com
107+
101108
steps:
102109
- run:
103110
name: Build Docker Image with buildx
@@ -117,5 +124,6 @@ steps:
117124
ORB_STR_LIFECYCLE_POLICY_PATH: <<parameters.lifecycle_policy_path>>
118125
ORB_STR_PUBLIC_REGISTRY_ALIAS: <<parameters.public_registry_alias>>
119126
ORB_EVAL_BUILD_PATH: <<parameters.build_path>>
127+
ORB_STR_AWS_DOMAIN: <<parameters.aws_domain>>
120128
command: <<include(scripts/docker_buildx.sh)>>
121129
no_output_timeout: <<parameters.no_output_timeout>>

src/commands/ecr_login.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ parameters:
2727
description: Set to true if building and pushing an image to a Public Registry on ECR.
2828
default: false
2929

30+
aws_domain:
31+
type: string
32+
default: "amazonaws.com"
33+
description: >
34+
AWS domain, China regions will require override.
35+
3036
steps:
3137
- run:
3238
name: Log into Amazon ECR with profile <<parameters.profile_name>>
@@ -35,4 +41,5 @@ steps:
3541
ORB_ENV_REGISTRY_ID: <<parameters.registry_id>>
3642
ORB_STR_REGION: <<parameters.region>>
3743
ORB_BOOL_PUBLIC_REGISTRY: <<parameters.public_registry>>
44+
ORB_STR_AWS_DOMAIN: <<parameters.aws_domain>>
3845
command: <<include(scripts/ecr_login.sh)>>

src/commands/push_image.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ parameters:
3030
description: >
3131
The public registry alias for your public repositories. This parameter is required if pushing to a public repository
3232
It can be found in the Amazon ECR console > Public Registries.
33+
aws_domain:
34+
type: string
35+
default: "amazonaws.com"
36+
description: >
37+
AWS domain, China regions will require override.
3338
steps:
3439
- run:
3540
name: Push image to AWS ECR
@@ -40,4 +45,5 @@ steps:
4045
ORB_BOOL_PUBLIC_REGISTRY: <<parameters.public_registry>>
4146
ORB_STR_PUBLIC_REGISTRY_ALIAS: <<parameters.public_registry_alias>>
4247
ORB_ENV_REGISTRY_ID: << parameters.registry_id >>
48+
ORB_STR_AWS_DOMAIN: <<parameters.aws_domain>>
4349
command: << include(scripts/push_image.sh) >>

src/jobs/build_and_push_image.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ parameters:
189189
provide the aws-cli/setup command to authenticate with your preferred method. View examples for more information.
190190
type: steps
191191

192+
aws_domain:
193+
type: string
194+
default: "amazonaws.com"
195+
description: >
196+
AWS domain, China regions will require override.
197+
192198
steps:
193199
- build_and_push_image:
194200
registry_id: <<parameters.registry_id>>
@@ -221,3 +227,4 @@ steps:
221227
repo_policy_path: <<parameters.repo_policy_path>>
222228
build_path: <<parameters.build_path>>
223229
auth: <<parameters.auth>>
230+
aws_domain: <<parameters.aws_domain>>

src/scripts/docker_buildx.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ ORB_STR_REGION="$(circleci env subst "${ORB_STR_REGION}")"
33
ORB_STR_REPO="$(circleci env subst "${ORB_STR_REPO}")"
44
ORB_STR_TAG="$(circleci env subst "${ORB_STR_TAG}")"
55
ORB_EVAL_PATH="$(eval echo "${ORB_EVAL_PATH}")"
6-
ORB_VAL_ACCOUNT_URL="${!ORB_ENV_REGISTRY_ID}.dkr.ecr.${ORB_STR_REGION}.amazonaws.com"
6+
ORB_STR_AWS_DOMAIN="$(echo "${ORB_STR_AWS_DOMAIN}" | circleci env subst)"
7+
ORB_VAL_ACCOUNT_URL="${!ORB_ENV_REGISTRY_ID}.dkr.ecr.${ORB_STR_REGION}.${ORB_STR_AWS_DOMAIN}"
78
ORB_STR_PUBLIC_REGISTRY_ALIAS="$(circleci env subst "${ORB_STR_PUBLIC_REGISTRY_ALIAS}")"
89
ORB_STR_EXTRA_BUILD_ARGS="$(echo "${ORB_STR_EXTRA_BUILD_ARGS}" | circleci env subst)"
910
ORB_EVAL_BUILD_PATH="$(eval echo "${ORB_EVAL_BUILD_PATH}")"

src/scripts/ecr_login.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
ORB_STR_REGION="$(circleci env subst "${ORB_STR_REGION}")"
33
ORB_STR_PROFILE_NAME="$(circleci env subst "${ORB_STR_PROFILE_NAME}")"
4-
ORB_VAL_ACCOUNT_URL="${!ORB_ENV_REGISTRY_ID}.dkr.ecr.${ORB_STR_REGION}.amazonaws.com"
4+
ORB_VAL_ACCOUNT_URL="${!ORB_ENV_REGISTRY_ID}.dkr.ecr.${ORB_STR_REGION}.${ORB_STR_AWS_DOMAIN}"
55
ECR_COMMAND="ecr"
66

77
if [ -z "${!ORB_ENV_REGISTRY_ID}" ]; then

src/scripts/push_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ORB_STR_REPO="$(circleci env subst "${ORB_STR_REPO}")"
33
ORB_STR_TAG="$(circleci env subst "${ORB_STR_TAG}")"
44
ORB_STR_REGION="$(circleci env subst "${ORB_STR_REGION}")"
5-
ORB_VAL_ACCOUNT_URL="${!ORB_ENV_REGISTRY_ID}.dkr.ecr.${ORB_STR_REGION}.amazonaws.com"
5+
ORB_VAL_ACCOUNT_URL="${!ORB_ENV_REGISTRY_ID}.dkr.ecr.${ORB_STR_REGION}.${ORB_STR_AWS_DOMAIN}"
66
ORB_STR_PUBLIC_REGISTRY_ALIAS="$(circleci env subst "${ORB_STR_PUBLIC_REGISTRY_ALIAS}")"
77

88
if [ -z "${!ORB_ENV_REGISTRY_ID}" ]; then

0 commit comments

Comments
 (0)