Forked from
stackspin / stackspin
7153 commits behind the upstream repository.
.gitlab-ci.yml 2.40 KiB
stages:
- build
- deploy
- test
- cleanup
ci_test_image:
stage: build
variables:
DOCKER_DRIVER: overlay2
image: docker:stable
services:
- docker:dind
before_script:
- docker info
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t ${CI_REGISTRY_IMAGE}/bootstrap-ci test/
- docker push ${CI_REGISTRY_IMAGE}/bootstrap-ci
only:
changes:
- test/Dockerfile
control_image:
stage: build
variables:
DOCKER_DRIVER: overlay2
image: docker:stable
services:
- docker:dind
before_script:
- docker info
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t ${CI_REGISTRY_IMAGE}/oas-control control/
- docker push ${CI_REGISTRY_IMAGE}/oas-control
only:
changes:
- control/**/*
bootstrap:
stage: deploy
image: docker.greenhost.net/openappstack/bootstrap/bootstrap-ci
script:
# Ensure test/ is not world-writable otherwise ansible-playbook refuses to run, see
# https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
- chmod 755 test/
- cd test/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- ANSIBLE_HOST_KEY_CHECKING=False python3 -u ./ci-bootstrap.py --create_droplet
# Wait for proper LE cert to get served
- timeout -t 1200 sh -c 'while ! curl --cacert ./letsencrypt_staging_bundle.pem -s https://auth.ci-${CI_JOB_ID}.ci.openappstack.net/auth/ > /dev/null; do date; echo "Waiting for LE cert..."; sleep 5; done'
artifacts:
paths:
- ansible/rke.log
- test/behave/behave.ini
expire_in: 1 month
when: always
testinfra:
stage: test
image: docker.greenhost.net/openappstack/bootstrap/bootstrap-ci
script:
- cd test/
- py.test -v --ansible-inventory=./inventory.yml --connection=ssh --hosts='ansible://*'
behave:
stage: test
image: docker.greenhost.net/openappstack/bootstrap/bootstrap-ci