blob: c4bbffd2abf66cefb5b9cd4ec78b5b4f947d6d5c [file] [log] [blame]
Paul Sokolovsky99466182022-12-19 22:15:36 +03001#!/bin/bash
2
3docker --version
4
5if ! type aws
6then
7 sudo apt-get -y -qq update
8 sudo apt-get -y -qq install --no-install-recommends unzip
9 curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
10 unzip awscliv2.zip
11 sudo ./aws/install
12fi
13
Paul Sokolovsky99466182022-12-19 22:15:36 +030014cd misra-dockerfiles
15
16aws configure list
Saheer Babu734d2ad2024-12-19 09:38:47 +000017export ECR=${PRIVATE_CONTAINER_REGISTRY}
Paul Sokolovsky99466182022-12-19 22:15:36 +030018# we are expecting private files to be kept in the dockerfiles/*
19# subdirs with a matching name for the image
Saheer Babu734d2ad2024-12-19 09:38:47 +000020aws s3 cp --recursive s3://openci-trustedfirmware-misra-${INFRA_ENV}/dockerfiles/ .
Paul Sokolovsky99466182022-12-19 22:15:36 +030021find .
Saheer Babu734d2ad2024-12-19 09:38:47 +000022aws ecr get-login-password --region eu-west-1|docker login --username AWS --password-stdin $ECR
Paul Sokolovsky99466182022-12-19 22:15:36 +030023
24
25was_error=0
26
27for image in ./*
28do
29 tag=$(basename $image)
30 test -d $image && test -f $image/build.sh && \
31 (
32 echo "=== Building image: misra:${tag} ==="
33 set -ex
34 touch /tmp/dckr-img-err
35 cd $image
36 ./build.sh
37 echo "Uploading image: misra:${tag}"
38 docker push $ECR/misra:$tag
39 rm -f /tmp/dckr-img-err
40 )
41
42 if [ -f /tmp/dckr-img-err ]; then
43 was_error=1
44 echo "ERROR building image: misra:${tag}"
45 fi
46done
47
48if [ "$was_error" == "1" ]; then
49 echo "---------------------------------"
50 echo "At least one image FAILED to build successfully. See the log above for ERRORs."
51 exit 1
52fi