Skip to content

Commit 23d7b6e

Browse files
committed
Use fetch tool to download GitHub release artifacts
1 parent 7981f2b commit 23d7b6e

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ RUN apt-get update && \
88
--no-install-recommends && \
99
rm -rf /var/lib/apt/lists/*
1010

11+
ADD https://github.com/gruntwork-io/fetch/releases/download/v0.1.0/fetch_linux_amd64 /usr/local/bin/fetch
12+
RUN chmod +x /usr/local/bin/fetch
13+
1114
COPY builder/ /builder/
1215

1316
# build sd card image

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ build:
44
docker build -t image-builder-rpi64 .
55

66
sd-image: build
7-
docker run --rm --privileged -v $(shell pwd):/workspace -v /boot:/boot -v /lib/modules:/lib/modules -e TRAVIS_TAG -e VERSION image-builder-rpi64
7+
docker run --rm --privileged -v $(shell pwd):/workspace -v /boot:/boot -v /lib/modules:/lib/modules -e TRAVIS_TAG -e VERSION -e "GITHUB_OAUTH_TOKEN=${GITHUB_TOKEN}" image-builder-rpi64
88

99
shell: build
10-
docker run -ti --privileged -v $(shell pwd):/workspace -v /boot:/boot -v /lib/modules:/lib/modules -e TRAVIS_TAG -e VERSION image-builder-rpi64 bash
10+
docker run -ti --privileged -v $(shell pwd):/workspace -v /boot:/boot -v /lib/modules:/lib/modules -e TRAVIS_TAG -e VERSION -e "GITHUB_OAUTH_TOKEN=${GITHUB_TOKEN}" image-builder-rpi64 bash
1111

1212
test:
1313
VERSION=dirty docker run --rm -ti --privileged -v $(shell pwd):/workspace -v /boot:/boot -v /lib/modules:/lib/modules -e TRAVIS_TAG -e VERSION image-builder-rpi64 bash -c "unzip /workspace/hypriotos-rpi-dirty.img.zip && rspec --format documentation --color /workspace/builder/test/*_spec.rb"

builder/build.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,25 @@ if [ ! -f "${ROOTFS_TAR_PATH}" ]; then
3737
wget -q -O "${ROOTFS_TAR_PATH}" "https://github.com/hypriot/os-rootfs/releases/download/${HYPRIOT_OS_VERSION}/${ROOTFS_TAR}"
3838
fi
3939

40-
# # verify checksum of our root filesystem
40+
# verify checksum of our root filesystem
4141
echo "${ROOTFS_TAR_CHECKSUM} ${ROOTFS_TAR_PATH}" | sha256sum -c -
4242

4343
# extract root file system
4444
tar xf "${ROOTFS_TAR_PATH}" -C "${BUILD_PATH}"
4545

4646
# extract/add additional files
47-
wget -q -O - "https://github.com/DieterReuter/rpi-bootloader/releases/download/v$BOOTLOADER_BUILD/rpi-bootloader.tar.gz" | tar -xf - -C "${BUILD_PATH}"
48-
wget -q -O - "https://github.com/DieterReuter/rpi64-kernel/releases/download/v$KERNEL_BUILD/$KERNEL_VERSION-bee42-v8.tar.gz" | tar -xf - -C "${BUILD_PATH}"
47+
FILENAME=/workspace/rpi-bootloader.tar.gz
48+
if [ ! -f "$FILENAME" ]; then
49+
fetch --repo="https://github.com/DieterReuter/rpi-bootloader" --tag="v$BOOTLOADER_BUILD" --release-asset="rpi-bootloader.tar.gz.sha256" /workspace
50+
fetch --repo="https://github.com/DieterReuter/rpi-bootloader" --tag="v$BOOTLOADER_BUILD" --release-asset="rpi-bootloader.tar.gz" /workspace
51+
fi
52+
tar -xf "$FILENAME" -C "${BUILD_PATH}"
53+
FILENAME=/workspace/$KERNEL_VERSION-bee42-v8.tar.gz
54+
if [ ! -f "$FILENAME" ]; then
55+
fetch --repo="https://github.com/DieterReuter/rpi64-kernel" --tag="v$KERNEL_BUILD" --release-asset="$KERNEL_VERSION-bee42-v8.tar.gz.sha256" /workspace
56+
fetch --repo="https://github.com/DieterReuter/rpi64-kernel" --tag="v$KERNEL_BUILD" --release-asset="$KERNEL_VERSION-bee42-v8.tar.gz" /workspace
57+
fi
58+
tar -xf "$FILENAME" -C "${BUILD_PATH}"
4959
DOCKER_DEB="/workspace/resources/docker-engine_1.13.0~rc7-0~debian-jessie_arm64.deb"
5060
if [ -f "$DOCKER_DEB" ]; then
5161
cp $DOCKER_DEB "${BUILD_PATH}"/

0 commit comments

Comments
 (0)