next/ci/tf-ci-scripts/misra-docker-images: add support for misra ECR
This change adds in support for automating the build of docker images
related to MISRA.
Dockerfiles are expected to be found in the ci/misra-dockerfiles
repository organized into directories that match the image's tag
name.
Private files are expected to be found in s3 under the dockerfiles/tag
name folder.
Signed-off-by: Kelley Spoon <kelley.spoon@linaro.org>
Change-Id: I2148d11527d94705cccfdf7a478672077c09fa0a
diff --git a/misra-docker-images.yaml b/misra-docker-images.yaml
new file mode 100644
index 0000000..67e36a7
--- /dev/null
+++ b/misra-docker-images.yaml
@@ -0,0 +1,22 @@
+- job:
+ name: misra-docker-images
+ project-type: freestyle
+ defaults: global
+ properties:
+ - authorization:
+ anonymous:
+ - job-read
+ - job-extended-read
+ - build-discarder:
+ days-to-keep: 90
+ num-to-keep: 200
+ disabled: false
+ node: build-amd64-private
+ concurrent: false
+ display-name: 'MISRA Docker images build'
+ builders:
+ - shell:
+ !include-raw: misra-docker-images/builders.sh
+ publishers:
+ - email:
+ recipients: linaro-infrastructure-errors@lists.linaro.org
diff --git a/misra-docker-images/builders.sh b/misra-docker-images/builders.sh
new file mode 100644
index 0000000..1a607e8
--- /dev/null
+++ b/misra-docker-images/builders.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+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
+
+rm -rf misra-dockerfiles
+git clone https://git.trustedfirmware.org/ci/misra-dockerfiles.git
+cd misra-dockerfiles
+
+aws configure list
+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-misra/dockerfiles/ ./misra-dockerfiles
+aws ecr get-login-password --region us-east-1|docker login --username AWS --password-stdin $ECR
+
+
+for image in ./*
+do
+ test [ -d $image ] && test [ -f $image/build.sh ] && \
+ (
+ set -ex
+ echo "Building image: misra:$${image}"
+ cd $image
+ ./build.sh
+ echo "Upoading image: misra:$${image}"
+ docker push $ECR/misra:image$
+ )
+done