Remove old GitLab CI config

This commit is contained in:
Brad Ison 2018-06-05 14:34:04 -04:00
parent aceef8e048
commit b3982e1d3f
No known key found for this signature in database
GPG key ID: 972D14B0BE6DE287
5 changed files with 0 additions and 804 deletions

View file

@ -1,205 +0,0 @@
local utils = import '.gitlab-ci/utils.libsonnet';
local vars = import '.gitlab-ci/vars.libsonnet';
local mergeJob = utils.ci.mergeJob;
local images = vars.images;
local baseJob = (import '.gitlab-ci/base_jobs.libsonnet')(vars);
local stages_list = [
// gitlab-ci stages
'docker_base',
'docker_build',
'deploy_preview',
'tests',
'integration',
'docker_release',
'deploy_staging',
'teardown',
];
local stages = utils.set(stages_list);
// List CI jobs
local jobs = {
// Helpers
local onlyMaster = {
only: ['master', 'tags'],
},
local onlyBranch = {
only: ['branches'],
except: ['master']
},
'container-base-build': baseJob.dockerBuild {
// ! Only master/tags
// Update the base container
stage: stages.docker_base,
script: [
'docker build --no-cache' +
' -t %s -f quay-base.dockerfile .' % images.base.name,
'docker push %s' % images.base.name,
],
only: ["schedules"]
},
'container-build': baseJob.dockerBuild {
// Build and push the quay container.
// Docker Tag is the branch/tag name
stage: stages.docker_build,
script: [
'docker build --no-cache -t %s -f Dockerfile .' % images.quayci.name,
'docker run --rm %s cat ALEMBIC_HEAD > /tmp/ALEMBIC_HEAD' % images.quayci.name,
'export MIGRATION_HEAD=`cat /tmp/ALEMBIC_HEAD | cut -d" " -f1`',
'echo $MIGRATION_HEAD',
'docker build --label db-schema-head=$MIGRATION_HEAD -t %s -f Dockerfile .' % images.quayci.name,
'docker push %s' % images.quayci.name],
},
'container-release': baseJob.dockerBuild + onlyMaster {
// ! Only master/tags
// push the container to the 'prod' repository
local repo_with_sha = images.release.name,
stage: stages.docker_release,
script: [
'docker pull %s' % images.quayci.name,
'docker tag %s %s' % [images.quayci.name, repo_with_sha],
'docker push %s' % [repo_with_sha], # @TODO(ant31) add signing
],
},
// Unit-tests
local unittest_stage = baseJob.QuayTest {
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 {
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
script: [
pytest_cmd + ' ./',],
after_script: [
'cp -r $QUAYDIR/htmlcov/ $CI_PROJECT_DIR/coverage'
],
artifacts: {
paths: ['coverage',]
}
},
'registry-tests': unittest_stage {
script: [ pytest_cmd + ' ./test/registry/registry_tests.py'],
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
},
// UI tests
'karma-tests': unittest_stage {
script: [
'curl -Ss https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -',
'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list',
'apt-get update -yqqq',
'apt-get install -y google-chrome-stable',
'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
local db_stage = { stage: stages.tests },
local dbname = 'quay',
postgres: db_stage + baseJob.dbTest('postgresql',
image='postgres:9.6',
env={ POSTGRES_PASSWORD: dbname, POSTGRES_USER: dbname }),
mysql: db_stage + baseJob.dbTest('mysql+pymysql',
image='mysql:latest',
env={ [key]: dbname for key in ['MYSQL_ROOT_PASSWORD', 'MYSQL_DATABASE',
'MYSQL_USER', 'MYSQL_PASSWORD'] }),
"deploy-preview": baseJob.QuayDeploy {
local _vars = self.localvars,
stage: stages.deploy_preview,
when: "manual",
environment+: {
on_stop: "stop-preview",
},
} + onlyBranch,
"stop-preview": baseJob.QuayDeployStop {
when: "manual",
stage: stages.deploy_preview,
script: [
"kubectl delete ns $K8S_NAMESPACE",
"kubectl get pods -o wide -n $K8S_NAMESPACE"
]
} + onlyBranch,
"deploy-staging": baseJob.QuayDeploy {
local _vars = self.localvars,
localvars+:: {
image: images.release,
domain: "quay-staging.k8s.devtable.com",
namespace: "ci-staging",
channels: ['master' , 'beta', 'latest'],
},
stage: stages.deploy_staging,
script+: [],
environment+: {
name: "staging",
},
only: ['master']
},
};
{
stages: stages_list,
variables: vars.global,
} + jobs

View file

@ -1,357 +0,0 @@
# Generated from .gitlab-ci.jsonnet
# 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:
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
image: docker:git
only:
- schedules
script:
- docker build --no-cache -t quay.io/quay/quay-base:latest -f quay-base.dockerfile .
- docker push quay.io/quay/quay-base:latest
stage: docker_base
tags:
- kubernetes
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
container-build:
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
image: docker:git
script:
- docker build --no-cache -t quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} -f Dockerfile .
- docker run --rm quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} cat ALEMBIC_HEAD > /tmp/ALEMBIC_HEAD
- export MIGRATION_HEAD=`cat /tmp/ALEMBIC_HEAD | cut -d" " -f1`
- echo $MIGRATION_HEAD
- docker build --label db-schema-head=$MIGRATION_HEAD -t quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} -f Dockerfile .
- docker push quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
stage: docker_build
tags:
- kubernetes
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
container-release:
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io
image: docker:git
only:
- master
- tags
script:
- docker pull quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
- docker tag quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG} quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}
- docker push quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}
stage: docker_release
tags:
- kubernetes
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker-host.gitlab-runner.svc.cluster.local:2375
deploy-preview:
before_script:
- appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io
- cd deploy/quay-ci-app
- echo -n 1.0.0-${CI_COMMIT_REF_SLUG} > VERSION
- 'echo "{\"domain\": \"$QUAY_DOMAIN\", \"image\": \"quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}\", \"tag\": \"${CI_COMMIT_REF_SLUG}\"}" > params.json'
- cat params.json
environment:
name: review/${CI_COMMIT_REF_SLUG}
on_stop: stop-preview
url: https://quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
except:
- master
image: quay.io/appr/appr:kubectl
only:
- branches
script:
- appr push quay.io/quay/quay-ci-app -f
- appr deploy quay.io/quay/quay-ci-app@1.0.0-${CI_COMMIT_REF_SLUG} --namespace ci-quay-${CI_COMMIT_REF_SLUG} -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS
- kubectl get ingresses -n ci-quay-${CI_COMMIT_REF_SLUG} -o wide
stage: deploy_preview
tags:
- kubernetes
variables:
K8S_NAMESPACE: ci-quay-${CI_COMMIT_REF_SLUG}
QUAY_DOMAIN: quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
when: manual
deploy-staging:
before_script:
- appr login -u $DOCKER_USER -p $DOCKER_PASS quay.io
- cd deploy/quay-ci-app
- echo -n 1.0.0-${CI_COMMIT_REF_SLUG}-${SHA8} > VERSION
- 'echo "{\"domain\": \"$QUAY_DOMAIN\", \"image\": \"quay.io/quay/quay:${CI_COMMIT_REF_SLUG}-${SHA8}\", \"tag\": \"${CI_COMMIT_REF_SLUG}-${SHA8}\"}" > params.json'
- cat params.json
environment:
name: staging
url: https://quay-staging.k8s.devtable.com
image: quay.io/appr/appr:kubectl
only:
- master
script:
- appr push quay.io/quay/quay-ci-app -f
- appr push quay.io/quay/quay-ci-app -c master
- appr push quay.io/quay/quay-ci-app -c beta
- appr push quay.io/quay/quay-ci-app -c latest
- appr deploy quay.io/quay/quay-ci-app@1.0.0-${CI_COMMIT_REF_SLUG}-${SHA8} --namespace ci-staging -x docker_user=$DOCKER_USER -x docker_pass=$DOCKER_PASS
- kubectl get ingresses -n ci-staging -o wide
stage: deploy_staging
tags:
- kubernetes
variables:
K8S_NAMESPACE: ci-staging
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:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- curl -Ss https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
- echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
- apt-get update -yqqq
- apt-get install -y google-chrome-stable
- yarn test
stage: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
PYTHONPATH: .
QUAYDIR: /quay-registry
TEST: 'true'
mysql:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- sleep 30
- alembic upgrade head
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
services:
- mysql:latest
stage: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
MYSQL_DATABASE: quay
MYSQL_PASSWORD: quay
MYSQL_ROOT_PASSWORD: quay
MYSQL_USER: quay
PYTHONPATH: .
QUAYDIR: /quay-registry
SKIP_DB_SCHEMA: 'true'
TEST: 'true'
TEST_DATABASE_URI: mysql+pymysql://quay:quay@localhost/quay
postgres:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
image: quay.io/quay/quay-ci:${CI_COMMIT_REF_SLUG}
script:
- sleep 30
- alembic upgrade head
- PYTHONPATH="." TEST="true" py.test --timeout=7200 --verbose --show-count ./ --color=no --ignore=endpoints/appr/test/ -x
services:
- postgres:9.6
stage: tests
tags:
- kubernetes
variables:
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
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:
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
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/registry_tests.py
stage: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
PYTHONPATH: .
QUAYDIR: /quay-registry
TEST: 'true'
stages:
- docker_base
- docker_build
- deploy_preview
- tests
- integration
- docker_release
- deploy_staging
- teardown
stop-preview:
before_script: []
environment:
action: stop
name: review/${CI_COMMIT_REF_SLUG}
url: https://quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
except:
- master
image: quay.io/appr/appr:kubectl
only:
- branches
script:
- kubectl delete ns $K8S_NAMESPACE
- kubectl get pods -o wide -n $K8S_NAMESPACE
stage: deploy_preview
tags:
- kubernetes
variables:
GIT_STRATEGY: none
K8S_NAMESPACE: ci-quay-${CI_COMMIT_REF_SLUG}
QUAY_DOMAIN: quay-${CI_COMMIT_REF_SLUG}.k8s.devtable.com
when: manual
unit-tests:
after_script:
- cp -r $QUAYDIR/htmlcov/ $CI_PROJECT_DIR/coverage
artifacts:
paths:
- coverage
before_script:
- cd $QUAYDIR
- source $QUAYDIR/venv/bin/activate
coverage: /^TOTAL.*\s+(\d+\%)\s*$/
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: tests
tags:
- kubernetes
variables:
GIT_STRATEGY: none
PYTHONPATH: .
QUAYDIR: /quay-registry
TEST: 'true'
variables:
FAILFASTCI_NAMESPACE: quay

