tf-ci-scripts: add support for IAR images

This adds support for the cleanup and building of the IAR
docker images that reside in a private repo.

It mirrors the work used for the misra docker images.

Change-Id: I7965b6bec555f8b11a8b3f23c8cf971005b03653
diff --git a/iar-docker-images/builders.sh b/iar-docker-images/builders.sh
new file mode 100755
index 0000000..19f7216
--- /dev/null
+++ b/iar-docker-images/builders.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+docker --version
+
+if ! type aws
+then
+    sudo apt-get -y -qq update
+    sudo apt-get -y -qq install --no-install-recommends unzip
+    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
+    unzip awscliv2.zip
+    sudo ./aws/install
+fi
+
+cd iar-dockerfiles
+
+aws configure list
+export ECR=987685672616.dkr.ecr.us-east-1.amazonaws.com
+# we are expecting private files to be kept in the dockerfiles/*
+# subdirs with a matching name for the image
+aws s3 cp --recursive s3://trustedfirmware-iar/dockerfiles/ .
+find .
+aws ecr get-login-password --region us-east-1|docker login --username AWS --password-stdin $ECR
+
+
+was_error=0
+
+for image in ./*
+do
+    tag=$(basename $image)
+    test -d $image  && test -f $image/build.sh && \
+    (
+        echo "=== Building image: iar:${tag} ==="
+        set -ex
+        touch /tmp/dckr-img-err
+        cd $image
+        ./build.sh
+        echo "Uploading image: iar:${tag}"
+        docker push $ECR/iar:$tag
+        rm -f /tmp/dckr-img-err
+    )
+
+    if [ -f /tmp/dckr-img-err ]; then
+        was_error=1
+        echo "ERROR building image: iar:${tag}"
+    fi
+done
+
+if [ "$was_error" == "1" ]; then
+    echo "---------------------------------"
+    echo "At least one image FAILED to build successfully. See the log above for ERRORs."
+    exit 1
+fi
diff --git a/iar-docker-images/update.sh b/iar-docker-images/update.sh
new file mode 100755
index 0000000..3f8fc34
--- /dev/null
+++ b/iar-docker-images/update.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -e
+
+docker --version
+
+if ! type aws
+then
+    sudo apt-get -y -qq update
+    sudo apt-get -y -qq install --no-install-recommends unzip
+    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
+    unzip awscliv2.zip
+    sudo ./aws/install
+fi
+
+aws configure list
+export ECR=987685672616.dkr.ecr.us-east-1.amazonaws.com
+export REPO=iar
+aws ecr get-login-password --region us-east-1|docker login --username AWS --password-stdin $ECR
+
+for image in $(aws ecr list-images --region us-east-1 --repository-name $REPO | \
+    grep imageTag | \
+    awk '{print $2}' | \
+    sed 's/"//g'); do
+
+    docker pull $ECR/$REPO:$image
+done