Add more robust testing and CI

This commit is contained in:
Adam Dodman 2017-07-09 22:37:07 +01:00
parent cada6004dd
commit c1976720c1

View File

@ -4,6 +4,13 @@ services:
privileged: true privileged: true
pipeline: pipeline:
identify:
image: docker
commands:
# Grab the current version, prevents race conditions #### Pass this into the Dockerfile somehow?
- apk add --no-cache openssl
- wget -qO- https://adam-ant.co.uk/plex/version.php > .plex_version
build: build:
image: docker image: docker
environment: environment:
@ -16,11 +23,12 @@ pipeline:
environment: environment:
- DOCKER_HOST=tcp://docker:2375 - DOCKER_HOST=tcp://docker:2375
commands: commands:
- apk add --no-cache curl - apk add --no-cache curl xmlstarlet grep
- export CUR_VERSION="$(cat .plex_version)"
- docker run --name=DEV -d -p 32400:32400 devbuild - docker run --name=DEV -d -p 32400:32400 devbuild
- sleep 10 # Wait for plex to start! - sleep 10 # Wait for plex to start!
- docker logs DEV - docker logs DEV
- curl docker:32400 # Check if its responding, a 401 here is expected [[TODO]] Maybe exec this from within docker, and grep for correct version? - curl -sSL docker:32400/identity | tee /dev/stderr | xmlstarlet sel -t -v "/MediaContainer/@version" | grep -qw $CUR_VERSION
- docker kill DEV #Not really needed, but keeps things quick - docker kill DEV #Not really needed, but keeps things quick
publish: publish:
@ -29,13 +37,11 @@ pipeline:
environment: environment:
- DOCKER_HOST=tcp://docker:2375 - DOCKER_HOST=tcp://docker:2375
commands: commands:
- apk add --no-cache openssl #Grab just the version, not the hash. Used for tagging
- export CUR_VERSION=$(wget -qO- https://adam-ant.co.uk/plex/version.php | cut -d \- -f1) - export CUR_VERSION=$(cat .plex_version | cut -d \- -f1 )
- echo $CUR_VERSION
- echo $DOCKER_USER - echo $DOCKER_USER
- docker tag devbuild adamant/plexmediaserver:latest - docker tag devbuild adamant/plexmediaserver:latest
- docker tag devbuild adamant/plexmediaserver:$CUR_VERSION - docker tag devbuild adamant/plexmediaserver:$CUR_VERSION
- docker login -u $DOCKER_USER -p $DOCKER_PASS - docker login -u $DOCKER_USER -p $DOCKER_PASS
- docker push adamant/plexmediaserver:latest - docker push adamant/plexmediaserver
- docker push adamant/plexmediaserver:$CUR_VERSION
- echo "CONGRATS! SUCCESSFULLY BUILT PLEX VERSION "$CUR_VERSION - echo "CONGRATS! SUCCESSFULLY BUILT PLEX VERSION "$CUR_VERSION