@@ -73,11 +73,8 @@ gamma_account_id="626332813196"
7373
7474DOCKER_HUB_SECRET=" com.amazonaws.dockerhub.aws-for-fluent-bit.credentials"
7575
76- ARCHITECTURES=(" amd64" " arm64" )
77-
7876publish_to_docker_hub () {
7977 DRY_RUN=" ${DRY_RUN:- true} "
80- export DOCKER_CLI_EXPERIMENTAL=enabled
8178
8279 username=" $( aws secretsmanager get-secret-value --secret-id $DOCKER_HUB_SECRET --region us-west-2 | jq -r ' .SecretString | fromjson.username' ) "
8380 password=" $( aws secretsmanager get-secret-value --secret-id $DOCKER_HUB_SECRET --region us-west-2 | jq -r ' .SecretString | fromjson.password' ) "
@@ -93,23 +90,13 @@ publish_to_docker_hub() {
9390
9491 # Publish to DockerHub only if $DRY_RUN is set to false
9592 if [[ " ${DRY_RUN} " == " false" ]]; then
96- for arch in " ${ARCHITECTURES[@]} "
97- do
98- docker tag ${1} :" $arch " ${1} :" ${arch} " -${AWS_FOR_FLUENT_BIT_VERSION}
99- docker push ${1} :" $arch " -${AWS_FOR_FLUENT_BIT_VERSION}
100- done
101-
102- create_manifest_list ${1} " latest"
103- create_manifest_list ${1} ${AWS_FOR_FLUENT_BIT_VERSION}
104-
93+ docker tag ${1} ${2}
94+ docker push ${1}
95+ docker push ${2}
10596 else
106- for arch in " ${ARCHITECTURES[@]} "
107- do
108- echo " DRY_RUN: docker tag ${1} :${arch} ${1} :${arch} -${AWS_FOR_FLUENT_BIT_VERSION} "
109- echo " DRY_RUN: docker push ${1} :${arch} -${AWS_FOR_FLUENT_BIT_VERSION} "
110- done
111- echo " DRY_RUN: create manifest list ${1} :latest"
112- echo " DRY_RUN: create manifest list ${1} :${AWS_FOR_FLUENT_BIT_VERSION} "
97+ echo " DRY_RUN: docker tag ${1} ${2} "
98+ echo " DRY_RUN: docker push ${1} "
99+ echo " DRY_RUN: docker push ${2} "
113100 echo " DRY_RUN is NOT set to 'false', skipping DockerHub update. Exiting..."
114101 fi
115102
@@ -186,41 +173,11 @@ verify_ssm() {
186173 fi
187174}
188175
189- create_manifest_list () {
190-
191- export DOCKER_CLI_EXPERIMENTAL=enabled
192- tag=${2}
193-
194- # TODO: Add a way to automatically generate arch images in manifest
195- docker manifest create ${1} :${tag} \
196- ${1} :arm64-${AWS_FOR_FLUENT_BIT_VERSION} \
197- ${1} :amd64-${AWS_FOR_FLUENT_BIT_VERSION}
198-
199- for arch in " ${ARCHITECTURES[@]} "
200- do
201- docker manifest annotate --arch " $arch " \
202- ${1} :${tag} \
203- ${1} :" $arch " -${AWS_FOR_FLUENT_BIT_VERSION}
204- done
205-
206- # sanity check on the debug log.
207- docker manifest inspect ${1} :${tag}
208- docker manifest push ${1} :${tag}
209- }
210-
211- push_image_ecr () {
212- account_id=${1}
213- region=${2}
214-
215- for arch in " ${ARCHITECTURES[@]} "
216- do
217- docker tag ${AWS_ACCOUNT} .dkr.ecr.${AWS_REGION} .amazonaws.com/amazon/aws-for-fluent-bit-test:" $arch " \
218- ${account_id} .dkr.ecr.${region} .amazonaws.com/aws-for-fluent-bit:" $arch " -${AWS_FOR_FLUENT_BIT_VERSION}
219- docker push ${account_id} .dkr.ecr.${region} .amazonaws.com/aws-for-fluent-bit:" $arch " -${AWS_FOR_FLUENT_BIT_VERSION}
220- done
176+ push_to_ecr () {
177+ docker tag ${1} ${2}
178+ ecs-cli push ${2} --region ${3} --registry-id ${4}
221179}
222180
223- # TODO: remove dependency on ecs-cli
224181pull_ecr () {
225182 ecs-cli pull ${1} --region ${2}
226183}
@@ -232,17 +189,8 @@ make_repo_public() {
232189publish_ecr () {
233190 region=${1}
234191 account_id=${2}
235- echo $region
236- echo $account_id
237-
238- aws ecr get-login-password --region ${region} | docker login --username AWS --password-stdin ${account_id} .dkr.ecr.${region} .amazonaws.com
239- aws ecr create-repository --repository-name aws-for-fluent-bit --image-scanning-configuration scanOnPush=true --region ${region} || true
240-
241- push_image_ecr ${account_id} ${region}
242-
243- create_manifest_list ${account_id} .dkr.ecr.${region} .amazonaws.com/aws-for-fluent-bit ${AWS_FOR_FLUENT_BIT_VERSION}
244- create_manifest_list ${account_id} .dkr.ecr.${region} .amazonaws.com/aws-for-fluent-bit " latest"
245-
192+ push_to_ecr amazon/aws-for-fluent-bit:latest aws-for-fluent-bit:latest ${region} ${account_id}
193+ push_to_ecr amazon/aws-for-fluent-bit:latest " aws-for-fluent-bit:${AWS_FOR_FLUENT_BIT_VERSION} " ${region} ${account_id}
246194 make_repo_public ${region}
247195}
248196
@@ -256,15 +204,14 @@ verify_ecr() {
256204 endpoint=${endpoint} .cn
257205 fi
258206
259- aws ecr get-login-password --region ${region} | docker login --username AWS --password-stdin ${account_id} .dkr.ecr.${region} .amazonaws.com
260- docker pull ${account_id} .dkr.ecr.${region} .${endpoint} /aws-for-fluent-bit:latest
207+ pull_ecr ${account_id} .dkr.ecr.${region} .${endpoint} /aws-for-fluent-bit:latest ${region}
261208 sha1=$( docker inspect --format=' {{index .RepoDigests 0}}' ${account_id} .dkr.ecr.${region} .${endpoint} /aws-for-fluent-bit:latest)
262209
263210 if [ " ${is_sync_task} " = " true" ]; then
264211 pull_ecr ${account_id} .dkr.ecr.${region} .${endpoint} /aws-for-fluent-bit:${AWS_FOR_FLUENT_BIT_VERSION_DOCKERHUB} ${region}
265212 sha2=$( docker inspect --format=' {{index .RepoDigests 0}}' ${account_id} .dkr.ecr.${region} .${endpoint} /aws-for-fluent-bit:${AWS_FOR_FLUENT_BIT_VERSION_DOCKERHUB} )
266213 else
267- docker pull ${account_id} .dkr.ecr.${region} .${endpoint} /aws-for-fluent-bit:${AWS_FOR_FLUENT_BIT_VERSION}
214+ pull_ecr ${account_id} .dkr.ecr.${region} .${endpoint} /aws-for-fluent-bit:${AWS_FOR_FLUENT_BIT_VERSION} ${region }
268215 sha2=$( docker inspect --format=' {{index .RepoDigests 0}}' ${account_id} .dkr.ecr.${region} .${endpoint} /aws-for-fluent-bit:${AWS_FOR_FLUENT_BIT_VERSION} )
269216 fi
270217
@@ -312,7 +259,7 @@ match_two_sha() {
312259
313260if [ " ${1} " = " publish" ]; then
314261 if [ " ${2} " = " dockerhub" ]; then
315- publish_to_docker_hub amazon/aws-for-fluent-bit
262+ publish_to_docker_hub amazon/aws-for-fluent-bit:latest amazon/aws-for-fluent-bit: ${AWS_FOR_FLUENT_BIT_VERSION}
316263 fi
317264
318265 if [ " ${2} " = " aws" ]; then
470417# Following scripts will be called only from the CI/CD pipeline
471418if [ " ${1} " = " cicd-publish" ]; then
472419 if [ " ${2} " = " dockerhub" ]; then
473- publish_to_docker_hub amazon/aws-for-fluent-bit
420+ publish_to_docker_hub amazon/aws-for-fluent-bit:latest amazon/aws-for-fluent-bit: ${AWS_FOR_FLUENT_BIT_VERSION}
474421 elif [ " ${2} " = " us-gov-east-1" ] || [ " ${2} " = " us-gov-west-1" ]; then
475422 for region in ${gov_regions} ; do
476423 sync_latest_image ${region} ${gov_regions_account_id}
@@ -549,4 +496,4 @@ if [ "${1}" = "cicd-verify-ssm" ]; then
549496 verify_ssm ${region}
550497 done
551498 fi
552- fi
499+ fi
0 commit comments