Skip to content
This repository was archived by the owner on Aug 14, 2023. It is now read-only.

Commit cfbb898

Browse files
committed
Merge pull request #22 from hypriot/add-hypriot-image-version
Add hypriot image version
2 parents c85adb3 + 371818b commit cfbb898

File tree

7 files changed

+64
-36
lines changed

7 files changed

+64
-36
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ script:
88
branches:
99
only:
1010
- master
11+
- /^v\d.*$/
1112
deploy:
1213
provider: releases
1314
api_key:

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ BOARD=black-pearl.local make test-integration
6262

6363
This test works with any Docker Machine, so you do not need to create the Vagrant box.
6464

65+
## Deployment
66+
67+
For maintainers of this project you can release a new version and deploy the SD-Card image to GitHub releases with
68+
69+
```bash
70+
TAG=v0.0.1 make tag
71+
```
72+
73+
After that open the GitHub release of this version and fill it with relevant changes and links to resolved issues.
74+
6575
## License
6676

6777
MIT - see the [LICENSE](./LICENSE) file for details.

builder/build.sh

+10-9
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@ BUILD_RESULT_PATH="/workspace"
1313
BUILD_PATH="/build"
1414

1515
# where to store our base file system
16-
ROOTFS_TAR_VERSION="v0.7.0"
17-
ROOTFS_TAR="rootfs-armhf-${ROOTFS_TAR_VERSION}.tar.gz"
16+
HYPRIOT_OS_VERSION="v0.7.1"
17+
ROOTFS_TAR="rootfs-armhf-${HYPRIOT_OS_VERSION}.tar.gz"
1818
ROOTFS_TAR_PATH="$BUILD_RESULT_PATH/$ROOTFS_TAR"
1919

2020
# size of root and boot partion
2121
ROOT_PARTITION_SIZE="800M"
2222

2323
# device specific settings
24-
IMAGE_VERSION=${VERSION:="dirty"}
25-
IMAGE_NAME="sd-card-odroid-c1-${IMAGE_VERSION}.img"
24+
HYPRIOT_IMAGE_VERSION=${VERSION:="dirty"}
25+
HYPRIOT_IMAGE_NAME="sd-card-odroid-c1-${HYPRIOT_IMAGE_VERSION}.img"
2626
IMAGE_ROOTFS_PATH="/image-rootfs.tar.gz"
2727
QEMU_ARCH="arm"
28+
export HYPRIOT_IMAGE_VERSION
2829

2930
# specific versions of kernel/firmware and docker tools
3031
export DOCKER_ENGINE_VERSION="1.9.1-1"
@@ -37,7 +38,7 @@ mkdir -p $BUILD_PATH
3738

3839
# download our base root file system
3940
if [ ! -f $ROOTFS_TAR_PATH ]; then
40-
wget -q -O $ROOTFS_TAR_PATH https://github.com/hypriot/os-rootfs/releases/download/$ROOTFS_TAR_VERSION/$ROOTFS_TAR
41+
wget -q -O $ROOTFS_TAR_PATH https://github.com/hypriot/os-rootfs/releases/download/$HYPRIOT_OS_VERSION/$ROOTFS_TAR
4142
fi
4243

4344
# extract root file system
@@ -86,7 +87,7 @@ wget -q https://raw.githubusercontent.com/mdrjr/c1_uboot_binaries/master/u-boot.
8687

8788
guestfish <<EOF
8889
# create new image disk
89-
sparse /$IMAGE_NAME $ROOT_PARTITION_SIZE
90+
sparse /$HYPRIOT_IMAGE_NAME $ROOT_PARTITION_SIZE
9091
run
9192
part-init /dev/sda mbr
9293
part-add /dev/sda primary 3072 -1
@@ -109,13 +110,13 @@ copy-file-to-device /boot/u-boot.bin /dev/sda destoffset:32768 sparse:true
109110
EOF
110111

111112
# log image partioning
112-
fdisk -l "/$IMAGE_NAME"
113+
fdisk -l "/$HYPRIOT_IMAGE_NAME"
113114

114115
# ensure that the travis-ci user can access the sd-card image file
115116
umask 0000
116117

117118
# compress image
118-
pigz --zip -c "$IMAGE_NAME" > "$BUILD_RESULT_PATH/$IMAGE_NAME.zip"
119+
pigz --zip -c "$HYPRIOT_IMAGE_NAME" > "$BUILD_RESULT_PATH/$HYPRIOT_IMAGE_NAME.zip"
119120

120121
# test sd-image that we have built
121-
VERSION=${IMAGE_VERSION} rspec --format documentation --color /builder/test
122+
VERSION=${HYPRIOT_IMAGE_VERSION} rspec --format documentation --color /builder/test

builder/chroot-script.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@ DOCKER_OPTS=\"--storage-driver=aufs -D\"" /etc/default/docker
4242
# enable Docker systemd service
4343
systemctl enable docker
4444

