diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fb85e79..a89656d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! This project adheres to [Semantic Versioning](http://semver.org/). +## v6.4.1 - 2017-11-02 + +* Improve caching when building gosuper #520 [Pablo Carranza Velez] +* Automation: Always try to cache using the latest master build #520 [Pablo Carranza Velez] + ## v6.4.0 - 2017-11-01 * Fixes #511, add support for new supervisor image for x86 with quark cpu boards. #512 [Trong Nghia Nguyen] diff --git a/Dockerfile b/Dockerfile index 4e1a6c15..ff65cf09 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,6 @@ RUN cd /source && bash -ex build.sh # Build golang supervisor FROM debian:jessie-20170723 as gosuper -ARG ARCH RUN apt-get update \ && apt-get install -y \ @@ -95,6 +94,7 @@ WORKDIR /go/src/resin-supervisor/gosuper ENV GOOS linux ENV GO386=387 +ARG ARCH RUN bash ./build.sh RUN rsync -a --delete /go/bin/gosuper /build/ diff --git a/automation/build.sh b/automation/build.sh index 257e19a9..2c92b8c2 100755 --- a/automation/build.sh +++ b/automation/build.sh @@ -62,36 +62,29 @@ BASE_CACHE=$BASE_IMAGE GO_CACHE=$GO_IMAGE NODE_CACHE=$NODE_IMAGE +TARGET_CACHE_MASTER=resin/$ARCH-supervisor:master +BASE_CACHE_MASTER=resin/$ARCH-supervisor-base:master +GO_CACHE_MASTER=resin/$ARCH-supervisor-go:master +NODE_CACHE_MASTER=resin/$ARCH-supervisor-node:master + CACHE_FROM="" +function tryPullForCache() { + image=$1 + docker pull $image && { + CACHE_FROM="$CACHE_FROM --cache-from $image" + } || true +} + # Attempt to pull images for cache # Only if the pull succeeds we add a --cache-from option -docker pull $TARGET_CACHE || { - TARGET_CACHE=resin/$ARCH-supervisor:master - docker pull $TARGET_CACHE -} && { - CACHE_FROM="$CACHE_FROM --cache-from $TARGET_CACHE" -} || true - -docker pull $BASE_CACHE || { - BASE_CACHE=resin/$ARCH-supervisor-base:master - docker pull $BASE_CACHE -} && { - CACHE_FROM="$CACHE_FROM --cache-from $BASE_CACHE" -} || true - -docker pull $NODE_CACHE || { - NODE_CACHE=resin/$ARCH-supervisor-node:master - docker pull $NODE_CACHE -} && { - CACHE_FROM="$CACHE_FROM --cache-from $NODE_CACHE" -} || true - -docker pull $GO_CACHE || { - GO_CACHE=resin/$ARCH-supervisor-go:master - docker pull $GO_CACHE -} && { - CACHE_FROM="$CACHE_FROM --cache-from $GO_CACHE" -} || true +tryPullForCache $TARGET_CACHE +tryPullForCache $TARGET_CACHE_MASTER +tryPullForCache $BASE_CACHE +tryPullForCache $BASE_CACHE_MASTER +tryPullForCache $GO_CACHE +tryPullForCache $GO_CACHE_MASTER +tryPullForCache $NODE_CACHE +tryPullForCache $NODE_CACHE_MASTER if [ "$ENABLE_TESTS" = "true" ]; then make ARCH=$ARCH IMAGE=$GO_IMAGE test-gosuper diff --git a/package.json b/package.json index a2083d44..dcc1658e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "resin-supervisor", "description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.", - "version": "6.4.0", + "version": "6.4.1", "license": "Apache-2.0", "repository": { "type": "git",