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

View file

@ -2,25 +2,29 @@
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
--- ---
appr_e2e: appr_e2e:
before_script: allow_failure: true
- cd $QUAYDIR before_script: []
- source $QUAYDIR/venv/bin/activate image:
- sleep 30 name: quay.io/appr/appr:kubectl
- 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}
script: script:
- sleep 60 - sleep 150
- appr version localhost:80 - appr version localhost:80
- appr list localhost:80
services: services:
- postgres:9.6 - name: postgres:9.6
- quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} - 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 stage: integration
tags: tags:
- kubernetes - kubernetes
variables: variables:
APP_HOST: localhost:80
DB_URI: postgresql://quay:quay@localhost/quay DB_URI: postgresql://quay:quay@localhost/quay
GIT_STRATEGY: none GIT_STRATEGY: none
POSTGRES_PASSWORD: quay POSTGRES_PASSWORD: quay
@ -143,7 +147,7 @@ karma-tests:
- apt-get update -yqqq - apt-get update -yqqq
- apt-get install -y google-chrome-stable - apt-get install -y google-chrome-stable
- yarn test - yarn test
stage: unit_tests stage: tests
tags: tags:
- kubernetes - kubernetes
variables: variables:
@ -163,7 +167,7 @@ mysql:
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x - PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
services: services:
- mysql:latest - mysql:latest
stage: unit_tests stage: tests
tags: tags:
- kubernetes - kubernetes
variables: variables:
@ -189,7 +193,7 @@ postgres:
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x - PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
services: services:
- postgres:9.6 - postgres:9.6
stage: unit_tests stage: tests
tags: tags:
- kubernetes - kubernetes
variables: variables:
@ -201,6 +205,43 @@ postgres:
SKIP_DB_SCHEMA: 'true' SKIP_DB_SCHEMA: 'true'
TEST: 'true' TEST: 'true'
TEST_DATABASE_URI: postgresql://quay:quay@localhost/quay 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: registry-tests:
before_script: before_script:
- cd $QUAYDIR - cd $QUAYDIR
@ -209,7 +250,7 @@ registry-tests:
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script: script:
- py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./test/registry_tests.py - 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: tags:
- kubernetes - kubernetes
variables: variables:
@ -219,10 +260,10 @@ registry-tests:
TEST: 'true' TEST: 'true'
stages: stages:
- docker_base - docker_base
- integration
- docker_build - docker_build
- deploy_preview - deploy_preview
- unit_tests - integration
- tests
- docker_release - docker_release
- deploy_staging - deploy_staging
- teardown - teardown
@ -261,7 +302,7 @@ unit-tests:
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script: script:
- py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./ - py.test --cov="." --cov-report=html --cov-report=term-missing --timeout=3600 --verbose -x --color=no --show-count ./
stage: unit_tests stage: tests
tags: tags:
- kubernetes - kubernetes
variables: variables:
@ -271,35 +312,3 @@ unit-tests:
TEST: 'true' TEST: 'true'
variables: variables:
FAILFASTCI_NAMESPACE: quay 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 { EndToEndTest: self.QuayTest {
initDb:: true,
services: [ services: [
"postgres:9.6", {name: "postgres:9.6"},
vars.images.quayci.name, {name: vars.images.quayci.name, alias: 'quay'}
], ] + if self.initDb == true then [
before_script+: [ {name: vars.images.quayci.name,
"sleep 30", alias: 'db-init',
"alembic upgrade head", 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+: { variables+: {
APP_HOST: "localhost:80",
POSTGRES_PASSWORD: "quay", POSTGRES_PASSWORD: "quay",
POSTGRES_USER: "quay", POSTGRES_USER: "quay",
SKIP_DB_SCHEMA: 'true', SKIP_DB_SCHEMA: 'true',