View file

@ -1,145 +0,0 @@
function(vars={})
{
dockerBuild: {
// base job to manage containers (build / push)
variables: {
DOCKER_DRIVER: "overlay2",
DOCKER_HOST: "tcp://docker-host.gitlab-runner.svc.cluster.local:2375"
},
image: "docker:git",
before_script: [
"docker login -u $DOCKER_USER -p $DOCKER_PASS quay.io",
],
tags: [
"kubernetes",
],
},
QuayTest: {
// base job to test the container
image: vars.images.quayci.name,
variables: {
TEST: "true",
PYTHONPATH: ".",
QUAYDIR: "/quay-registry",
GIT_STRATEGY: "none",
},
before_script: [
"cd $QUAYDIR",
"source $QUAYDIR/venv/bin/activate",
],
tags: [
"kubernetes",
],
},
QuayDeploy: {
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},
image: "quay.io/appr/appr:kubectl",
environment: {
name: "review/%s" % _vars.image.tag,
url: "https://%s" % _vars.domain,
},
tags: [
"kubernetes",
],
before_script: [
"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,
],
},
QuayDeployStop: self.QuayDeploy {
variables+: {GIT_STRATEGY: "none"},
environment+: {
action: "stop"
},
before_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 {
variables+: {
SKIP_DB_SCHEMA: 'true',
TEST_DATABASE_URI: '%s://quay:quay@localhost/quay' % scheme,
} + env,
coverage: @"/^TOTAL.*\s+(\d+\%)\s*$/",
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',
],
},
}

