2017-06-13 03:55:12 +00:00
|
|
|
function(vars={})
|
|
|
|
{
|
|
|
|
dockerBuild: {
|
|
|
|
// base job to manage containers (build / push)
|
|
|
|
variables: {
|
2017-06-26 13:21:59 +00:00
|
|
|
DOCKER_DRIVER: "overlay",
|
|
|
|
DOCKER_HOST: "tcp://docker-host.gitlab-runner.svc.cluster.local:2375"
|
2017-06-13 03:55:12 +00:00
|
|
|
},
|
2017-06-26 13:21:59 +00:00
|
|
|
|
2017-06-13 03:55:12 +00:00
|
|
|
image: "docker:git",
|
|
|
|
before_script: [
|
|
|
|
"docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io",
|
|
|
|
],
|
2017-06-26 13:21:59 +00:00
|
|
|
|
2017-06-13 03:55:12 +00:00
|
|
|
tags: [
|
2017-06-26 13:21:59 +00:00
|
|
|
"kubernetes",
|
2017-06-13 03:55:12 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
QuayTest: {
|
|
|
|
// base job to test the container
|
|
|
|
image: vars.images.quayci.name,
|
|
|
|
variables: {
|
|
|
|
TEST: "true",
|
|
|
|
PYTHONPATH: ".",
|
2017-02-01 23:17:25 +00:00
|
|
|
QUAYDIR: "/quay-registry",
|
2017-06-13 03:55:12 +00:00
|
|
|
GIT_STRATEGY: "none",
|
|
|
|
},
|
|
|
|
before_script: [
|
2017-07-06 21:50:38 +00:00
|
|
|
"cd $QUAYDIR",
|
|
|
|
"source $QUAYDIR/venv/bin/activate",
|
2017-06-13 03:55:12 +00:00
|
|
|
],
|
|
|
|
tags: [
|
|
|
|
"kubernetes",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
2017-07-16 23:24:31 +00:00
|
|
|
local appversion = "1.0.0-%s" % vars.images.quayci.tag,
|
|
|
|
local namespace = "ci-quay-%s" % vars.images.quayci.tag,
|
|
|
|
QuayDeploy: {
|
|
|
|
image: "quay.io/appr/appr:kubectl",
|
|
|
|
when: "manual",
|
|
|
|
environment: {
|
|
|
|
name: "review/%s" % vars.images.quayci.tag,
|
|
|
|
url: "https://quay-%s.k8s.devtable.com" % vars.images.quayci.tag,
|
|
|
|
},
|
|
|
|
tags: [
|
|
|
|
"kubernetes",
|
|
|
|
],
|
|
|
|
stage: "deploy",
|
|
|
|
before_script: [
|
|
|
|
"appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io",
|
|
|
|
],
|
|
|
|
script: [
|
|
|
|
"cd deploy/quay-demo-app",
|
|
|
|
"echo -n %s > VERSION" % appversion,
|
|
|
|
'echo "{\\"image\\": \\"%s\\", \\"tag\\": \\"%s\\"}" > params.json' % [vars.images.quayci.name, vars.images.quayci.tag],
|
|
|
|
"cat params.json",
|
|
|
|
"appr push quay.io/quay -f",
|
|
|
|
"appr deploy quay.io/quay/quay-demo-app@%s --namespace %s -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS" % [appversion, namespace],
|
|
|
|
"kubectl get ingresses -n %s -o wide" % namespace,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
QuayDeployStop: self.QuayDeploy {
|
|
|
|
variables: {GIT_STRATEGY: "none"},
|
|
|
|
environment+: {
|
|
|
|
action: "stop"
|
|
|
|
},
|
|
|
|
script: [
|
|
|
|
'echo "{\\"image\\": \\"%s\\", \\"tag\\": \\"%s\\"}" > params.json' % [vars.images.quayci.name, vars.images.quayci.tag],
|
|
|
|
"cat params.json",
|
|
|
|
"appr remove quay.io/quay/quay-demo-app@%s --namespace %s -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS -x params.json" % [appversion, namespace],
|
|
|
|
"kubectl get pods -n %s -o wide" % namespace,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
2017-06-13 03:55:12 +00:00
|
|
|
dbTest(scheme, image, env):: self.QuayTest {
|
|
|
|
variables+: {
|
|
|
|
SKIP_DB_SCHEMA: 'true',
|
|
|
|
TEST_DATABASE_URI: '%s://quay:quay@localhost/quay' % scheme,
|
|
|
|
} + env,
|
|
|
|
services: [image],
|
|
|
|
script: [
|
|
|
|
"sleep 30",
|
|
|
|
"alembic upgrade head",
|
|
|
|
'PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|