This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/.gitlab-ci.yml

358 lines
10 KiB
YAML

# Generated from .gitlab-ci.jsonnet
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
---
appr_e2e:
allow_failure: true
before_script: []
image:
name: quay.io/appr/appr:kubectl
script:
- sleep 150
- appr version localhost:80
- appr list localhost:80
services:
- name: postgres:9.6
- alias: quay
name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- alias: db-init
command:
- /bin/sh
- -c
- sleep 30&& /quay-registry/venv/bin/python initdb.py&& sleep 3600
name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
stage: integration
tags:
- kubernetes
variables:
APP_HOST: localhost:80
DB_URI: postgresql://quay:quay@localhost/quay
GIT_STRATEGY: none
POSTGRES_PASSWORD: quay
POSTGRES_USER: quay
PYTHONPATH: .
QUAYDIR: /quay-registry
QUAY_OVERRIDE_CONFIG: '{"SERVER_HOSTNAME": "localhost:80"}'
SKIP_DB_SCHEMA: 'true'
TEST: 'true'
TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay
container-base-build:
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
image: docker:git
only:
- schedules
script:
- docker build --no-cache -t quay.io/quay/quay-base:latest -f quay-base.dockerfile .
- docker push quay.io/quay/quay-base:latest
stage: docker_base
tags:
- kubernetes
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
container-build:
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
image: docker:git
script:
- docker build --no-cache -t quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} -f Dockerfile .
- docker run --rm quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} cat ALEMBIC_HEAD > /tmp/ALEMBIC_HEAD
- export MIGRATION_HEAD=`cat /tmp/ALEMBIC_HEAD | cut -d" " -f1`
- echo $MIGRATION_HEAD
- docker build --label db-schema-head=$MIGRATION_HEAD -t quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} -f Dockerfile .
- docker push quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
stage: docker_build
tags:
- kubernetes
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
container-release:
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
image: docker:git
only:
- master
- tags
script:
- docker pull quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- docker tag quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}
- docker push quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}
stage: docker_release
tags:
- kubernetes
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
deploy-preview:
before_script:
- appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io
- cd deploy/quay-ci-app
- echo -n 1.0.0-${CI_COMMIT_REF_SLUG} > VERSION
- 'echo "{\"domain\": \"$QUAY_DOMAIN\", \"image\": \"quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}\", \"tag\": \"${CI_COMMIT_REF_SLUG}\"}" > params.json'
- cat params.json
environment:
name: review/${CI_COMMIT_REF_SLUG}
on_stop: stop-preview
url: https://quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
except:
- master
image: quay.io/appr/appr:kubectl
only:
- branches
script:
- appr push quay.io/quay/quay-ci-app -f
- appr deploy quay.io/quay/quay-ci-app@1.0.0-${CI_COMMIT_REF_SLUG} --namespace ci-quay-${CI_COMMIT_REF_SLUG} -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS
- kubectl get ingresses -n ci-quay-${CI_COMMIT_REF_SLUG} -o wide
stage: deploy_preview
tags:
- kubernetes
variables:
K8S_NAMESPACE: ci-quay-${CI_COMMIT_REF_SLUG}
QUAY_DOMAIN: quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
when: manual
deploy-staging:
before_script:
- appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io
- cd deploy/quay-ci-app
- echo -n 1.0.0-${CI_COMMIT_REF_SLUG}-${SHA8} > VERSION
- 'echo "{\"domain\": \"$QUAY_DOMAIN\", \"image\": \"quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}\", \"tag\": \"${CI_COMMIT_REF_SLUG}-${SHA8}\"}" > params.json'
- cat params.json
environment:
name: staging
url: https://quay-staging.k8s.devtable.com
image: quay.io/appr/appr:kubectl
only:
- master
script:
- appr push quay.io/quay/quay-ci-app -f
- appr push quay.io/quay/quay-ci-app -c master
- appr push quay.io/quay/quay-ci-app -c beta
- appr push quay.io/quay/quay-ci-app -c latest
- appr deploy quay.io/quay/quay-ci-app@1.0.0-${CI_COMMIT_REF_SLUG}-${SHA8} --namespace ci-staging -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS
- kubectl get ingresses -n ci-staging -o wide
stage: deploy_staging
tags:
- kubernetes
variables:
K8S_NAMESPACE: ci-staging
QUAY_DOMAIN: quay-staging.k8s.devtable.com
docker_e2e:
allow_failure: true
before_script: []
image:
name: docker
script:
- sleep 150
- docker login localhost:80 -u devtable -p password
- docker pull nginx
- docker tag nginx localhost:80/devtable/nginx
- docker push localhost:80/devtable/nginx
- sleep 1
- docker pull localhost:80/devtable/nginx
services:
- name: postgres:9.6
- alias: quay
name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- alias: db-init
command:
- /bin/sh
- -c
- sleep 30&& /quay-registry/venv/bin/python initdb.py&& sleep 3600
name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- name: docker:dind
stage: integration
tags:
- kubernetes
variables:
APP_HOST: localhost:80
DB_URI: postgresql://quay:quay@localhost/quay
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2375
GIT_STRATEGY: none
POSTGRES_PASSWORD: quay
POSTGRES_USER: quay
PYTHONPATH: .
QUAYDIR: /quay-registry
QUAY_OVERRIDE_CONFIG: '{"SERVER_HOSTNAME": "localhost:80"}'
SKIP_DB_SCHEMA: 'true'
TEST: 'true'
TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay
karma-tests:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- curl -Ss https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
- apt-get update -yqqq
- apt-get install -y google-chrome-stable
- yarn test
stage: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
PYTHONPATH: .
QUAYDIR: /quay-registry
TEST: 'true'
mysql:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- sleep 30
- alembic upgrade head
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
services:
- mysql:latest
stage: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
MYSQL_DATABASE: quay
MYSQL_PASSWORD: quay
MYSQL_ROOT_PASSWORD: quay
MYSQL_USER: quay
PYTHONPATH: .
QUAYDIR: /quay-registry
SKIP_DB_SCHEMA: 'true'
TEST: 'true'
TEST_DATABASE_URI: mysql+pymysql://quay:quay@localhost/quay
postgres:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- sleep 30
- alembic upgrade head
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
services:
- postgres:9.6
stage: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
POSTGRES_PASSWORD: quay
POSTGRES_USER: quay
PYTHONPATH: .
QUAYDIR: /quay-registry
SKIP_DB_SCHEMA: 'true'
TEST: 'true'
TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay
protractor_e2e:
allow_failure: true
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt-get install -y nodejs
- ./node_modules/.bin/webdriver-manager update
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- sleep 150
- yarn e2e
services:
- name: postgres:9.6
- alias: quay
name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- alias: db-init
command:
- /bin/sh
- -c
- sleep 30&& /quay-registry/venv/bin/python initdb.py&& sleep 3600
name: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- name: selenium/standalone-chrome:3.4.0
stage: integration
tags:
- kubernetes
variables:
APP_HOST: http://localhost:80
DB_URI: postgresql://quay:quay@localhost/quay
GIT_STRATEGY: none
POSTGRES_PASSWORD: quay
POSTGRES_USER: quay
PYTHONPATH: .
QUAYDIR: /quay-registry
QUAY_OVERRIDE_CONFIG: '{"SERVER_HOSTNAME": "localhost:80"}'
SKIP_DB_SCHEMA: 'true'
TEST: 'true'
TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay
registry-tests:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./test/registry_tests.py
stage: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
PYTHONPATH: .
QUAYDIR: /quay-registry
TEST: 'true'
stages:
- docker_base
- docker_build
- deploy_preview
- tests
- integration
- docker_release
- deploy_staging
- teardown
stop-preview:
before_script: []
environment:
action: stop
name: review/${CI_COMMIT_REF_SLUG}
url: https://quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
except:
- master
image: quay.io/appr/appr:kubectl
only:
- branches
script:
- kubectl delete ns $K8S_NAMESPACE
- kubectl get pods -o wide -n $K8S_NAMESPACE
stage: deploy_preview
tags:
- kubernetes
variables:
GIT_STRATEGY: none
K8S_NAMESPACE: ci-quay-${CI_COMMIT_REF_SLUG}
QUAY_DOMAIN: quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
when: manual
unit-tests:
after_script:
- cp -r $QUAYDIR/htmlcov/ $CI_PROJECT_DIR/coverage
artifacts:
paths:
- coverage
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./
stage: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
PYTHONPATH: .
QUAYDIR: /quay-registry
TEST: 'true'
variables:
FAILFASTCI_NAMESPACE: quay