CI service command

This commit is contained in:
Antoine Legrand 2017-07-28 13:23:31 +02:00
parent 7cc39a7c54
commit f3ac04f799
3 changed files with 94 additions and 77 deletions

View file

@ -7,12 +7,10 @@ local baseJob = (import '.gitlab-ci/base_jobs.libsonnet')(vars);
local stages_list = [
// gitlab-ci stages
'docker_base',
'integration',
'docker_build',
'deploy_preview',
'unit_tests',
'integration',
'tests',
'docker_release',
'deploy_staging',
'teardown',
@ -26,6 +24,7 @@ local jobs = {
local onlyMaster = {
only: ['master', 'tags'],
},
local onlyBranch = {
only: ['branches'],
except: ['master']
@ -70,7 +69,7 @@ local jobs = {
// Unit-tests
local unittest_stage = baseJob.QuayTest {
stage: stages.unit_tests },
stage: stages.tests },
local pytest_cmd = 'py.test --cov="." --cov-report=html --cov-report=term-missing' +
' --timeout=3600 --verbose -x --color=no --show-count ',
'unit-tests': unittest_stage {
@ -105,35 +104,34 @@ local jobs = {
stage: stages.integration
},
'yarn_e2e': integration_test {
'protractor_e2e': integration_test {
initDb:: true,
variables+: {"APP_HOST": "http://localhost:80"},
services+: ["selenium/standalone-chrome:3.4.0"],
before_script+: [
"curl -sL https://deb.nodesource.com/setup_8.x | bash -",
"apt-get install -y nodejs",
"./node_modules/.bin/webdriver-manager update",
"python initdb.py",
],
script: [
"sleep 60",
allow_failure: true,
script+: [
"yarn e2e",
]
},
'appr_e2e': integration_test {
before_script+: [
"python initdb.py",
"curl -L https://github.com/app-registry/appr/releases/download/v0.6.1/appr-linux-x64 -o /bin/appr",
"chmod +x /bin/appr",
],
script: [
"sleep 60",
"appr version localhost:80"
]
initDb:: true,
image: {name: "quay.io/appr/appr:kubectl"},
before_script: [],
script+: [
"appr version localhost:80",
"appr list localhost:80",
],
allow_failure: true,
},
// Unit-tests with real databases
local db_stage = { stage: stages.unit_tests },
local db_stage = { stage: stages.tests },
local dbname = 'quay',
postgres: db_stage + baseJob.dbTest('postgresql',

View file

@ -2,25 +2,29 @@
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
---
appr_e2e:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
- sleep 30
- alembic upgrade head
- python initdb.py
- curl -L https://github.com/app-registry/appr/releases/download/v0.6.1/appr-linux-x64 -o /bin/appr
- chmod +x /bin/appr
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
allow_failure: true
before_script: []
image:
name: quay.io/appr/appr:kubectl
script:
- sleep 60
- sleep 150
- appr version localhost:80
- appr list localhost:80
services:
- postgres:9.6
- quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- 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
@ -143,7 +147,7 @@ karma-tests:
- apt-get update -yqqq
- apt-get install -y google-chrome-stable
- yarn test
stage: unit_tests
stage: tests
tags:
- kubernetes
variables:
@ -163,7 +167,7 @@ mysql:
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
services:
- mysql:latest
stage: unit_tests
stage: tests
tags:
- kubernetes
variables:
@ -189,7 +193,7 @@ postgres:
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
services:
- postgres:9.6
stage: unit_tests
stage: tests
tags:
- kubernetes
variables:
@ -201,6 +205,43 @@ postgres:
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}
- 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
SKIP_DB_SCHEMA: 'true'
TEST: 'true'
TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay
registry-tests:
before_script:
- cd $QUAYDIR
@ -209,7 +250,7 @@ registry-tests:
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: unit_tests
stage: tests
tags:
- kubernetes
variables:
@ -219,10 +260,10 @@ registry-tests:
TEST: 'true'
stages:
- docker_base
- integration
- docker_build
- deploy_preview
- unit_tests
- integration
- tests
- docker_release
- deploy_staging
- teardown
@ -261,7 +302,7 @@ unit-tests:
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: unit_tests
stage: tests
tags:
- kubernetes
variables:
@ -271,35 +312,3 @@ unit-tests:
TEST: 'true'
variables:
FAILFASTCI_NAMESPACE: quay
yarn_e2e:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
- sleep 30
- alembic upgrade head
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt-get install -y nodejs
- ./node_modules/.bin/webdriver-manager update
- python initdb.py
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- sleep 60
- yarn e2e
services:
- postgres:9.6
- quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- 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
SKIP_DB_SCHEMA: 'true'
TEST: 'true'
TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay

View file

@ -101,15 +101,25 @@ function(vars={})
},
EndToEndTest: self.QuayTest {
initDb:: true,
services: [
"postgres:9.6",
vars.images.quayci.name,
],
before_script+: [
"sleep 30",
"alembic upgrade head",
],
{name: "postgres:9.6"},
{name: vars.images.quayci.name, alias: 'quay'}
] + if self.initDb == true then [
{name: vars.images.quayci.name,
alias: 'db-init',
command: ["/bin/sh",
"-c",
"sleep 30" +
"&& /quay-registry/venv/bin/python initdb.py" +
"&& sleep 3600",]},
] else [],
before_script: if self.image == vars.images.quayci.name
then super.before_script
else [],
script: ['sleep 150'],
variables+: {
APP_HOST: "localhost:80",
POSTGRES_PASSWORD: "quay",
POSTGRES_USER: "quay",
SKIP_DB_SCHEMA: 'true',