2017-07-07 21:54:11 +00:00
|
|
|
---
|
|
|
|
defaults: &defaults
|
|
|
|
docker:
|
|
|
|
- image: library/docker:stable
|
|
|
|
working_directory: /tmp/build
|
|
|
|
steps:
|
|
|
|
- setup_remote_docker
|
|
|
|
- run:
|
|
|
|
name: Check docker is running and install git
|
|
|
|
command: |
|
|
|
|
docker info
|
2017-07-12 17:18:35 +00:00
|
|
|
apk update && apk upgrade && apk add --nocache git jq
|
2017-07-07 21:54:11 +00:00
|
|
|
- checkout
|
|
|
|
- run:
|
|
|
|
name: Initialize the submodules (yocto layers)
|
|
|
|
command: |
|
|
|
|
git submodule update --init --recursive
|
|
|
|
git clean -fxd base-image
|
|
|
|
git submodule foreach --recursive git clean -fxd
|
|
|
|
- run:
|
|
|
|
name: Build and start the docker-in-docker builder
|
|
|
|
command: |
|
|
|
|
docker build --rm=false --tag builder -f automation/Dockerfile .
|
|
|
|
- run:
|
|
|
|
name: Start the docker-in-docker builder and build $ARCH-supervisor
|
|
|
|
no_output_timeout: 10800
|
|
|
|
command: |
|
|
|
|
# build the dind image
|
|
|
|
docker build --rm=false --tag builder -f automation/Dockerfile .
|
|
|
|
# start the dind container
|
|
|
|
dind=$(docker run --privileged -d builder)
|
|
|
|
# confirm it's running
|
|
|
|
docker ps
|
2017-07-12 17:18:35 +00:00
|
|
|
VERSION_TAG=v$(jq .version package.json | sed 's/"//g')
|
|
|
|
if [ "${CIRCLE_BRANCH}" = "master" ]; then
|
|
|
|
EXTRA_BUILD_ARGS="-e EXTRA_TAG=$VERSION_TAG"
|
|
|
|
else
|
|
|
|
EXTRA_BUILD_ARGS=""
|
|
|
|
fi
|
2017-07-07 21:54:11 +00:00
|
|
|
# start the build for this architecture
|
2017-07-12 17:18:35 +00:00
|
|
|
docker exec -it -e TAG=${CIRCLE_BRANCH} -e ARCH=${ARCH} -e PUSH_IMAGES=${PUSH_IMAGES} $EXTRA_BUILD_ARGS ${dind} bash automation/build.sh
|
|
|
|
if [ "${CIRCLE_BRANCH}" = "master" ] && [ "${DEPLOY_TO_RESIN}" = "true" ]; then
|
|
|
|
echo "Deploying to Resin API (staging)"
|
|
|
|
docker exec -it -e ARCH=${ARCH} -e TAG=$VERSION_TAG -e API_KEY=$STAGING_API_KEY -e API_ENDPOINT=$STAGING_API_ENDPOINT ${dind} node automation/deploy-to-resin.js
|
|
|
|
echo "Deploying to Resin API (production)"
|
|
|
|
docker exec -it -e ARCH=${ARCH} -e TAG=$VERSION_TAG -e API_KEY=$PRODUCTION_API_KEY -e API_ENDPOINT=$PRODUCTION_API_ENDPOINT ${dind} node automation/deploy-to-resin.js
|
|
|
|
fi
|
2017-07-07 21:54:11 +00:00
|
|
|
|
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
amd64:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
DOCKER_EMAIL: accounts+travisci+docker@resin.io
|
|
|
|
ARCH: amd64
|
2017-07-10 15:53:31 +00:00
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-07 21:54:11 +00:00
|
|
|
i386:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
DOCKER_EMAIL: accounts+travisci+docker@resin.io
|
|
|
|
ARCH: i386
|
2017-07-10 15:53:31 +00:00
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-10 15:53:31 +00:00
|
|
|
armel:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
DOCKER_EMAIL: accounts+travisci+docker@resin.io
|
|
|
|
ARCH: armel
|
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-10 15:53:31 +00:00
|
|
|
armv7hf:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
DOCKER_EMAIL: accounts+travisci+docker@resin.io
|
|
|
|
ARCH: armv7hf
|
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-10 15:53:31 +00:00
|
|
|
aarch64:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
DOCKER_EMAIL: accounts+travisci+docker@resin.io
|
|
|
|
ARCH: aarch64
|
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-10 15:53:31 +00:00
|
|
|
rpi:
|
|
|
|
<<: *defaults
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME: travisciresin
|
|
|
|
DOCKER_EMAIL: accounts+travisci+docker@resin.io
|
|
|
|
ARCH: rpi
|
|
|
|
PUSH_IMAGES: "true"
|
2017-07-12 17:18:35 +00:00
|
|
|
STAGING_API_ENDPOINT: https://api.resinstaging.io
|
|
|
|
PRODUCTION_API_ENDPOINT: https://api.resin.io
|
2017-07-07 21:54:11 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2017-07-12 17:18:35 +00:00
|
|
|
build_and_maybe_deploy:
|
2017-07-07 21:54:11 +00:00
|
|
|
jobs:
|
|
|
|
- amd64
|
|
|
|
- i386
|
2017-07-12 17:18:35 +00:00
|
|
|
- rpi
|
|
|
|
- armv7hf
|
|
|
|
- aarch64
|
|
|
|
- armel
|