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-19 22:34:08 +00:00
|
|
|
|
2017-07-16 23:24:31 +00:00
|
|
|
QuayDeploy: {
|
2017-07-19 22:34:08 +00:00
|
|
|
local this = self,
|
|
|
|
local _vars = self.localvars,
|
|
|
|
localvars:: {
|
|
|
|
appversion: "1.0.0-%s" % self.image.tag,
|
|
|
|
apprepo: "quay.io/quay/%s" % self.appname,
|
|
|
|
appname: "quay-ci-app",
|
|
|
|
domain: "quay-%s.k8s.devtable.com" % self.image.tag,
|
|
|
|
namespace: "ci-quay-%s" % self.image.tag,
|
|
|
|
image: vars.images.quayci,
|
|
|
|
channels: [],
|
|
|
|
pushargs: ["-f"],
|
|
|
|
|
|
|
|
buildParams(extra_params={}):: (
|
|
|
|
local params = {image: _vars.image.name,
|
|
|
|
tag: _vars.image.tag,
|
|
|
|
domain: "$QUAY_DOMAIN"} + extra_params;
|
|
|
|
[
|
|
|
|
"echo -n %s > VERSION" % _vars.appversion,
|
|
|
|
'echo %s > params.json' % std.escapeStringJson(params),
|
|
|
|
"cat params.json"
|
|
|
|
]),
|
|
|
|
|
|
|
|
pushApp(repo="quay.io/quay", extra_args=['-f'], channels=[]):: (
|
|
|
|
["appr push %s %s" % [repo, std.join(" ", extra_args)]] +
|
|
|
|
["appr push %s -c %s" % [repo, channel] for channel in channels]
|
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
variables: {K8S_NAMESPACE: _vars.namespace,
|
|
|
|
QUAY_DOMAIN: _vars.domain},
|
2017-07-16 23:24:31 +00:00
|
|
|
image: "quay.io/appr/appr:kubectl",
|
|
|
|
environment: {
|
2017-07-19 22:34:08 +00:00
|
|
|
name: "review/%s" % _vars.image.tag,
|
|
|
|
url: "https://%s" % _vars.domain,
|
2017-07-16 23:24:31 +00:00
|
|
|
},
|
|
|
|
tags: [
|
|
|
|
"kubernetes",
|
|
|
|
],
|
2017-07-19 22:34:08 +00:00
|
|
|
|
2017-07-16 23:24:31 +00:00
|
|
|
before_script: [
|
2017-07-19 22:34:08 +00:00
|
|
|
"appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io",
|
|
|
|
"cd deploy/%s" % _vars.appname,
|
|
|
|
] + _vars.buildParams(),
|
|
|
|
|
|
|
|
script:
|
|
|
|
_vars.pushApp(_vars.apprepo, _vars.pushargs, _vars.channels) +
|
|
|
|
[
|
|
|
|
"appr deploy %s@%s --namespace %s -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS" % [
|
|
|
|
_vars.apprepo,
|
|
|
|
_vars.appversion,
|
|
|
|
_vars.namespace],
|
|
|
|
"kubectl get ingresses -n %s -o wide" % _vars.namespace,
|
2017-07-16 23:24:31 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
QuayDeployStop: self.QuayDeploy {
|
2017-07-19 22:34:08 +00:00
|
|
|
variables+: {GIT_STRATEGY: "none"},
|
2017-07-16 23:24:31 +00:00
|
|
|
environment+: {
|
|
|
|
action: "stop"
|
|
|
|
},
|
2017-07-19 22:34:08 +00:00
|
|
|
before_script: [],
|
|
|
|
script: [],
|
2017-07-16 23:24:31 +00:00
|
|
|
},
|
|
|
|
|
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,
|
2017-06-20 09:30:27 +00:00
|
|
|
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
|
2017-06-13 03:55:12 +00:00
|
|
|
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',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|