From 11b3c797e04dcff6f07d6c1bc48053814dc61847 Mon Sep 17 00:00:00 2001 From: Stefan Scherer Date: Fri, 12 Feb 2016 10:29:15 +0100 Subject: [PATCH 1/3] Add HYPRIOT_IMAGE_VERSION --- .travis.yml | 1 + builder/build.sh | 19 ++++++++++--------- builder/chroot-script.sh | 7 +++---- .../spec/hypriotos-image/base/release_spec.rb | 3 ++- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 74ae860..2014837 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ script: branches: only: - master + - /^v\d.*$/ deploy: provider: releases api_key: diff --git a/builder/build.sh b/builder/build.sh index 43a3d14..a5873bb 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -13,18 +13,19 @@ BUILD_RESULT_PATH="/workspace" BUILD_PATH="/build" # where to store our base file system -ROOTFS_TAR_VERSION="v0.7.0" -ROOTFS_TAR="rootfs-armhf-${ROOTFS_TAR_VERSION}.tar.gz" +HYPRIOT_OS_VERSION="v0.7.1" +ROOTFS_TAR="rootfs-armhf-${HYPRIOT_OS_VERSION}.tar.gz" ROOTFS_TAR_PATH="$BUILD_RESULT_PATH/$ROOTFS_TAR" # size of root and boot partion ROOT_PARTITION_SIZE="800M" # device specific settings -IMAGE_VERSION=${VERSION:="dirty"} -IMAGE_NAME="sd-card-odroid-c1-${IMAGE_VERSION}.img" +HYPRIOT_IMAGE_VERSION=${VERSION:="dirty"} +HYPRIOT_IMAGE_NAME="sd-card-odroid-c1-${HYPRIOT_IMAGE_VERSION}.img" IMAGE_ROOTFS_PATH="/image-rootfs.tar.gz" QEMU_ARCH="arm" +export HYPRIOT_IMAGE_VERSION # specific versions of kernel/firmware and docker tools export DOCKER_ENGINE_VERSION="1.9.1-1" @@ -37,7 +38,7 @@ mkdir -p $BUILD_PATH # download our base root file system if [ ! -f $ROOTFS_TAR_PATH ]; then - wget -q -O $ROOTFS_TAR_PATH https://github.com/hypriot/os-rootfs/releases/download/$ROOTFS_TAR_VERSION/$ROOTFS_TAR + wget -q -O $ROOTFS_TAR_PATH https://github.com/hypriot/os-rootfs/releases/download/$HYPRIOT_OS_VERSION/$ROOTFS_TAR fi # extract root file system @@ -86,7 +87,7 @@ wget -q https://raw.githubusercontent.com/mdrjr/c1_uboot_binaries/master/u-boot. guestfish < "$BUILD_RESULT_PATH/$IMAGE_NAME.zip" +pigz --zip -c "$HYPRIOT_IMAGE_NAME" > "$BUILD_RESULT_PATH/$HYPRIOT_IMAGE_NAME.zip" # test sd-image that we have built -VERSION=${IMAGE_VERSION} rspec --format documentation --color /builder/test +VERSION=${HYPRIOT_IMAGE_VERSION} rspec --format documentation --color /builder/test diff --git a/builder/chroot-script.sh b/builder/chroot-script.sh index d43e0e5..6cee80b 100755 --- a/builder/chroot-script.sh +++ b/builder/chroot-script.sh @@ -42,7 +42,7 @@ DOCKER_OPTS=\"--storage-driver=aufs -D\"" /etc/default/docker # enable Docker systemd service systemctl enable docker -# --- install ODROID kernel --- +# install ODROID kernel apt-get install -y u-boot-tools initramfs-tools @@ -50,7 +50,6 @@ apt-get install -y u-boot-tools initramfs-tools touch /boot/uImage apt-get install -y linux-image-c1 -# --- - -# set device label +# set device label and version number echo "HYPRIOT_DEVICE=\"$HYPRIOT_DEVICE\"" >> /etc/os-release +echo "HYPRIOT_IMAGE_VERSION=\"$HYPRIOT_IMAGE_VERSION\"" >> /etc/os-release diff --git a/builder/test-integration/spec/hypriotos-image/base/release_spec.rb b/builder/test-integration/spec/hypriotos-image/base/release_spec.rb index 17c468f..261b543 100644 --- a/builder/test-integration/spec/hypriotos-image/base/release_spec.rb +++ b/builder/test-integration/spec/hypriotos-image/base/release_spec.rb @@ -4,6 +4,7 @@ it { should be_file } it { should be_owned_by 'root' } its(:content) { should match 'HYPRIOT_OS="HypriotOS/armhf"' } - its(:content) { should match 'HYPRIOT_TAG="v0.7.0"' } + its(:content) { should match 'HYPRIOT_TAG="v0.7.1"' } its(:content) { should match 'HYPRIOT_DEVICE="ODROID C1/C1+"' } + its(:content) { should match 'HYPRIOT_IMAGE_VERSION=' } end From f33a4a5eda7c76aa8e07607a9bbdd51b26f2392c Mon Sep 17 00:00:00 2001 From: Stefan Scherer Date: Fri, 12 Feb 2016 10:29:40 +0100 Subject: [PATCH 2/3] Use guestfish to support make test as well --- builder/test/os-release_spec.rb | 58 +++++++++++++++++++++------------ builder/test/spec_helper.rb | 2 +- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/builder/test/os-release_spec.rb b/builder/test/os-release_spec.rb index cc82c1a..b64d429 100644 --- a/builder/test/os-release_spec.rb +++ b/builder/test/os-release_spec.rb @@ -1,33 +1,49 @@ require_relative 'spec_helper' describe "Root filesystem" do - let(:rootfs_path) { return '/build' } + let(:stdout) { run_mounted("cat /etc/os-release").stdout } - it "exists" do - rootfs_dir = file(rootfs_path) - expect(rootfs_dir).to exist + it "is based on debian" do + expect(stdout).to contain('debian') end - context "Hypriot OS Release in /etc/os-release" do - let(:stdout) { command("cat #{rootfs_path}/etc/os-release").stdout } + it "is debian version jessie" do + expect(stdout).to contain('jessie') + end - it "has a HYPRIOT_OS= entry" do - expect(stdout).to contain('^HYPRIOT_OS=') - end - it "has a HYPRIOT_TAG= entry" do - expect(stdout).to contain('^HYPRIOT_TAG=') - end - it "has a HYPRIOT_DEVICE= entry" do - expect(stdout).to contain('^HYPRIOT_DEVICE=') - end + it "is a HypriotOS" do + expect(stdout).to contain('HypriotOS') + end - it "is for architecure 'HYPRIOT_OS=\"HypriotOS/armhf\"'" do - expect(stdout).to contain('^HYPRIOT_OS="HypriotOS/armhf"$') - end + it "has a HYPRIOT_OS= entry" do + expect(stdout).to contain('^HYPRIOT_OS=') + end + it "has a HYPRIOT_OS_VERSION= entry" do + expect(stdout).to contain('^HYPRIOT_OS_VERSION=') + end + it "has a HYPRIOT_DEVICE= entry" do + expect(stdout).to contain('^HYPRIOT_DEVICE=') + end + it "has a HYPRIOT_IMAGE_VERSION= entry" do + expect(stdout).to contain('^HYPRIOT_IMAGE_VERSION=') + end - it "is for device 'HYPRIOT_DEVICE=\"ODROID C1/C1+\"'" do - expect(stdout).to contain('^HYPRIOT_DEVICE="ODROID C1/C1\+"$') - end + it "is for architecure 'HYPRIOT_OS=\"HypriotOS/armhf\"'" do + expect(stdout).to contain('HYPRIOT_OS="HypriotOS/armhf"') + end + + it "is for device 'HYPRIOT_DEVICE=\"ODROID C1/C1+\"'" do + expect(stdout).to contain('HYPRIOT_DEVICE="ODROID C1/C1') + end + it "uses os-rootfs version 'HYPRIOT_OS_VERSION=\"v0.7.1\"'" do + expect(stdout).to contain('^HYPRIOT_OS_VERSION="v0.7.1"$') end + + if ENV.fetch('TRAVIS_TAG','') != '' + it "is not dirty" do + expect(stdout).not_to contain('dirty') + end + end + end diff --git a/builder/test/spec_helper.rb b/builder/test/spec_helper.rb index 62e30d3..24460fd 100644 --- a/builder/test/spec_helper.rb +++ b/builder/test/spec_helper.rb @@ -10,5 +10,5 @@ def run( cmd ) end def run_mounted( cmd ) - return run("mount /dev/sda2 / : #{cmd}") + return run("mount /dev/sda1 / : #{cmd}") end From 371818bcfac3e72d7c3455583a371532be9fceb5 Mon Sep 17 00:00:00 2001 From: Stefan Scherer Date: Fri, 12 Feb 2016 10:31:07 +0100 Subject: [PATCH 3/3] Add deployment steps --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index da0bb38..4d803b5 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,16 @@ BOARD=black-pearl.local make test-integration This test works with any Docker Machine, so you do not need to create the Vagrant box. +## Deployment + +For maintainers of this project you can release a new version and deploy the SD-Card image to GitHub releases with + +```bash +TAG=v0.0.1 make tag +``` + +After that open the GitHub release of this version and fill it with relevant changes and links to resolved issues. + ## License MIT - see the [LICENSE](./LICENSE) file for details.