dotfiles/.gitlab-ci.yml
2019-05-19 22:05:07 +01:00

69 lines
1.5 KiB
YAML

.image:
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- docker pull $CONTAINER_IMAGE:latest || true
- docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest ./$OS_NAME/
- docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA
- docker push $CONTAINER_IMAGE:latest
stage: build
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH/$OS_NAME
image:fedora:
extends: .image
variables:
OS_NAME: fedora
image:ubuntu:
extends: .image
variables:
OS_NAME: ubuntu
.test:
before_script:
- apk add bash
script: ./test.sh
stage: test
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
DOCKER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH/$OS_NAME:$CI_COMMIT_SHA
fedora:cached:
extends: .test
variables:
DETECTED_OS: fedora:30
OS_NAME: fedora
dependencies:
- image:fedora
ubuntu:cached:
extends: .test
variables:
DETECTED_OS: ubuntu:disco
OS_NAME: ubuntu
dependencies:
- image:ubuntu
fedora:fresh:
extends: .test
variables:
DETECTED_OS: fedora:30
OS_NAME: fedora
DOCKER_IMAGE: fedora:30
ubuntu:fresh:
extends: .test
variables:
DETECTED_OS: ubuntu:disco
OS_NAME: ubuntu
DOCKER_IMAGE: ubuntu:disco