File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,13 @@ parameters:
26
26
description : AWS profile to use
27
27
type : string
28
28
29
+ extra_args :
30
+ type : string
31
+ default : " "
32
+ description : >
33
+ Extra flags to pass to AWS CLI.
34
+ Pass the desired args using an equal sign (=) instead of an space.
35
+ For example, --arg=ARG1, instead of --arg ARG1.
29
36
steps :
30
37
- run :
31
38
name : <<parameters.target_tag>> tag to <<parameters.repo>>:<<parameters.source_tag>>
35
42
AWS_ECR_STR_TARGET_TAG : <<parameters.target_tag>>
36
43
AWS_ECR_BOOL_SKIP_WHEN_TAGS_EXIST : <<parameters.skip_when_tags_exist>>
37
44
AWS_ECR_STR_AWS_PROFILE : <<parameters.profile_name>>
45
+ AWS_ECR_STR_EXTRA_ARGS : <<parameters.extra_args>>
38
46
command : <<include(scripts/tag_image.sh)>>
Original file line number Diff line number Diff line change @@ -13,18 +13,24 @@ if [ "${AWS_ECR_BOOL_SKIP_WHEN_TAGS_EXIST}" -eq 1 ]; then
13
13
fi
14
14
IFS=" ," read -ra ECR_TAGS <<< " ${AWS_ECR_EVAL_TARGET_TAG}"
15
15
16
+ extra_args=()
17
+ if [ -n " $AWS_ECR_STR_EXTRA_ARGS " ]; then
18
+ # shellcheck disable=SC2086
19
+ eval ' for p in ' $AWS_ECR_STR_EXTRA_ARGS ' ; do extra_args+=("$p"); done'
20
+ fi
21
+
16
22
for tag in " ${ECR_TAGS[@]} " ; do
17
23
# if skip_when_tags_exist is true
18
24
if [ " ${AWS_ECR_BOOL_SKIP_WHEN_TAGS_EXIST} " -eq 1 ]; then
19
25
# tag image if tag does not exist
20
26
if ! echo " ${EXISTING_TAGS} " | grep " ${tag} " ; then
21
- aws ecr put-image --repository-name " ${AWS_ECR_EVAL_REPO} " --image-tag " ${tag} " --image-manifest " ${MANIFEST} " --profile " ${AWS_ECR_EVAL_AWS_PROFILE} "
27
+ aws ecr put-image --repository-name " ${AWS_ECR_EVAL_REPO} " --image-tag " ${tag} " --image-manifest " ${MANIFEST} " " ${extra_args[@]} " --profile " ${AWS_ECR_EVAL_AWS_PROFILE} "
22
28
else
23
29
echo " Tag \" ${tag} \" already exists and will be skipped."
24
30
fi
25
31
# tag image when skip_when_tags_exist is false
26
32
else
27
- aws ecr put-image --repository-name " ${AWS_ECR_EVAL_REPO} " --image-tag " ${tag} " --image-manifest " ${MANIFEST} " --profile " ${AWS_ECR_EVAL_AWS_PROFILE} "
33
+ aws ecr put-image --repository-name " ${AWS_ECR_EVAL_REPO} " --image-tag " ${tag} " --image-manifest " ${MANIFEST} " " ${extra_args[@]} " --profile " ${AWS_ECR_EVAL_AWS_PROFILE} "
28
34
fi
29
35
done
30
36
set +x
You can’t perform that action at this time.
0 commit comments