45-
# --- install ODROID kernel ---
45+
# install ODROID kernel
4646

4747
apt-get install -y u-boot-tools initramfs-tools
4848

4949
# make the kernel package create a copy of the current kernel here
5050
touch /boot/uImage
5151
apt-get install -y linux-image-c1
5252

53-
# ---
54-
55-
# set device label
53+
# set device label and version number
5654
echo "HYPRIOT_DEVICE=\"$HYPRIOT_DEVICE\"" >> /etc/os-release
55+
echo "HYPRIOT_IMAGE_VERSION=\"$HYPRIOT_IMAGE_VERSION\"" >> /etc/os-release

builder/test-integration/spec/hypriotos-image/base/release_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
it { should be_file }
55
it { should be_owned_by 'root' }
66
its(:content) { should match 'HYPRIOT_OS="HypriotOS/armhf"' }
7-
its(:content) { should match 'HYPRIOT_TAG="v0.7.0"' }
7+
its(:content) { should match 'HYPRIOT_TAG="v0.7.1"' }
88
its(:content) { should match 'HYPRIOT_DEVICE="ODROID C1/C1+"' }
9+
its(:content) { should match 'HYPRIOT_IMAGE_VERSION=' }
910
end

builder/test/os-release_spec.rb

+37-21
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
11
require_relative 'spec_helper'
22

33
describe "Root filesystem" do
4-
let(:rootfs_path) { return '/build' }
4+
let(:stdout) { run_mounted("cat /etc/os-release").stdout }
55

6-
it "exists" do
7-
rootfs_dir = file(rootfs_path)
8-
expect(rootfs_dir).to exist
6+
it "is based on debian" do
7+
expect(stdout).to contain('debian')
98
end
109

11-
context "Hypriot OS Release in /etc/os-release" do
12-
let(:stdout) { command("cat #{rootfs_path}/etc/os-release").stdout }
10+
it "is debian version jessie" do
11+
expect(stdout).to contain('jessie')
12+
end
1313

14-
it "has a HYPRIOT_OS= entry" do
15-
expect(stdout).to contain('^HYPRIOT_OS=')
16-
end
17-
it "has a HYPRIOT_TAG= entry" do
18-
expect(stdout).to contain('^HYPRIOT_TAG=')
19-
end
20-
it "has a HYPRIOT_DEVICE= entry" do
21-
expect(stdout).to contain('^HYPRIOT_DEVICE=')
22-
end
14+
it "is a HypriotOS" do
15+
expect(stdout).to contain('HypriotOS')
16+
end
2317

24-
it "is for architecure 'HYPRIOT_OS=\"HypriotOS/armhf\"'" do
25-
expect(stdout).to contain('^HYPRIOT_OS="HypriotOS/armhf"$')
26-
end
18+
it "has a HYPRIOT_OS= entry" do
19+
expect(stdout).to contain('^HYPRIOT_OS=')
20+
end
21+
it "has a HYPRIOT_OS_VERSION= entry" do
22+
expect(stdout).to contain('^HYPRIOT_OS_VERSION=')
23+
end
24+
it "has a HYPRIOT_DEVICE= entry" do
25+
expect(stdout).to contain('^HYPRIOT_DEVICE=')
26+
end
27+
it "has a HYPRIOT_IMAGE_VERSION= entry" do
28+
expect(stdout).to contain('^HYPRIOT_IMAGE_VERSION=')
29+
end
2730

28-
it "is for device 'HYPRIOT_DEVICE=\"ODROID C1/C1+\"'" do
29-
expect(stdout).to contain('^HYPRIOT_DEVICE="ODROID C1/C1\+"$')
30-
end
31+
it "is for architecure 'HYPRIOT_OS=\"HypriotOS/armhf\"'" do
32+
expect(stdout).to contain('HYPRIOT_OS="HypriotOS/armhf"')
33+
end
34+
35+
it "is for device 'HYPRIOT_DEVICE=\"ODROID C1/C1+\"'" do
36+
expect(stdout).to contain('HYPRIOT_DEVICE="ODROID C1/C1')
37+
end
3138

39+
it "uses os-rootfs version 'HYPRIOT_OS_VERSION=\"v0.7.1\"'" do
40+
expect(stdout).to contain('^HYPRIOT_OS_VERSION="v0.7.1"$')
3241
end
42+
43+
if ENV.fetch('TRAVIS_TAG','') != ''
44+
it "is not dirty" do
45+
expect(stdout).not_to contain('dirty')
46+
end
47+
end
48+
3349
end

builder/test/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ def run( cmd )
1010
end
1111

1212
def run_mounted( cmd )
13-
return run("mount /dev/sda2 / : #{cmd}")
13+
return run("mount /dev/sda1 / : #{cmd}")
1414
end

0 commit comments

Comments
 (0)