-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpush.sh
executable file
·65 lines (55 loc) · 2.43 KB
/
push.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
set -o errexit
export MACHINE=${MACHINE:-raspberrypi3}
_IGALIA="igalia"
_ARCH=$(docker info | grep Architecture | awk '{ print $2 }')
ARCH=${ARCH:-$_ARCH}
_VERSION=$(git describe --dirty --always)
VERSION=${VERSION:-$_VERSION}
REGISTRY=${REGISTRY:-docker.io}
REGISTRY_USER=${REGISTRY_USER:-user}
REGISTRY_PASSWORD=${REGISTRY_PASSWORD:-password}
REGISTRY_PATH=${REGISTRY_PATH:-$_IGALIA}
IMAGE=${IMAGE:-browser-wpe}
IMAGE_BALENA_IN_DOCKER="${REGISTRY}/${REGISTRY_PATH}/balena-${IMAGE}:${MACHINE}"
IMAGE_YOCTO_IN_DOCKER="${REGISTRY}/${REGISTRY_PATH}/docker-${IMAGE}:${MACHINE}"
# Required because the Dockerfile.template is set to # igalia/${IMAGE}:${MACHINE}
IMAGE_YOCTO_LOCAL_IN_DOCKER="${_IGALIA}/balena-${IMAGE}:${MACHINE}"
if [ "${SKIP_IMPORT_YOCTO}" == "1" ]
then
echo ">>> Import Yocto image in Docker (SKIPPED):"
else
echo ">>> Importing Yocto image: $(ls -lh build/tmp/deploy/images/${MACHINE}/${IMAGE}-image-${MACHINE}.tar.gz)"
docker import - "${IMAGE_YOCTO_IN_DOCKER}" < build/tmp/deploy/images/${MACHINE}/${IMAGE}-image-${MACHINE}.tar.gz
docker tag "${IMAGE_YOCTO_IN_DOCKER}" "${IMAGE_YOCTO_IN_DOCKER}-${VERSION}"
docker tag "${IMAGE_YOCTO_IN_DOCKER}" "${IMAGE_YOCTO_LOCAL_IN_DOCKER}"
docker tag "${IMAGE_YOCTO_IN_DOCKER}" "${IMAGE_YOCTO_LOCAL_IN_DOCKER}-${VERSION}"
echo
echo ">>> Imported Yocto image in Docker:"
fi
echo " - Machine: ${MACHINE}"
echo " - Platform: ${ARCH}"
echo " - Image: ${IMAGE_YOCTO_LOCAL_IN_DOCKER} (${IMAGE_YOCTO_LOCAL_IN_DOCKER}-${VERSION})"
if [ "${SKIP_BUILD_BALENA}" == "1" ]
then
echo ">>> Build Balena image (SKIPPED):"
else
cp build/tmp/deploy/images/${MACHINE}/${IMAGE}-image-${MACHINE}.manifest ./balena/image.manifest
rm -rf build
balena build . --deviceType ${MACHINE} --arch ${ARCH} ${BALENA_BUILD_EXTRA_ARGS}
docker tag "docker-balena-wpe_wpe" "${IMAGE_BALENA_IN_DOCKER}"
docker tag "docker-balena-wpe_wpe" "${IMAGE_BALENA_IN_DOCKER}-${VERSION}"
fi
if [ "${SKIP_PUSH_BALENA_IMAGE}" == "1" ]
then
echo ">>> Push Balena Docker image (SKIPPED):"
else
docker login -u ${REGISTRY_USER} -p ${REGISTRY_PASSWORD} ${REGISTRY}
docker push ${IMAGE_BALENA_IN_DOCKER}
docker push ${IMAGE_BALENA_IN_DOCKER}-${VERSION}
echo ">>> Pushed Balena docker image:"
fi
echo " - Registry: ${REGISTRY}"
echo " - Machine: ${MACHINE}"
echo " - Platform: ${ARCH}"
echo " - Image: ${IMAGE_BALENA_IN_DOCKER} (${IMAGE_BALENA_IN_DOCKER}-${VERSION})"