View file

@ -1,66 +0,0 @@
{
local topSelf = self,
# Generate a sequence array from 1 to i
seq(i):: (
[x for x in std.range(1, i)]
),
objectFieldsHidden(obj):: (
std.setDiff(std.objectFieldsAll(obj), std.objectFields(obj))
),
objectFlatten(obj):: (
// Merge 1 level dict depth into toplevel
local visible = { [k]: obj[j][k]
for j in std.objectFieldsAll(obj)
for k in std.objectFieldsAll(obj[j]) };
visible
),
compact(array):: (
[x for x in array if x != null]
),
objectValues(obj):: (
local fields = std.objectFields(obj);
[obj[key] for key in fields]
),
objectMap(func, obj):: (
local fields = std.objectFields(obj);
{ [key]: func(obj[key]) for key in fields }
),
capitalize(str):: (
std.char(std.codepoint(str[0]) - 32) + str[1:]
),
test: self.capitalize("test"),
set(array)::
{ [key]: key for key in array },
containerName(repo, tag):: "%s:%s" % [repo, tag],
ci: {
mergeJob(base_job, jobs, stage=null):: {
[job_name]: base_job + jobs[job_name] +
if stage != null then { stage: stage } else {}
for job_name in std.objectFields(jobs)
},
only(key):: (
if key == "master"
then { only: ['master', 'tags'] }
else { only: ['branches'] }
),
setManual(key, values):: (
if std.objectHas(topSelf.set(values), key)
then { when: 'manual' }
else { only: ['branches'] }
),
},
}

View file

@ -1,31 +0,0 @@
local utils = import "utils.libsonnet";
{
global: {
// .gitlab-ci.yaml top `variables` key
FAILFASTCI_NAMESPACE: "quay",
},
// internal variables
images: {
// Quay initial image, used in the Dockerfile FROM clause
base: { repo: "quay.io/quay/quay-base", tag: "latest",
name: utils.containerName(self.repo, self.tag),
},
// release is a copy of the quayci image to the 'prod' repository
release: { repo: "quay.io/quay/quay",
tag: "${CI_COMMIT_REF_SLUG}-${SHA8}",
name: utils.containerName(self.repo, self.tag),
},
quayci: { repo: "quay.io/quay/quay-ci",
tag: "${CI_COMMIT_REF_SLUG}",
name: utils.containerName(self.repo, self.tag),
},
coverage: { repo: "quay.io/quay/quay-coverage", tag: "${CI_COMMIT_REF_SLUG}",
name: utils.containerName(self.repo, self.tag),
},
},
}