Skip to content

Commit

Permalink
Use fetch tool to download GitHub release artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterReuter committed Jan 17, 2017
1 parent 7981f2b commit 23d7b6e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ RUN apt-get update && \
--no-install-recommends && \
rm -rf /var/lib/apt/lists/*

ADD https://github.com/gruntwork-io/fetch/releases/download/v0.1.0/fetch_linux_amd64 /usr/local/bin/fetch
RUN chmod +x /usr/local/bin/fetch

COPY builder/ /builder/

# build sd card image
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ build:
docker build -t image-builder-rpi64 .

sd-image: build
docker run --rm --privileged -v $(shell pwd):/workspace -v /boot:/boot -v /lib/modules:/lib/modules -e TRAVIS_TAG -e VERSION image-builder-rpi64
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

shell: build
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
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

test:
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"
Expand Down
16 changes: 13 additions & 3 deletions builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,25 @@ if [ ! -f "${ROOTFS_TAR_PATH}" ]; then
wget -q -O "${ROOTFS_TAR_PATH}" "https://github.com/hypriot/os-rootfs/releases/download/${HYPRIOT_OS_VERSION}/${ROOTFS_TAR}"
fi

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

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

# extract/add additional files
wget -q -O - "https://github.com/DieterReuter/rpi-bootloader/releases/download/v$BOOTLOADER_BUILD/rpi-bootloader.tar.gz" | tar -xf - -C "${BUILD_PATH}"
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}"
FILENAME=/workspace/rpi-bootloader.tar.gz
if [ ! -f "$FILENAME" ]; then
fetch --repo="https://github.com/DieterReuter/rpi-bootloader" --tag="v$BOOTLOADER_BUILD" --release-asset="rpi-bootloader.tar.gz.sha256" /workspace
fetch --repo="https://github.com/DieterReuter/rpi-bootloader" --tag="v$BOOTLOADER_BUILD" --release-asset="rpi-bootloader.tar.gz" /workspace
fi
tar -xf "$FILENAME" -C "${BUILD_PATH}"
FILENAME=/workspace/$KERNEL_VERSION-bee42-v8.tar.gz
if [ ! -f "$FILENAME" ]; then
fetch --repo="https://github.com/DieterReuter/rpi64-kernel" --tag="v$KERNEL_BUILD" --release-asset="$KERNEL_VERSION-bee42-v8.tar.gz.sha256" /workspace
fetch --repo="https://github.com/DieterReuter/rpi64-kernel" --tag="v$KERNEL_BUILD" --release-asset="$KERNEL_VERSION-bee42-v8.tar.gz" /workspace
fi
tar -xf "$FILENAME" -C "${BUILD_PATH}"
DOCKER_DEB="/workspace/resources/docker-engine_1.13.0~rc7-0~debian-jessie_arm64.deb"
if [ -f "$DOCKER_DEB" ]; then
cp $DOCKER_DEB "${BUILD_PATH}"/
Expand Down

0 comments on commit 23d7b6e

Please sign in to comment.