blob: 290da852714942c660d7c3ca173e733aee459626 [file] [log] [blame]
Kelley Spoon09c3f242022-08-29 06:13:12 -05001#!/bin/bash
2
Paul Sokolovsky8d0747b2022-09-27 15:13:01 +03003docker --version
4
Kelley Spoon09c3f242022-08-29 06:13:12 -05005if ! 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
14rm -rf misra-dockerfiles
15git clone https://git.trustedfirmware.org/ci/misra-dockerfiles.git
16cd misra-dockerfiles
17
18aws configure list
Paul Sokolovskyc4b1a1f2022-09-08 11:55:19 +030019export ECR=987685672616.dkr.ecr.us-east-1.amazonaws.com
Kelley Spoon09c3f242022-08-29 06:13:12 -050020# we are expecting private files to be kept in the dockerfiles/*
21# subdirs with a matching name for the image
Kelley Spoon98518e02022-09-08 14:30:41 -050022aws s3 cp --recursive s3://trustedfirmware-misra/dockerfiles/ .
23find .
Kelley Spoon09c3f242022-08-29 06:13:12 -050024aws ecr get-login-password --region us-east-1|docker login --username AWS --password-stdin $ECR
25
26
Paul Sokolovskyd5255b42022-10-05 20:11:54 +030027was_error=0
28
Kelley Spoon09c3f242022-08-29 06:13:12 -050029for image in ./*
30do
Kelley Spoon98518e02022-09-08 14:30:41 -050031 tag=$(basename $image)
Paul Sokolovsky682184c2022-09-08 11:49:14 +030032 test -d $image && test -f $image/build.sh && \
Kelley Spoon09c3f242022-08-29 06:13:12 -050033 (
34 set -ex
Paul Sokolovskyd5255b42022-10-05 20:11:54 +030035 touch /tmp/dckr-img-err
Paul Sokolovskyaafb3322022-09-27 14:40:17 +030036 echo "============================"
Kelley Spoon98518e02022-09-08 14:30:41 -050037 echo "Building image: misra:${tag}"
Kelley Spoon09c3f242022-08-29 06:13:12 -050038 cd $image
39 ./build.sh
Kelley Spoon98518e02022-09-08 14:30:41 -050040 echo "Upoading image: misra:${tag}"
41 docker push $ECR/misra:$tag
Paul Sokolovskyd5255b42022-10-05 20:11:54 +030042 rm -f /tmp/dckr-img-err
Kelley Spoon09c3f242022-08-29 06:13:12 -050043 )
Paul Sokolovskyd5255b42022-10-05 20:11:54 +030044
45 if [ -f /tmp/dckr-img-err ]; then
46 was_error=1
47 fi
Kelley Spoon09c3f242022-08-29 06:13:12 -050048done
Paul Sokolovskyd5255b42022-10-05 20:11:54 +030049
50if [ "$was_error" == "1" ]; then
51 echo "At least one image failed to build successfully. See the log above for errors."
52 exit 1
53fi