Merge pull request #2789 from coreos-inc/alegrand/ci_e2e_demo_tests
Add Yarn e2e / Appr e2e Tests to the CI
This commit is contained in:
commit
5bb785cae9
5 changed files with 212 additions and 19 deletions
|
@ -9,7 +9,7 @@ local stages_list = [
|
||||||
'docker_base',
|
'docker_base',
|
||||||
'docker_build',
|
'docker_build',
|
||||||
'deploy_preview',
|
'deploy_preview',
|
||||||
'unit_tests',
|
'tests',
|
||||||
'integration',
|
'integration',
|
||||||
'docker_release',
|
'docker_release',
|
||||||
'deploy_staging',
|
'deploy_staging',
|
||||||
|
@ -24,12 +24,13 @@ local jobs = {
|
||||||
local onlyMaster = {
|
local onlyMaster = {
|
||||||
only: ['master', 'tags'],
|
only: ['master', 'tags'],
|
||||||
},
|
},
|
||||||
|
|
||||||
local onlyBranch = {
|
local onlyBranch = {
|
||||||
only: ['branches'],
|
only: ['branches'],
|
||||||
except: ['master']
|
except: ['master']
|
||||||
},
|
},
|
||||||
|
|
||||||
'container-base-build': baseJob.dockerBuild + onlyMaster {
|
'container-base-build': baseJob.dockerBuild {
|
||||||
// ! Only master/tags
|
// ! Only master/tags
|
||||||
// Update the base container
|
// Update the base container
|
||||||
stage: stages.docker_base,
|
stage: stages.docker_base,
|
||||||
|
@ -38,6 +39,7 @@ local jobs = {
|
||||||
' -t %s -f quay-base.dockerfile .' % images.base.name,
|
' -t %s -f quay-base.dockerfile .' % images.base.name,
|
||||||
'docker push %s' % images.base.name,
|
'docker push %s' % images.base.name,
|
||||||
],
|
],
|
||||||
|
only: ["schedules"]
|
||||||
},
|
},
|
||||||
|
|
||||||
'container-build': baseJob.dockerBuild {
|
'container-build': baseJob.dockerBuild {
|
||||||
|
@ -67,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 {
|
||||||
|
@ -97,8 +99,59 @@ local jobs = {
|
||||||
'yarn test'
|
'yarn test'
|
||||||
] },
|
] },
|
||||||
|
|
||||||
|
// Integration API
|
||||||
|
local integration_test = baseJob.EndToEndTest {
|
||||||
|
stage: stages.integration
|
||||||
|
},
|
||||||
|
|
||||||
|
'protractor_e2e': integration_test {
|
||||||
|
initDb:: true,
|
||||||
|
variables+: {"APP_HOST": "http://localhost:80"},
|
||||||
|
services+: [{name: "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",
|
||||||
|
],
|
||||||
|
allow_failure: true,
|
||||||
|
script+: [
|
||||||
|
"yarn e2e",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
'appr_e2e': integration_test {
|
||||||
|
initDb:: true,
|
||||||
|
image: {name: "quay.io/appr/appr:kubectl"},
|
||||||
|
before_script: [],
|
||||||
|
script+: [
|
||||||
|
"appr version localhost:80",
|
||||||
|
"appr list localhost:80",
|
||||||
|
],
|
||||||
|
allow_failure: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
'docker_e2e': integration_test {
|
||||||
|
initDb:: true,
|
||||||
|
image: {name: "docker"},
|
||||||
|
services+: [{name: "docker:dind"}],
|
||||||
|
variables+: {
|
||||||
|
DOCKER_DRIVER: "overlay2",
|
||||||
|
DOCKER_HOST: "tcp://localhost:2375"
|
||||||
|
},
|
||||||
|
before_script: [],
|
||||||
|
script+: [
|
||||||
|
"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",
|
||||||
|
],
|
||||||
|
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',
|
||||||
|
|
134
.gitlab-ci.yml
134
.gitlab-ci.yml
|
@ -1,13 +1,46 @@
|
||||||
# Generated from .gitlab-ci.jsonnet
|
# Generated from .gitlab-ci.jsonnet
|
||||||
# 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:
|
||||||
|
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:
|
container-base-build:
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
|
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
|
||||||
image: docker:git
|
image: docker:git
|
||||||
only:
|
only:
|
||||||
- master
|
- schedules
|
||||||
- tags
|
|
||||||
script:
|
script:
|
||||||
- docker build --no-cache -t quay.io/quay/quay-base:latest -f quay-base.dockerfile .
|
- docker build --no-cache -t quay.io/quay/quay-base:latest -f quay-base.dockerfile .
|
||||||
- docker push quay.io/quay/quay-base:latest
|
- docker push quay.io/quay/quay-base:latest
|
||||||
|
@ -15,7 +48,7 @@ container-base-build:
|
||||||
tags:
|
tags:
|
||||||
- kubernetes
|
- kubernetes
|
||||||
variables:
|
variables:
|
||||||
DOCKER_DRIVER: overlay
|
DOCKER_DRIVER: overlay2
|
||||||
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
|
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
|
||||||
container-build:
|
container-build:
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -32,7 +65,7 @@ container-build:
|
||||||
tags:
|
tags:
|
||||||
- kubernetes
|
- kubernetes
|
||||||
variables:
|
variables:
|
||||||
DOCKER_DRIVER: overlay
|
DOCKER_DRIVER: overlay2
|
||||||
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
|
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
|
||||||
container-release:
|
container-release:
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -49,7 +82,7 @@ container-release:
|
||||||
tags:
|
tags:
|
||||||
- kubernetes
|
- kubernetes
|
||||||
variables:
|
variables:
|
||||||
DOCKER_DRIVER: overlay
|
DOCKER_DRIVER: overlay2
|
||||||
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
|
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
|
||||||
deploy-preview:
|
deploy-preview:
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -104,6 +137,47 @@ deploy-staging:
|
||||||
variables:
|
variables:
|
||||||
K8S_NAMESPACE: ci-staging
|
K8S_NAMESPACE: ci-staging
|
||||||
QUAY_DOMAIN: quay-staging.k8s.devtable.com
|
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:
|
karma-tests:
|
||||||
before_script:
|
before_script:
|
||||||
- cd $QUAYDIR
|
- cd $QUAYDIR
|
||||||
|
@ -115,7 +189,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:
|
||||||
|
@ -135,7 +209,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:
|
||||||
|
@ -161,7 +235,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:
|
||||||
|
@ -173,6 +247,44 @@ 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}
|
||||||
|
- 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:
|
registry-tests:
|
||||||
before_script:
|
before_script:
|
||||||
- cd $QUAYDIR
|
- cd $QUAYDIR
|
||||||
|
@ -181,7 +293,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:
|
||||||
|
@ -193,7 +305,7 @@ stages:
|
||||||
- docker_base
|
- docker_base
|
||||||
- docker_build
|
- docker_build
|
||||||
- deploy_preview
|
- deploy_preview
|
||||||
- unit_tests
|
- tests
|
||||||
- integration
|
- integration
|
||||||
- docker_release
|
- docker_release
|
||||||
- deploy_staging
|
- deploy_staging
|
||||||
|
@ -233,7 +345,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:
|
||||||
|
|
|
@ -3,7 +3,7 @@ function(vars={})
|
||||||
dockerBuild: {
|
dockerBuild: {
|
||||||
// base job to manage containers (build / push)
|
// base job to manage containers (build / push)
|
||||||
variables: {
|
variables: {
|
||||||
DOCKER_DRIVER: "overlay",
|
DOCKER_DRIVER: "overlay2",
|
||||||
DOCKER_HOST: "tcp://docker-host.gitlab-runner.svc.cluster.local:2375"
|
DOCKER_HOST: "tcp://docker-host.gitlab-runner.svc.cluster.local:2375"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ function(vars={})
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
QuayDeploy: {
|
QuayDeploy: {
|
||||||
local this = self,
|
local this = self,
|
||||||
local _vars = self.localvars,
|
local _vars = self.localvars,
|
||||||
|
@ -101,6 +100,35 @@ function(vars={})
|
||||||
script: [],
|
script: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
EndToEndTest: self.QuayTest {
|
||||||
|
initDb:: true,
|
||||||
|
services: [
|
||||||
|
{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',
|
||||||
|
TEST_DATABASE_URI: self['DB_URI'],
|
||||||
|
QUAY_OVERRIDE_CONFIG: '' + {"SERVER_HOSTNAME": "localhost:80"},
|
||||||
|
DB_URI: 'postgresql://quay:quay@localhost/quay'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
dbTest(scheme, image, env):: self.QuayTest {
|
dbTest(scheme, image, env):: self.QuayTest {
|
||||||
variables+: {
|
variables+: {
|
||||||
SKIP_DB_SCHEMA: 'true',
|
SKIP_DB_SCHEMA: 'true',
|
||||||
|
|
|
@ -18,7 +18,7 @@ RUN add-apt-repository ppa:nginx/development
|
||||||
# Add Yarn repository until it is officially added to Ubuntu
|
# Add Yarn repository until it is officially added to Ubuntu
|
||||||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
||||||
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
||||||
|
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
|
||||||
# Install system packages
|
# Install system packages
|
||||||
RUN apt-get update && apt-get upgrade -y \
|
RUN apt-get update && apt-get upgrade -y \
|
||||||
&& apt-get install -y \
|
&& apt-get install -y \
|
||||||
|
|
|
@ -20,7 +20,7 @@ export const config: Config = {
|
||||||
framework: 'jasmine',
|
framework: 'jasmine',
|
||||||
seleniumAddress: 'http://localhost:4444/wd/hub',
|
seleniumAddress: 'http://localhost:4444/wd/hub',
|
||||||
// Uncomment to run tests against local Chrome instance
|
// Uncomment to run tests against local Chrome instance
|
||||||
directConnect: true,
|
// directConnect: true,
|
||||||
capabilities: {
|
capabilities: {
|
||||||
browserName: 'chrome',
|
browserName: 'chrome',
|
||||||
chromeOptions: {
|
chromeOptions: {
|
||||||
|
|
Reference in a new issue