Update CI

This commit is contained in:
jalr 2018-02-20 22:47:39 +01:00
parent 6c12883a35
commit 47fb326aa1

View file

@ -2,70 +2,59 @@ image: docker:latest
variables:
PACKER_VERSION: 1.2.0
ANNOUNCE: http://raven.lab.fablab-nea.de:6969/announce
WEBSEED: http://raven.lab.fablab-nea.de/labsync
PACKER_DOCKER_IMAGE: ${CI_REGISTRY_IMAGE}/packer
MKTORRENT_DOCKER_IMAGE: ${CI_REGISTRY_IMAGE}/mktorrent
stages:
- setup
- rootfs
- prepare
- build
- torrent
# - deploy
#
services:
- docker:dind
prepare:
variables:
ZIPFILE: packer_${PACKER_VERSION}_linux_amd64.zip
stage: setup
cache:
key: "binaries_packer-$PACKER_VERSION"
paths:
- bin
before_script:
- docker info
- apk add --no-cache make
dockerimage:
stage: prepare
script:
- mkdir -p bin
- |
if [ ! -e bin/packer ]; then wget -c https://releases.hashicorp.com/packer/${PACKER_VERSION}/${ZIPFILE} && unzip "$ZIPFILE" -d bin && rm -f "$ZIPFILE"; fi
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- make dockerimg
- docker push $PACKER_DOCKER_IMAGE
- docker push $MKTORRENT_DOCKER_IMAGE
only:
- /ci/
tags:
- fablab
packer:
stage: rootfs
services:
- docker:dind
before_script:
- apk add --no-cache ansible openssh-client squashfs-tools
squashfs:
stage: build
script:
- bin/packer build packer.json
- mkdir build/rootfs
- tar xf build/rootfs.tar -C build/rootfs
- mksquashfs build/rootfs build/rootfs.squashfs
- make images/debian-stretch
artifacts:
paths:
- build/rootfs.squashfs
- images
expire_in: 2 weeks
cache:
key: "binaries_packer-$PACKER_VERSION"
paths:
- bin
policy: pull
only:
- /ci/
tags:
- fablab
mktorrent:
stage: torrent
dependencies:
- packer
variables:
ANNOUNCE: udp://tracker.sbruder.de:6969/announce
WEBSEED: http://10.2.2.1:8081/rootfs.tar.gz
before_script:
- apk add --no-cache mktorrent
script:
- mktorrent-borg -a "$ANNOUNCE" -o build/rootfs.squashfs.torrent -l 22 -w "$WEBSEED" build/rootfs.squashfs
- make images/debian-stretch.torrent
artifacts:
paths:
- build/rootfs.squashfs.torrent
- images
expire_in: 2 weeks
cache:
key: binaries
paths:
- bin
policy: pull
only:
- /ci/
tags:
- fablab