labsync/.gitlab-ci.yml
2018-02-15 19:46:56 +01:00

69 lines
1.2 KiB
YAML

image: docker:latest
variables:
PACKER_VERSION: 1.2.0
stages:
- setup
- rootfs
- torrent
prepare:
variables:
ZIPFILE: packer_${PACKER_VERSION}_linux_amd64.zip
stage: setup
cache:
key: binaries
paths:
- bin
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
only:
- /ci/
packer:
stage: rootfs
services:
- docker:dind
before_script:
- apk add --no-cache ansible openssh-client
script:
- bin/packer build packer.json
- gzip -k -f rootfs.tar
artifacts:
paths:
- rootfs.tar.gz
expire_in: 2 weeks
cache:
key: binaries
paths:
- bin
policy: pull
only:
- /ci/
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 -a "$ANNOUNCE" -o rootfs.torrent -l 22 -w "$WEBSEED" rootfs.tar.gz
artifacts:
paths:
- rootfs.torrent
expire_in: 2 weeks
cache:
key: binaries
paths:
- bin
policy: pull
only:
- /ci/