2016-06-30 15:54:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
date=$(date +'%Y%m%d' -u)
|
2016-07-08 04:04:23 +00:00
|
|
|
JENKINS_PERSISTENT_WORKDIR=${1:-/var/lib/yocto}
|
|
|
|
DL_DIR="$JENKINS_PERSISTENT_WORKDIR/shared-downloads"
|
2016-07-05 15:13:55 +00:00
|
|
|
# MACHINE_LIST: generic-x86-64 generic-x86 generic-armv6 generic-armv7hf generic-armv5
|
|
|
|
# MACHINE_LIST should be set in jenkins config
|
2016-06-30 15:54:17 +00:00
|
|
|
|
|
|
|
git submodule update --init --recursive
|
|
|
|
rm -rf dest
|
|
|
|
mkdir dest
|
|
|
|
|
|
|
|
docker build -t supervisor-base-builder .
|
2016-07-05 15:13:55 +00:00
|
|
|
for machine in $MACHINE_LIST; do
|
2016-07-08 02:54:02 +00:00
|
|
|
case "$machine" in
|
2016-07-05 15:13:55 +00:00
|
|
|
'generic-x86-64')
|
|
|
|
REPO='resin/amd64-supervisor-base'
|
|
|
|
;;
|
|
|
|
'generic-x86')
|
|
|
|
REPO='resin/i386-supervisor-base'
|
|
|
|
;;
|
|
|
|
'generic-armv6')
|
2016-07-10 03:57:00 +00:00
|
|
|
REPO='resin/rpi-supervisor-base'
|
2016-07-05 15:13:55 +00:00
|
|
|
;;
|
|
|
|
'generic-armv7hf')
|
|
|
|
REPO='resin/armv7hf-supervisor-base'
|
|
|
|
;;
|
|
|
|
'generic-armv5')
|
|
|
|
REPO='resin/armel-supervisor-base'
|
|
|
|
;;
|
|
|
|
esac
|
2016-07-08 04:04:23 +00:00
|
|
|
SSTATE_DIR="$JENKINS_PERSISTENT_WORKDIR/$machine/sstate"
|
|
|
|
# Make sure shared directories are in place
|
|
|
|
mkdir -p $DL_DIR
|
|
|
|
mkdir -p $SSTATE_DIR
|
|
|
|
|
2016-07-05 15:13:55 +00:00
|
|
|
docker run --rm \
|
|
|
|
-e TARGET_MACHINE=$machine \
|
2016-07-08 04:04:23 +00:00
|
|
|
-e BUILDER_UID=$(id -u) \
|
|
|
|
-e BUILDER_GID=$(id -g) \
|
2016-07-05 15:13:55 +00:00
|
|
|
-v `pwd`:/source \
|
2016-07-08 04:04:23 +00:00
|
|
|
-v $DL_DIR:/yocto/shared-downloads \
|
|
|
|
-v $SSTATE_DIR:/yocto/shared-sstate \
|
2016-07-05 15:13:55 +00:00
|
|
|
-v `pwd`/dest:/dest \
|
|
|
|
supervisor-base-builder
|
|
|
|
if [ -f dest/rootfs.tar.gz ]; then
|
|
|
|
docker import dest/rootfs.tar.gz $REPO:$date
|
|
|
|
docker tag -f $REPO:$date $REPO:latest
|
|
|
|
docker push $REPO
|
|
|
|
else
|
|
|
|
echo "rootfs is missing!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
done
|