Update tiny-instance image to contain branch name

With this patch branch is added to tiny-instance image name.

Also fixed a problem with BRANCH_PATH was set to refs/heads/master
after migration to zuulv3

Change-Id: I490e2d51a7c3fbc2cc0fa78a95b984874ab934f7
This commit is contained in:
Vasyl Saienko 2017-10-25 17:41:11 +03:00
parent 3699a403bb
commit 8bf0629749
6 changed files with 26 additions and 24 deletions

View File

@ -31,11 +31,11 @@ clean_build:
rm -f build_files/vmlinuz64
rm -f build_files/*.tcz
rm -f build_files/*.tcz.*
rm -f tiny-instance-part*.img
rm -f tiny-instance-uec*.tar.gz
clean_iso:
rm -rf newiso
rm -f build_files/syslinux-4.06.tar.gz
rm -rf build_files/syslinux-4.06
rm -f tinyipa.iso
rm -f tiny-instance-part.img
rm -f tiny-instance-uec.tar.gz

View File

@ -3,11 +3,10 @@
set -ex
WORKDIR=$(readlink -f $0 | xargs dirname)
DST_DIR=$(mktemp -d)
PARTIMG="$WORKDIR/tiny-instance-part.img"
UECFILE="$WORKDIR/tiny-instance-uec.tar.gz"
fs_type='ext4'
source ${WORKDIR}/common.sh
PARTIMG="$WORKDIR/tiny-instance-part${BRANCH_EXT}.img"
UECFILE="$WORKDIR/tiny-instance-uec${BRANCH_EXT}.tar.gz"
fs_type='ext4'
sudo rm -rf $PARTIMG $UECFILE
sudo truncate --size=150M $PARTIMG
@ -26,8 +25,8 @@ cleanup_tce $DST_DIR
sudo umount $DST_DIR/
pushd $DST_DIR/
cp $WORKDIR/tinyipa.gz $DST_DIR/tinyipa-initrd
cp $WORKDIR/tinyipa.vmlinuz $DST_DIR/tinyipa-vmlinuz
cp $WORKDIR/tinyipa${BRANCH_EXT}.gz $DST_DIR/tinyipa-initrd
cp $WORKDIR/tinyipa${BRANCH_EXT}.vmlinuz $DST_DIR/tinyipa-vmlinuz
cp $PARTIMG $DST_DIR/
tar -czf $UECFILE ./

View File

@ -3,6 +3,14 @@
WORKDIR=$(readlink -f $0 | xargs dirname)
source ${WORKDIR}/tc-mirror.sh
# Allow an extension to be added to the generated files by specifying
# $BRANCH_PATH e.g. export BRANCH_PATH=master results in tinyipa-master.gz etc
BRANCH_EXT=''
if [ -n "$BRANCH_PATH" ]; then
BRANCH_EXT="-$BRANCH_PATH"
fi
export BRANCH_EXT
TC=1001
STAFF=50

View File

@ -148,30 +148,23 @@ fi
# Delete unnecessary Babel .dat files
find $FINALDIR -path "*babel/locale-data/*.dat" -not -path "*en_US*" | sudo xargs --no-run-if-empty rm
# Allow an extension to be added to the generated files by specifying
# $BRANCH_PATH e.g. export BRANCH_PATH=master results in tinyipa-master.gz etc
branch_ext=''
if [ -n "$BRANCH_PATH" ]; then
branch_ext="-$BRANCH_PATH"
fi
# Rebuild build directory into gz file
( cd "$FINALDIR" && sudo find | sudo cpio -o -H newc | gzip -9 > "$WORKDIR/tinyipa${branch_ext}.gz" )
( cd "$FINALDIR" && sudo find | sudo cpio -o -H newc | gzip -9 > "$WORKDIR/tinyipa${BRANCH_EXT}.gz" )
# Copy vmlinuz to new name
cp "$WORKDIR/build_files/vmlinuz64" "$WORKDIR/tinyipa${branch_ext}.vmlinuz"
cp "$WORKDIR/build_files/vmlinuz64" "$WORKDIR/tinyipa${BRANCH_EXT}.vmlinuz"
# Create tar.gz containing tinyipa files
tar czf tinyipa${branch_ext}.tar.gz tinyipa${branch_ext}.gz tinyipa${branch_ext}.vmlinuz
tar czf tinyipa${BRANCH_EXT}.tar.gz tinyipa${BRANCH_EXT}.gz tinyipa${BRANCH_EXT}.vmlinuz
# Create sha256 files which will be uploaded by the publish jobs along with
# the tinyipa ones in order to provide a way to verify the integrity of the tinyipa
# builds.
for f in tinyipa${branch_ext}.{gz,tar.gz,vmlinuz}; do
for f in tinyipa${BRANCH_EXT}.{gz,tar.gz,vmlinuz}; do
sha256sum $f > $f.sha256
done
# Output files with sizes created by this script
echo "Produced files:"
du -h tinyipa${branch_ext}.gz tinyipa${branch_ext}.tar.gz tinyipa${branch_ext}.vmlinuz
echo "Checksums: " tinyipa${branch_ext}.*sha256
du -h tinyipa${BRANCH_EXT}.gz tinyipa${BRANCH_EXT}.tar.gz tinyipa${BRANCH_EXT}.vmlinuz
echo "Checksums: " tinyipa${BRANCH_EXT}.*sha256

View File

@ -47,7 +47,8 @@
set -e
set -x
BRANCH=$ZUUL_REFNAME
export BRANCH_PATH=`echo $BRANCH | tr / -`
# After migration to zuulv3 BRANCH now looks like refs/heads/master
export BRANCH_PATH=`echo $BRANCH | sed -e "s/refs\/heads\///" | tr / -`
mkdir UPLOAD_RAW
mkdir UPLOAD_TAR

View File

@ -47,7 +47,8 @@
set -e
set -x
BRANCH=$ZUUL_REFNAME
export BRANCH_PATH=`echo $BRANCH | tr / -`
# After migration to zuulv3 BRANCH now looks like refs/heads/master
export BRANCH_PATH=`echo $BRANCH | sed -e "s/refs\/heads\///" | tr / -`
mkdir UPLOAD_RAW
mkdir UPLOAD_TAR
@ -82,7 +83,7 @@
(cd imagebuild/tinyipa && make)
mv imagebuild/tinyipa/tinyipa*.tar.gz* UPLOAD_TAR
mv imagebuild/tinyipa/tinyipa*.* UPLOAD_RAW
mv imagebuild/tinyipa/tiny-instance-uec.tar.gz UPLOAD_RAW
mv imagebuild/tinyipa/tiny-instance-uec*.tar.gz UPLOAD_TAR
# NOTE(sambetts) Must clean up chroot directories before
# publisher rsync command tries and fails to read them
(cd imagebuild/tinyipa && make clean)